##// END OF EJS Templates
Update IPython/core/prompts.py to traitlets 4.2 API
Matthias Bussonnier -
Show More
@@ -31,7 +31,7 b' from string import Formatter'
31 from traitlets.config.configurable import Configurable
31 from traitlets.config.configurable import Configurable
32 from IPython.core import release
32 from IPython.core import release
33 from IPython.utils import coloransi, py3compat
33 from IPython.utils import coloransi, py3compat
34 from traitlets import (Unicode, Instance, Dict, Bool, Int)
34 from traitlets import Unicode, Instance, Dict, Bool, Int, observe
35
35
36 from IPython.utils.PyColorize import LightBGColors, LinuxColors, NoColor
36 from IPython.utils.PyColorize import LightBGColors, LinuxColors, NoColor
37
37
@@ -256,9 +256,11 b' class PromptManager(Configurable):'
256 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
256 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
257
257
258 color_scheme_table = Instance(coloransi.ColorSchemeTable, allow_none=True)
258 color_scheme_table = Instance(coloransi.ColorSchemeTable, allow_none=True)
259 color_scheme = Unicode('Linux', config=True)
259 color_scheme = Unicode('Linux').tag(config=True)
260 def _color_scheme_changed(self, name, new_value):
260
261 self.color_scheme_table.set_active_scheme(new_value)
261 @observe('color_scheme')
262 def _color_scheme_changed(self, change):
263 self.color_scheme_table.set_active_scheme(change['new'])
262 for pname in ['in', 'in2', 'out', 'rewrite']:
264 for pname in ['in', 'in2', 'out', 'rewrite']:
263 # We need to recalculate the number of invisible characters
265 # We need to recalculate the number of invisible characters
264 self.update_prompt(pname)
266 self.update_prompt(pname)
@@ -271,14 +273,14 b' class PromptManager(Configurable):'
271 """)
273 """)
272 def _lazy_evaluate_fields_default(self): return lazily_evaluate.copy()
274 def _lazy_evaluate_fields_default(self): return lazily_evaluate.copy()
273
275
274 in_template = Unicode('In [\\#]: ', config=True,
276 in_template = Unicode('In [\\#]: ').tag(config=True,
275 help="Input prompt. '\\#' will be transformed to the prompt number")
277 help="Input prompt. '\\#' will be transformed to the prompt number")
276 in2_template = Unicode(' .\\D.: ', config=True,
278 in2_template = Unicode(' .\\D.: ').tag(config=True,
277 help="Continuation prompt.")
279 help="Continuation prompt.")
278 out_template = Unicode('Out[\\#]: ', config=True,
280 out_template = Unicode('Out[\\#]: ').tag(config=True,
279 help="Output prompt. '\\#' will be transformed to the prompt number")
281 help="Output prompt. '\\#' will be transformed to the prompt number")
280
282
281 justify = Bool(True, config=True, help="""
283 justify = Bool(True).tag(config=True, help="""
282 If True (default), each prompt will be right-aligned with the
284 If True (default), each prompt will be right-aligned with the
283 preceding one.
285 preceding one.
284 """)
286 """)
General Comments 0
You need to be logged in to leave comments. Login now