##// END OF EJS Templates
Merge pull request #9673 from takluyver/rm-colors-force...
Matthias Bussonnier -
r22620:107350a6 merge
parent child Browse files
Show More
@@ -252,15 +252,6 b' class InteractiveShell(SingletonConfigurable):'
252 default_value='Neutral',
252 default_value='Neutral',
253 help="Set the color scheme (NoColor, Neutral, Linux, or LightBG)."
253 help="Set the color scheme (NoColor, Neutral, Linux, or LightBG)."
254 ).tag(config=True)
254 ).tag(config=True)
255 colors_force = Bool(False, help=
256 """
257 Force use of ANSI color codes, regardless of OS and readline
258 availability.
259 """
260 # FIXME: This is essentially a hack to allow ZMQShell to show colors
261 # without readline on Win32. When the ZMQ formatting system is
262 # refactored, this should be removed.
263 )
264 debug = Bool(False).tag(config=True)
255 debug = Bool(False).tag(config=True)
265 deep_reload = Bool(False, help=
256 deep_reload = Bool(False, help=
266 """
257 """
@@ -647,6 +638,10 b' class InteractiveShell(SingletonConfigurable):'
647 pyformat = PyColorize.Parser().format
638 pyformat = PyColorize.Parser().format
648 self.pycolorize = lambda src: pyformat(src,'str',self.colors)
639 self.pycolorize = lambda src: pyformat(src,'str',self.colors)
649
640
641 def refresh_style(self):
642 # No-op here, used in subclass
643 pass
644
650 def init_pushd_popd_magic(self):
645 def init_pushd_popd_magic(self):
651 # for pushd/popd management
646 # for pushd/popd management
652 self.home_dir = get_home_dir()
647 self.home_dir = get_home_dir()
@@ -335,31 +335,16 b' Currently the magic system has the following functions:""",'
335 # local shortcut
335 # local shortcut
336 shell = self.shell
336 shell = self.shell
337
337
338
338 # Set shell colour scheme
339
339 try:
340 if not shell.colors_force:
340 shell.colors = new_scheme
341 if sys.platform in {'win32', 'cli'}:
341 shell.refresh_style()
342 import IPython.utils.rlineimpl as readline
342 except:
343 if not readline.have_readline:
343 color_switch_err('shell')
344 msg = """\
345 Proper color support under MS Windows requires the pyreadline library.
346 You can find it at:
347 http://ipython.org/pyreadline.html
348
349 Defaulting color scheme to 'NoColor'"""
350 new_scheme = 'NoColor'
351 warn(msg)
352
353 elif not shell.has_readline:
354 # Coloured prompts get messed up without readline
355 # Will remove this check after switching to prompt_toolkit
356 new_scheme = 'NoColor'
357
344
358 # Set exception colors
345 # Set exception colors
359 try:
346 try:
360 shell.InteractiveTB.set_colors(scheme = new_scheme)
347 shell.InteractiveTB.set_colors(scheme = new_scheme)
361 shell.colors = new_scheme
362 shell.refresh_style()
363 shell.SyntaxTB.set_colors(scheme = new_scheme)
348 shell.SyntaxTB.set_colors(scheme = new_scheme)
364 except:
349 except:
365 color_switch_err('exception')
350 color_switch_err('exception')
@@ -87,8 +87,6 b' else:'
87 _use_simple_prompt = ('IPY_TEST_SIMPLE_PROMPT' in os.environ) or (not _is_tty)
87 _use_simple_prompt = ('IPY_TEST_SIMPLE_PROMPT' in os.environ) or (not _is_tty)
88
88
89 class TerminalInteractiveShell(InteractiveShell):
89 class TerminalInteractiveShell(InteractiveShell):
90 colors_force = True
91
92 space_for_menu = Integer(6, help='Number of line at the bottom of the screen '
90 space_for_menu = Integer(6, help='Number of line at the bottom of the screen '
93 'to reserve for the completion menu'
91 'to reserve for the completion menu'
94 ).tag(config=True)
92 ).tag(config=True)
General Comments 0
You need to be logged in to leave comments. Login now