Skip to content

Commit

Permalink
Merge pull request #15595 from dalthviz/circular_dependency_help_ipyc…
Browse files Browse the repository at this point in the history
…onsole

PR: Move css_path to Appearance config section (IPython Console)
  • Loading branch information
ccordoba12 committed May 12, 2021
2 parents 89e3e00 + f9e1628 commit 4c31e17
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
12 changes: 5 additions & 7 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,10 @@ def setup(self):
self.setStyleSheet(light_qss)
self.statusBar().setStyleSheet(light_qss)
css_path = CSS_PATH

# Set css_path as a configuration to be used by the plugins
CONF.set('appearance', 'css_path', css_path)

# Status bar
status = self.statusBar()
status.setObjectName("StatusBar")
Expand All @@ -822,12 +826,6 @@ def setup(self):
CONF.set('internal_console', 'namespace', {})
CONF.set('internal_console', 'show_internal_errors', True)

# Set css_path config (to change between light and dark css versions
# for the Help and IPython console plugins)
# TODO: There is a circular dependency between help and ipython
if CONF.get('help', 'enable'):
CONF.set('help', 'css_path', css_path)

# Working directory initialization
CONF.set('workingdir', 'init_workdir', self.init_workdir)

Expand Down Expand Up @@ -861,7 +859,7 @@ def setup(self):
Plugins.IPythonConsole,
Plugins.Projects]:
if plugin_name == Plugins.IPythonConsole:
plugin_instance = plugin_class(self, css_path=css_path)
plugin_instance = plugin_class(self)
plugin_instance.sig_exception_occurred.connect(
self.handle_exception)
else:
Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/help/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def __init__(self, name=None, plugin=None, parent=None):
self._last_editor_doc = None
self._last_console_cb = None
self._last_editor_cb = None
self.css_path = self.get_conf('css_path')
self.css_path = self.get_conf('css_path', CSS_PATH, 'appearance')
self.no_docs = _("No documentation available")
self.docstring = True # TODO: What is this used for?

Expand Down
4 changes: 2 additions & 2 deletions spyder/plugins/ipythonconsole/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class IPythonConsole(SpyderPluginWidget):
"make it writable.")

def __init__(self, parent, testing=False, test_dir=None,
test_no_stderr=False, css_path=None):
test_no_stderr=False):
"""Ipython Console constructor."""
SpyderPluginWidget.__init__(self, parent)

Expand All @@ -176,7 +176,7 @@ def __init__(self, parent, testing=False, test_dir=None,
self.filenames = []
self.mainwindow_close = False
self.create_new_client_if_empty = True
self.css_path = css_path
self.css_path = CONF.get('appearance', 'css_path')
self.run_cell_filename = None
self.interrupt_action = None

Expand Down
3 changes: 3 additions & 0 deletions spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from spyder.config.manager import CONF
from spyder.py3compat import PY2, to_text_string
from spyder.plugins.help.tests.test_plugin import check_text
from spyder.plugins.help.utils.sphinxify import CSS_PATH
from spyder.plugins.ipythonconsole.plugin import IPythonConsole
from spyder.plugins.ipythonconsole.utils.style import create_style_class
from spyder.utils.programs import get_temp_dir
Expand Down Expand Up @@ -170,6 +171,8 @@ def __getattr__(self, attr):
CONF.set('main_interpreter', 'default', True)
CONF.set('main_interpreter', 'executable', '')

# Conf css_path in the Appeareance plugin
CONF.set('appearance', 'css_path', CSS_PATH)

# Create the console and a new client
window = MainWindowMock()
Expand Down

0 comments on commit 4c31e17

Please sign in to comment.