Skip to content

Commit 75b94a8

Browse files
committed
Use existing set_color_scheme
1 parent 8d8f615 commit 75b94a8

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

Diff for: spyder/widgets/ipythonconsole/client.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def configure_shellwidget(self, give_focus=True):
232232
self.shellwidget.executed.connect(self.shellwidget.get_cwd)
233233

234234
# To apply style
235-
self.set_console_scheme(self.shellwidget)
235+
self.set_color_scheme(self.shellwidget.syntax_style)
236236

237237
# To hide the loading page
238238
self.shellwidget.sig_prompt_ready.connect(self._hide_loading_page)
@@ -433,10 +433,6 @@ def set_color_scheme(self, color_scheme):
433433
"""Set IPython color scheme."""
434434
self.shellwidget.set_color_scheme(color_scheme)
435435

436-
def set_console_scheme(self, sw):
437-
"""Set scheme for %colors."""
438-
sw.set_console_scheme(create_qss_style(sw.syntax_style)[1])
439-
440436
def shutdown(self):
441437
"""Shutdown kernel"""
442438
if self.get_kernel() is not None and not self.slave:
@@ -476,13 +472,12 @@ def restart_kernel(self):
476472
before_prompt=True
477473
)
478474
else:
479-
sw.reset(clear=True)
480-
sw._append_html(_("<br>Restarting kernel...\n<hr><br>"),
481-
before_prompt=False)
482475
# For issue 6235. IPython was changing the setting of
483476
# %colors on windows by assuming it was using a dark
484477
# background. This corrects it based on the scheme.
485-
self.set_console_scheme(sw)
478+
self.set_color_scheme(sw.syntax_style)
479+
sw._append_html(_("<br>Restarting kernel...\n<hr><br>"),
480+
before_prompt=False)
486481
else:
487482
sw._append_plain_text(
488483
_('Cannot restart a kernel not started by Spyder\n'),

Diff for: spyder/widgets/ipythonconsole/shell.py

+4-13
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,10 @@ def set_color_scheme(self, color_scheme):
141141
self._style_sheet_changed()
142142
self._syntax_style_changed()
143143
self.reset(clear=True)
144-
self.set_console_scheme(dark_color)
145-
146-
def set_console_scheme(self, dark=True):
147-
"""Apply highlight style to console.
148-
149-
lightbg is dark coloring for light backgrounds and linux is light
150-
coloring for dark backgrounds.
151-
152-
Args:
153-
dark: Boolean for console scheme to use.
154-
"""
155-
scheme = 'lightbg' if dark else 'linux'
156-
self.silent_execute('%colors {}'.format(scheme))
144+
if not dark_color:
145+
self.silent_execute("%colors linux")
146+
else:
147+
self.silent_execute("%colors lightbg")
157148

158149
def get_syspath(self):
159150
"""Ask the kernel for sys.path contents."""

0 commit comments

Comments
 (0)