Skip to content

Commit

Permalink
Use existing set_color_scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
csabella committed Jan 24, 2018
1 parent de5a338 commit 1d65d03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
13 changes: 4 additions & 9 deletions spyder/widgets/ipythonconsole/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def configure_shellwidget(self, give_focus=True):
self.shellwidget.executed.connect(self.shellwidget.get_cwd)

# To apply style
self.set_console_scheme(self.shellwidget)
self.set_color_scheme(self.shellwidget.syntax_style)

# To hide the loading page
self.shellwidget.sig_prompt_ready.connect(self._hide_loading_page)
Expand Down Expand Up @@ -433,10 +433,6 @@ def set_color_scheme(self, color_scheme):
"""Set IPython color scheme."""
self.shellwidget.set_color_scheme(color_scheme)

def set_console_scheme(self, sw):
"""Set scheme for %colors."""
sw.set_console_scheme(create_qss_style(sw.syntax_style)[1])

def shutdown(self):
"""Shutdown kernel"""
if self.get_kernel() is not None and not self.slave:
Expand Down Expand Up @@ -476,13 +472,12 @@ def restart_kernel(self):
before_prompt=True
)
else:
sw.reset(clear=True)
sw._append_html(_("<br>Restarting kernel...\n<hr><br>"),
before_prompt=False)
# For issue 6235. IPython was changing the setting of
# %colors on windows by assuming it was using a dark
# background. This corrects it based on the scheme.
self.set_console_scheme(sw)
self.set_color_scheme(sw.syntax_style)
sw._append_html(_("<br>Restarting kernel...\n<hr><br>"),
before_prompt=False)
else:
sw._append_plain_text(
_('Cannot restart a kernel not started by Spyder\n'),
Expand Down
17 changes: 4 additions & 13 deletions spyder/widgets/ipythonconsole/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,10 @@ def set_color_scheme(self, color_scheme):
self._style_sheet_changed()
self._syntax_style_changed()
self.reset(clear=True)
self.set_console_scheme(dark_color)

def set_console_scheme(self, dark=True):
"""Apply highlight style to console.
lightbg is dark coloring for light backgrounds and linux is light
coloring for dark backgrounds.
Args:
dark: Boolean for console scheme to use.
"""
scheme = 'lightbg' if dark else 'linux'
self.silent_execute('%colors {}'.format(scheme))
if not dark_color:
self.silent_execute("%colors linux")
else:
self.silent_execute("%colors lightbg")

def get_syspath(self):
"""Ask the kernel for sys.path contents."""
Expand Down

0 comments on commit 1d65d03

Please sign in to comment.