##// END OF EJS Templates
Moved a few things back to InteractiveShell....
Brian Granger -
Show More
@@ -49,7 +49,7 b' c = get_config()'
49
49
50 # c.TerminalInteractiveShell.autoedit_syntax = False
50 # c.TerminalInteractiveShell.autoedit_syntax = False
51
51
52 # c.TerminalInteractiveShell.autoindent = True
52 # c.InteractiveShell.autoindent = True
53
53
54 # c.InteractiveShell.automagic = False
54 # c.InteractiveShell.automagic = False
55
55
@@ -116,9 +116,9 b' c = get_config()'
116
116
117 # c.TerminalInteractiveShell.screen_length = 0
117 # c.TerminalInteractiveShell.screen_length = 0
118
118
119 # c.TerminalInteractiveShell.separate_in = '\n'
119 # c.InteractiveShell.separate_in = '\n'
120 # c.TerminalInteractiveShell.separate_out = ''
120 # c.InteractiveShell.separate_out = ''
121 # c.TerminalInteractiveShell.separate_out2 = ''
121 # c.InteractiveShell.separate_out2 = ''
122
122
123 # c.InteractiveShell.system_header = "IPython system call: "
123 # c.InteractiveShell.system_header = "IPython system call: "
124
124
@@ -10,9 +10,9 b" c.InteractiveShell.prompt_out = '<\\#> '"
10
10
11 c.InteractiveShell.prompts_pad_left = True
11 c.InteractiveShell.prompts_pad_left = True
12
12
13 c.TerminalInteractiveShell.separate_in = ''
13 c.InteractiveShell.separate_in = ''
14 c.TerminalInteractiveShell.separate_out = ''
14 c.InteractiveShell.separate_out = ''
15 c.TerminalInteractiveShell.separate_out2 = ''
15 c.InteractiveShell.separate_out2 = ''
16
16
17 c.PrefilterManager.multi_line_specials = True
17 c.PrefilterManager.multi_line_specials = True
18
18
@@ -131,6 +131,18 b' def get_default_colors():'
131 return 'Linux'
131 return 'Linux'
132
132
133
133
134 class SeparateStr(Str):
135 """A Str subclass to validate separate_in, separate_out, etc.
136
137 This is a Str based trait that converts '0'->'' and '\\n'->'\n'.
138 """
139
140 def validate(self, obj, value):
141 if value == '0': value = ''
142 value = value.replace('\\n','\n')
143 return super(SeparateStr, self).validate(obj, value)
144
145
134 #-----------------------------------------------------------------------------
146 #-----------------------------------------------------------------------------
135 # Main IPython class
147 # Main IPython class
136 #-----------------------------------------------------------------------------
148 #-----------------------------------------------------------------------------
@@ -140,6 +152,9 b' class InteractiveShell(Configurable, Magic):'
140 """An enhanced, interactive shell for Python."""
152 """An enhanced, interactive shell for Python."""
141
153
142 autocall = Enum((0,1,2), default_value=1, config=True)
154 autocall = Enum((0,1,2), default_value=1, config=True)
155 # TODO: remove all autoindent logic and put into frontends.
156 # We can't do this yet because even runlines uses the autoindent.
157 autoindent = CBool(True, config=True)
143 automagic = CBool(True, config=True)
158 automagic = CBool(True, config=True)
144 cache_size = Int(1000, config=True)
159 cache_size = Int(1000, config=True)
145 color_info = CBool(True, config=True)
160 color_info = CBool(True, config=True)
@@ -187,6 +202,11 b' class InteractiveShell(Configurable, Magic):'
187 '"\C-u": unix-line-discard',
202 '"\C-u": unix-line-discard',
188 ], allow_none=False, config=True)
203 ], allow_none=False, config=True)
189
204
205 # TODO: this part of prompt management should be moved to the frontends.
206 # Use custom TraitTypes that convert '0'->'' and '\\n'->'\n'
207 separate_in = SeparateStr('\n', config=True)
208 separate_out = SeparateStr('', config=True)
209 separate_out2 = SeparateStr('', config=True)
190 system_header = Str('IPython system call: ', config=True)
210 system_header = Str('IPython system call: ', config=True)
191 system_verbose = CBool(False, config=True)
211 system_verbose = CBool(False, config=True)
192 wildcards_case_sensitive = CBool(True, config=True)
212 wildcards_case_sensitive = CBool(True, config=True)
@@ -55,18 +55,6 b' def get_default_editor():'
55 raw_input_original = raw_input
55 raw_input_original = raw_input
56
56
57
57
58 class SeparateStr(Str):
59 """A Str subclass to validate separate_in, separate_out, etc.
60
61 This is a Str based trait that converts '0'->'' and '\\n'->'\n'.
62 """
63
64 def validate(self, obj, value):
65 if value == '0': value = ''
66 value = value.replace('\\n','\n')
67 return super(SeparateStr, self).validate(obj, value)
68
69
70 #-----------------------------------------------------------------------------
58 #-----------------------------------------------------------------------------
71 # Main class
59 # Main class
72 #-----------------------------------------------------------------------------
60 #-----------------------------------------------------------------------------
@@ -75,7 +63,6 b' class SeparateStr(Str):'
75 class TerminalInteractiveShell(InteractiveShell):
63 class TerminalInteractiveShell(InteractiveShell):
76
64
77 autoedit_syntax = CBool(False, config=True)
65 autoedit_syntax = CBool(False, config=True)
78 autoindent = CBool(True, config=True)
79 banner = Str('')
66 banner = Str('')
80 banner1 = Str(default_banner, config=True)
67 banner1 = Str(default_banner, config=True)
81 banner2 = Str('', config=True)
68 banner2 = Str('', config=True)
@@ -93,11 +80,6 b' class TerminalInteractiveShell(InteractiveShell):'
93 pager = Str('less', config=True)
80 pager = Str('less', config=True)
94
81
95 screen_length = Int(0, config=True)
82 screen_length = Int(0, config=True)
96
97 # Use custom TraitTypes that convert '0'->'' and '\\n'->'\n'
98 separate_in = SeparateStr('\n', config=True)
99 separate_out = SeparateStr('', config=True)
100 separate_out2 = SeparateStr('', config=True)
101 term_title = CBool(False, config=True)
83 term_title = CBool(False, config=True)
102
84
103 def __init__(self, config=None, ipython_dir=None, user_ns=None,
85 def __init__(self, config=None, ipython_dir=None, user_ns=None,
@@ -85,10 +85,10 b' class IPAppConfigLoader(BaseAppConfigLoader):'
85 The default is '1'.""",
85 The default is '1'.""",
86 metavar='InteractiveShell.autocall')
86 metavar='InteractiveShell.autocall')
87 paa('--autoindent',
87 paa('--autoindent',
88 action='store_true', dest='TerminalInteractiveShell.autoindent',
88 action='store_true', dest='InteractiveShell.autoindent',
89 help='Turn on autoindenting.')
89 help='Turn on autoindenting.')
90 paa('--no-autoindent',
90 paa('--no-autoindent',
91 action='store_false', dest='TerminalInteractiveShell.autoindent',
91 action='store_false', dest='InteractiveShell.autoindent',
92 help='Turn off autoindenting.')
92 help='Turn off autoindenting.')
93 paa('--automagic',
93 paa('--automagic',
94 action='store_true', dest='InteractiveShell.automagic',
94 action='store_true', dest='InteractiveShell.automagic',
@@ -241,17 +241,17 b' class IPAppConfigLoader(BaseAppConfigLoader):'
241 default.""",
241 default.""",
242 metavar='TerminalInteractiveShell.screen_length')
242 metavar='TerminalInteractiveShell.screen_length')
243 paa('--separate-in','-si',
243 paa('--separate-in','-si',
244 type=str, dest='TerminalInteractiveShell.separate_in',
244 type=str, dest='InteractiveShell.separate_in',
245 help="Separator before input prompts. Default '\\n'.",
245 help="Separator before input prompts. Default '\\n'.",
246 metavar='TerminalInteractiveShell.separate_in')
246 metavar='InteractiveShell.separate_in')
247 paa('--separate-out','-so',
247 paa('--separate-out','-so',
248 type=str, dest='TerminalInteractiveShell.separate_out',
248 type=str, dest='InteractiveShell.separate_out',
249 help="Separator before output prompts. Default 0 (nothing).",
249 help="Separator before output prompts. Default 0 (nothing).",
250 metavar='TerminalInteractiveShell.separate_out')
250 metavar='InteractiveShell.separate_out')
251 paa('--separate-out2','-so2',
251 paa('--separate-out2','-so2',
252 type=str, dest='TerminalInteractiveShell.separate_out2',
252 type=str, dest='InteractiveShell.separate_out2',
253 help="Separator after output prompts. Default 0 (nonight).",
253 help="Separator after output prompts. Default 0 (nonight).",
254 metavar='TerminalInteractiveShell.separate_out2')
254 metavar='InteractiveShell.separate_out2')
255 paa('--no-sep',
255 paa('--no-sep',
256 action='store_true', dest='Global.nosep',
256 action='store_true', dest='Global.nosep',
257 help="Eliminate all spacing between prompts.")
257 help="Eliminate all spacing between prompts.")
@@ -448,17 +448,17 b' class IPythonApp(Application):'
448 config.InteractiveShell.prompt_in1 = '>>> '
448 config.InteractiveShell.prompt_in1 = '>>> '
449 config.InteractiveShell.prompt_in2 = '... '
449 config.InteractiveShell.prompt_in2 = '... '
450 config.InteractiveShell.prompt_out = ''
450 config.InteractiveShell.prompt_out = ''
451 config.TerminalInteractiveShell.separate_in = \
451 config.InteractiveShell.separate_in = \
452 config.TerminalInteractiveShell.separate_out = \
452 config.InteractiveShell.separate_out = \
453 config.TerminalInteractiveShell.separate_out2 = ''
453 config.InteractiveShell.separate_out2 = ''
454 config.InteractiveShell.colors = 'NoColor'
454 config.InteractiveShell.colors = 'NoColor'
455 config.InteractiveShell.xmode = 'Plain'
455 config.InteractiveShell.xmode = 'Plain'
456
456
457 if hasattr(config.Global, 'nosep'):
457 if hasattr(config.Global, 'nosep'):
458 if config.Global.nosep:
458 if config.Global.nosep:
459 config.TerminalInteractiveShell.separate_in = \
459 config.InteractiveShell.separate_in = \
460 config.TerminalInteractiveShell.separate_out = \
460 config.InteractiveShell.separate_out = \
461 config.TerminalInteractiveShell.separate_out2 = ''
461 config.InteractiveShell.separate_out2 = ''
462
462
463 # if there is code of files to run from the cmd line, don't interact
463 # if there is code of files to run from the cmd line, don't interact
464 # unless the -i flag (Global.force_interact) is true.
464 # unless the -i flag (Global.force_interact) is true.
@@ -267,8 +267,8 b' def main():'
267 print >>sys.__stdout__, "REQ Channel on port", req_port
267 print >>sys.__stdout__, "REQ Channel on port", req_port
268
268
269 # Redirect input streams and set a display hook.
269 # Redirect input streams and set a display hook.
270 sys.stdout = OutStream(session, pub_socket, u'stdout')
270 # sys.stdout = OutStream(session, pub_socket, u'stdout')
271 sys.stderr = OutStream(session, pub_socket, u'stderr')
271 # sys.stderr = OutStream(session, pub_socket, u'stderr')
272 sys.displayhook = DisplayHook(session, pub_socket)
272 sys.displayhook = DisplayHook(session, pub_socket)
273
273
274 # Create the kernel.
274 # Create the kernel.
General Comments 0
You need to be logged in to leave comments. Login now