Skip to content

Commit

Permalink
emit signal when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Peter committed Oct 12, 2022
1 parent 75c8081 commit 52532ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions spyder/plugins/ipythonconsole/utils/kernel_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ def __init__(
self._spyder_kernel_info_uuid = None
self.check_kernel_info()

def connect(self):
"""Connect to shellwidget."""
if self.kernel_state != KernelState.Connecting:
# Emit signal in case the connection is already made
self.sig_kernel_state_changed.emit()

def check_kernel_info(self):
"""Send request to check kernel info."""
code = "getattr(get_ipython(), '_spyder_kernels_version', False)"
Expand Down
1 change: 1 addition & 0 deletions spyder/plugins/ipythonconsole/widgets/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def insert_horizontal_ruler(self):
ruler.setWidth(10000)
ruler.setBackground(QColor(QStylePalette.COLOR_TEXT_1))
cursor = self.textCursor()
cursor.movePosition(cursor.End)
cursor.insertFrame(ruler)

# ---- Private methods ---------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions spyder/plugins/ipythonconsole/widgets/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ def connect_kernel(self, kernel_handler):
kernel_handler.sig_kernel_state_changed.connect(
self.handle_kernel_state_changed)

# Call in case the signal was already sent
self.handle_kernel_state_changed()
kernel_handler.connect()

def handle_kernel_state_changed(self):
"""The kernel status changed"""
Expand Down

0 comments on commit 52532ad

Please sign in to comment.