Show More
@@ -315,10 +315,37 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
315 | help="Save multi-line entries as one entry in readline history" |
|
315 | help="Save multi-line entries as one entry in readline history" | |
316 | ) |
|
316 | ) | |
317 |
|
317 | |||
318 | prompt_in1 = Unicode('In [\\#]: ', config=True) |
|
318 | # deprecated prompt traits: | |
319 | prompt_in2 = Unicode(' .\\D.: ', config=True) |
|
319 | ||
320 |
prompt_ |
|
320 | prompt_in1 = Unicode('In [\\#]: ', config=True, | |
321 | prompts_pad_left = CBool(True, config=True) |
|
321 | help="Deprecated, use PromptManager.in_template") | |
|
322 | prompt_in2 = Unicode(' .\\D.: ', config=True, | |||
|
323 | help="Deprecated, use PromptManager.in2_template") | |||
|
324 | prompt_out = Unicode('Out[\\#]: ', config=True, | |||
|
325 | help="Deprecated, use PromptManager.out_template") | |||
|
326 | prompts_pad_left = CBool(True, config=True, | |||
|
327 | help="Deprecated, use PromptManager.justify") | |||
|
328 | ||||
|
329 | def _prompt_trait_changed(self, name, old, new): | |||
|
330 | table = { | |||
|
331 | 'prompt_in1' : 'in_template', | |||
|
332 | 'prompt_in2' : 'in2_template', | |||
|
333 | 'prompt_out' : 'out_template', | |||
|
334 | 'prompts_pad_left' : 'justify', | |||
|
335 | } | |||
|
336 | warn("InteractiveShell.{name} is deprecated, use PromptManager.{newname}\n".format( | |||
|
337 | name=name, newname=table[name]) | |||
|
338 | ) | |||
|
339 | # protect against weird cases where self.config may not exist: | |||
|
340 | if self.config is not None: | |||
|
341 | # propagate to corresponding PromptManager trait | |||
|
342 | setattr(self.config.PromptManager, table[name], new) | |||
|
343 | ||||
|
344 | _prompt_in1_changed = _prompt_trait_changed | |||
|
345 | _prompt_in2_changed = _prompt_trait_changed | |||
|
346 | _prompt_out_changed = _prompt_trait_changed | |||
|
347 | _prompt_pad_left_changed = _prompt_trait_changed | |||
|
348 | ||||
322 | quiet = CBool(False, config=True) |
|
349 | quiet = CBool(False, config=True) | |
323 |
|
350 | |||
324 | history_length = Integer(10000, config=True) |
|
351 | history_length = Integer(10000, config=True) |
@@ -254,10 +254,14 b' class PromptManager(Configurable):' | |||||
254 | """) |
|
254 | """) | |
255 | def _lazy_evaluate_fields_default(self): return lazily_evaluate.copy() |
|
255 | def _lazy_evaluate_fields_default(self): return lazily_evaluate.copy() | |
256 |
|
256 | |||
257 |
in_template = Unicode('In [\\#]: ', config=True |
|
257 | in_template = Unicode('In [\\#]: ', config=True, | |
258 | in2_template = Unicode(' .\\D.: ', config=True) |
|
258 | help="Input prompt. '\\#' will be transformed to the prompt number") | |
259 |
|
|
259 | in2_template = Unicode(' .\\D.: ', config=True, | |
260 | rewrite_template = Unicode("------> ", config=True) |
|
260 | help="Continuation prompt.") | |
|
261 | out_template = Unicode('Out[\\#]: ', config=True, | |||
|
262 | help="Output prompt. '\\#' will be transformed to the prompt number") | |||
|
263 | rewrite_template = Unicode("------> ", config=True, | |||
|
264 | help="Rewrite prompt. When inputs are transformed, the rewritten input will follow this.") | |||
261 |
|
265 | |||
262 | justify = Bool(True, config=True, help=""" |
|
266 | justify = Bool(True, config=True, help=""" | |
263 | If True (default), each prompt will be right-aligned with the |
|
267 | If True (default), each prompt will be right-aligned with the |
@@ -38,6 +38,7 b' from IPython.core import usage' | |||||
38 | from IPython.core.completer import IPCompleter |
|
38 | from IPython.core.completer import IPCompleter | |
39 | from IPython.core.crashhandler import CrashHandler |
|
39 | from IPython.core.crashhandler import CrashHandler | |
40 | from IPython.core.formatters import PlainTextFormatter |
|
40 | from IPython.core.formatters import PlainTextFormatter | |
|
41 | from IPython.core.prompts import PromptManager | |||
41 | from IPython.core.application import ( |
|
42 | from IPython.core.application import ( | |
42 | ProfileDir, BaseIPythonApplication, base_flags, base_aliases |
|
43 | ProfileDir, BaseIPythonApplication, base_flags, base_aliases | |
43 | ) |
|
44 | ) | |
@@ -133,9 +134,9 b" addflag('term-title', 'TerminalInteractiveShell.term_title'," | |||||
133 | classic_config = Config() |
|
134 | classic_config = Config() | |
134 | classic_config.InteractiveShell.cache_size = 0 |
|
135 | classic_config.InteractiveShell.cache_size = 0 | |
135 | classic_config.PlainTextFormatter.pprint = False |
|
136 | classic_config.PlainTextFormatter.pprint = False | |
136 |
classic_config. |
|
137 | classic_config.PromptManager.in_template = '>>> ' | |
137 |
classic_config. |
|
138 | classic_config.PromptManager.in2_template = '... ' | |
138 |
classic_config. |
|
139 | classic_config.PromptManager.out_template = '' | |
139 | classic_config.InteractiveShell.separate_in = '' |
|
140 | classic_config.InteractiveShell.separate_in = '' | |
140 | classic_config.InteractiveShell.separate_out = '' |
|
141 | classic_config.InteractiveShell.separate_out = '' | |
141 | classic_config.InteractiveShell.separate_out2 = '' |
|
142 | classic_config.InteractiveShell.separate_out2 = '' | |
@@ -197,6 +198,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):' | |||||
197 | InteractiveShellApp, # ShellApp comes before TerminalApp, because |
|
198 | InteractiveShellApp, # ShellApp comes before TerminalApp, because | |
198 | self.__class__, # it will also affect subclasses (e.g. QtConsole) |
|
199 | self.__class__, # it will also affect subclasses (e.g. QtConsole) | |
199 | TerminalInteractiveShell, |
|
200 | TerminalInteractiveShell, | |
|
201 | PromptManager, | |||
200 | ProfileDir, |
|
202 | ProfileDir, | |
201 | PlainTextFormatter, |
|
203 | PlainTextFormatter, | |
202 | IPCompleter, |
|
204 | IPCompleter, |
@@ -202,9 +202,9 b' def ipexec(fname, options=None):' | |||||
202 |
|
202 | |||
203 | # For these subprocess calls, eliminate all prompt printing so we only see |
|
203 | # For these subprocess calls, eliminate all prompt printing so we only see | |
204 | # output from script execution |
|
204 | # output from script execution | |
205 |
prompt_opts = [ '-- |
|
205 | prompt_opts = [ '--PromptManager.in_template=""', | |
206 |
'-- |
|
206 | '--PromptManager.in2_template=""', | |
207 |
'-- |
|
207 | '--PromptManager.out_template=""' | |
208 | ] |
|
208 | ] | |
209 | cmdargs = ' '.join(default_argv() + prompt_opts + options) |
|
209 | cmdargs = ' '.join(default_argv() + prompt_opts + options) | |
210 |
|
210 |
@@ -23,10 +23,10 b' try:' | |||||
23 | except NameError: |
|
23 | except NameError: | |
24 | nested = 0 |
|
24 | nested = 0 | |
25 | cfg = Config() |
|
25 | cfg = Config() | |
26 | shell_config = cfg.InteractiveShellEmbed |
|
26 | prompt_config = cfg.PromptManager | |
27 |
|
|
27 | prompt_config.in_template = 'In <\\#>: ' | |
28 |
|
|
28 | prompt_config.in2_template = ' .\\D.: ' | |
29 |
|
|
29 | prompt_config.out_template = 'Out<\\#>: ' | |
30 | else: |
|
30 | else: | |
31 | print "Running nested copies of IPython." |
|
31 | print "Running nested copies of IPython." | |
32 | print "The prompts for the nested copy have been modified" |
|
32 | print "The prompts for the nested copy have been modified" | |
@@ -46,12 +46,12 b' ipshell = InteractiveShellEmbed(config=cfg,' | |||||
46 |
|
46 | |||
47 | # Make a second instance, you can have as many as you want. |
|
47 | # Make a second instance, you can have as many as you want. | |
48 | cfg2 = cfg.copy() |
|
48 | cfg2 = cfg.copy() | |
49 | shell_config = cfg2.InteractiveShellEmbed |
|
49 | prompt_config = cfg2.PromptManager | |
50 |
|
|
50 | prompt_config.in_template = 'In2<\\#>: ' | |
51 | if not nested: |
|
51 | if not nested: | |
52 |
|
|
52 | prompt_config.in_template = 'In2<\\#>: ' | |
53 |
|
|
53 | prompt_config.in2_template = ' .\\D.: ' | |
54 |
|
|
54 | prompt_config.out_template = 'Out<\\#>: ' | |
55 | ipshell2 = InteractiveShellEmbed(config=cfg, |
|
55 | ipshell2 = InteractiveShellEmbed(config=cfg, | |
56 | banner1 = 'Second IPython instance.') |
|
56 | banner1 = 'Second IPython instance.') | |
57 |
|
57 |
@@ -227,7 +227,7 b' All options with a [no] prepended can be specified in negated form' | |||||
227 | circular file inclusions, IPython will stop if it reaches 15 |
|
227 | circular file inclusions, IPython will stop if it reaches 15 | |
228 | recursive inclusions. |
|
228 | recursive inclusions. | |
229 |
|
229 | |||
230 | ``InteractiveShell.prompt_in1=<string>`` |
|
230 | ``PromptManager.in_template=<string>`` | |
231 |
|
231 | |||
232 | Specify the string used for input prompts. Note that if you are using |
|
232 | Specify the string used for input prompts. Note that if you are using | |
233 | numbered prompts, the number is represented with a '\#' in the |
|
233 | numbered prompts, the number is represented with a '\#' in the | |
@@ -236,7 +236,7 b' All options with a [no] prepended can be specified in negated form' | |||||
236 | discusses in detail all the available escapes to customize your |
|
236 | discusses in detail all the available escapes to customize your | |
237 | prompts. |
|
237 | prompts. | |
238 |
|
238 | |||
239 | ``InteractiveShell.prompt_in2=<string>`` |
|
239 | ``PromptManager.in2_template=<string>`` | |
240 | Similar to the previous option, but used for the continuation |
|
240 | Similar to the previous option, but used for the continuation | |
241 | prompts. The special sequence '\D' is similar to '\#', but |
|
241 | prompts. The special sequence '\D' is similar to '\#', but | |
242 | with all digits replaced dots (so you can have your |
|
242 | with all digits replaced dots (so you can have your | |
@@ -244,9 +244,9 b' All options with a [no] prepended can be specified in negated form' | |||||
244 | ' .\D.:' (note three spaces at the start for alignment with |
|
244 | ' .\D.:' (note three spaces at the start for alignment with | |
245 | 'In [\#]'). |
|
245 | 'In [\#]'). | |
246 |
|
246 | |||
247 | ``InteractiveShell.prompt_out=<string>`` |
|
247 | ``PromptManager.out_template=<string>`` | |
248 | String used for output prompts, also uses numbers like |
|
248 | String used for output prompts, also uses numbers like | |
249 |
|
|
249 | in_template. Default: 'Out[\#]:' | |
250 |
|
250 | |||
251 | ``--quick`` |
|
251 | ``--quick`` | |
252 | start in bare bones mode (no config file loaded). |
|
252 | start in bare bones mode (no config file loaded). |
@@ -155,8 +155,8 b' Prompt customization' | |||||
155 |
|
155 | |||
156 | The sh profile uses the following prompt configurations:: |
|
156 | The sh profile uses the following prompt configurations:: | |
157 |
|
157 | |||
158 |
o. |
|
158 | o.PromptManager.in_template= r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Green|\#>' | |
159 |
o. |
|
159 | o.PromptManager.in2_template= r'\C_Green|\C_LightGreen\D\C_Green>' | |
160 |
|
160 | |||
161 | You can change the prompt configuration to your liking by editing |
|
161 | You can change the prompt configuration to your liking by editing | |
162 | ipython_config.py. |
|
162 | ipython_config.py. |
General Comments 0
You need to be logged in to leave comments.
Login now