Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbautista committed Jan 31, 2025
1 parent bf929d2 commit bfdc182
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
12 changes: 12 additions & 0 deletions spyder/plugins/ipythonconsole/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ def on_initialize(self):
widget = self.get_widget()

# Main widget signals
# Connect signal to open preferences
widget.sig_open_preferences_requested.connect(
self._open_interpreter_preferences)
widget.sig_append_to_history_requested.connect(
self.sig_append_to_history_requested)
widget.sig_switch_to_plugin_requested.connect(self.switch_to_plugin)
Expand Down Expand Up @@ -590,6 +593,15 @@ def _rename_remote_clients(self, server_id):
def _update_envs(self, envs):
self.get_widget().update_envs(envs)

def _open_interpreter_preferences(self):
"""Open the Preferences dialog in the main interpreter section."""
self._main.show_preferences()
preferences = self._main.preferences
container = preferences.get_container()
dlg = container.dialog
index = dlg.get_index_by_name("main_interpreter")
dlg.set_current_index(index)

# ---- Public API
# -------------------------------------------------------------------------

Expand Down
16 changes: 5 additions & 11 deletions spyder/plugins/ipythonconsole/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ class IPythonConsoleWidget(PluginMainWidget, CachedKernelMixin):
"""

# Signals
sig_open_preferences_requested = Signal()
"""
Signal to open the main interpreter preferences.
"""
sig_append_to_history_requested = Signal(str, str)
"""
This signal is emitted when the plugin requires to add commands to a
Expand Down Expand Up @@ -389,8 +393,7 @@ def __init__(self, name=None, plugin=None, parent=None):
self.sig_interpreter_changed
)
self.pythonenv_status.sig_open_preferences_requested.connect(
self._open_interpreter_preferences
)
self.sig_open_preferences_requested)

# Initial value for the current working directory
self._current_working_directory = get_home_dir()
Expand Down Expand Up @@ -1163,15 +1166,6 @@ def _init_asyncio_patch(self):
asyncio.set_event_loop_policy(
WindowsSelectorEventLoopPolicy())

def _open_interpreter_preferences(self):
"""Open the Preferences dialog in the main interpreter section."""
self._main.show_preferences()
preferences = self._main.preferences
container = preferences.get_container()
dlg = container.dialog
index = dlg.get_index_by_name("main_interpreter")
dlg.set_current_index(index)

@Slot()
def _create_client_for_kernel(self):
"""Create a client connected to an existing kernel"""
Expand Down
1 change: 0 additions & 1 deletion spyder/plugins/maininterpreter/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class MainInterpreterContainer(PluginMainContainer):
:py:meth:`spyder.utils.envs.get_list_envs`.
"""


def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down

0 comments on commit bfdc182

Please sign in to comment.