Show More
@@ -198,8 +198,6 b' class IPythonMixinConsoleApp(Configurable):' | |||||
198 | # Scrub frontend-specific flags |
|
198 | # Scrub frontend-specific flags | |
199 | swallow_next = False |
|
199 | swallow_next = False | |
200 | was_flag = False |
|
200 | was_flag = False | |
201 | # copy again, in case some aliases have the same name as a flag |
|
|||
202 | # argv = list(self.kernel_argv) |
|
|||
203 | for a in argv: |
|
201 | for a in argv: | |
204 | if swallow_next: |
|
202 | if swallow_next: | |
205 | swallow_next = False |
|
203 | swallow_next = False |
@@ -50,7 +50,7 b' from IPython.zmq.session import Session, default_secure' | |||||
50 | from IPython.zmq.zmqshell import ZMQInteractiveShell |
|
50 | from IPython.zmq.zmqshell import ZMQInteractiveShell | |
51 |
|
51 | |||
52 | from IPython.frontend.kernelmixinapp import ( |
|
52 | from IPython.frontend.kernelmixinapp import ( | |
53 | IPythonMixinConsoleApp, app_aliases, app_flags |
|
53 | IPythonMixinConsoleApp, app_aliases, app_flags, flags, aliases | |
54 | ) |
|
54 | ) | |
55 |
|
55 | |||
56 | #----------------------------------------------------------------------------- |
|
56 | #----------------------------------------------------------------------------- | |
@@ -72,8 +72,8 b' ipython qtconsole --pylab=inline # start with pylab in inline plotting mode' | |||||
72 | # Aliases and Flags |
|
72 | # Aliases and Flags | |
73 | #----------------------------------------------------------------------------- |
|
73 | #----------------------------------------------------------------------------- | |
74 |
|
74 | |||
75 | # XXX: the app_flags should really be flags from the mixin |
|
75 | # start with copy of flags | |
76 |
flags = dict( |
|
76 | flags = dict(flags) | |
77 | qt_flags = { |
|
77 | qt_flags = { | |
78 | 'pure' : ({'IPythonQtConsoleApp' : {'pure' : True}}, |
|
78 | 'pure' : ({'IPythonQtConsoleApp' : {'pure' : True}}, | |
79 | "Use a pure Python kernel instead of an IPython kernel."), |
|
79 | "Use a pure Python kernel instead of an IPython kernel."), | |
@@ -85,10 +85,13 b' qt_flags.update(boolean_flag(' | |||||
85 | "use a GUI widget for tab completion", |
|
85 | "use a GUI widget for tab completion", | |
86 | "use plaintext output for completion" |
|
86 | "use plaintext output for completion" | |
87 | )) |
|
87 | )) | |
|
88 | # and app_flags from the Console Mixin | |||
|
89 | qt_flags.update(app_flags) | |||
|
90 | # add frontend flags to the full set | |||
88 | flags.update(qt_flags) |
|
91 | flags.update(qt_flags) | |
89 |
|
92 | |||
90 | aliases = dict(app_aliases) |
|
93 | # start with copy of front&backend aliases list | |
91 |
|
94 | aliases = dict(aliases) | ||
92 | qt_aliases = dict( |
|
95 | qt_aliases = dict( | |
93 |
|
96 | |||
94 | style = 'IPythonWidget.syntax_style', |
|
97 | style = 'IPythonWidget.syntax_style', | |
@@ -98,8 +101,17 b' qt_aliases = dict(' | |||||
98 | editor = 'IPythonWidget.editor', |
|
101 | editor = 'IPythonWidget.editor', | |
99 | paging = 'ConsoleWidget.paging', |
|
102 | paging = 'ConsoleWidget.paging', | |
100 | ) |
|
103 | ) | |
|
104 | # and app_aliases from the Console Mixin | |||
|
105 | qt_aliases.update(app_aliases) | |||
|
106 | # add frontend aliases to the full set | |||
101 | aliases.update(qt_aliases) |
|
107 | aliases.update(qt_aliases) | |
102 |
|
108 | |||
|
109 | # get flags&aliases into sets, and remove a couple that | |||
|
110 | # shouldn't be scrubbed from backend flags: | |||
|
111 | qt_aliases = set(qt_aliases.keys()) | |||
|
112 | qt_aliases.remove('colors') | |||
|
113 | qt_flags = set(qt_flags.keys()) | |||
|
114 | ||||
103 | #----------------------------------------------------------------------------- |
|
115 | #----------------------------------------------------------------------------- | |
104 | # Classes |
|
116 | # Classes | |
105 | #----------------------------------------------------------------------------- |
|
117 | #----------------------------------------------------------------------------- | |
@@ -157,12 +169,9 b' class IPythonQtConsoleApp(BaseIPythonApplication, IPythonMixinConsoleApp):' | |||||
157 |
|
169 | |||
158 | def parse_command_line(self, argv=None): |
|
170 | def parse_command_line(self, argv=None): | |
159 | super(IPythonQtConsoleApp, self).parse_command_line(argv) |
|
171 | super(IPythonQtConsoleApp, self).parse_command_line(argv) | |
160 | IPythonMixinConsoleApp.parse_command_line(self,argv) |
|
|||
161 | self.swallow_args(qt_aliases,qt_flags,argv=argv) |
|
172 | self.swallow_args(qt_aliases,qt_flags,argv=argv) | |
162 |
|
173 | |||
163 |
|
174 | |||
164 |
|
||||
165 |
|
||||
166 | def new_frontend_master(self): |
|
175 | def new_frontend_master(self): | |
167 | """ Create and return new frontend attached to new kernel, launched on localhost. |
|
176 | """ Create and return new frontend attached to new kernel, launched on localhost. | |
168 | """ |
|
177 | """ |
@@ -115,7 +115,8 b' class IPAppCrashHandler(CrashHandler):' | |||||
115 | #----------------------------------------------------------------------------- |
|
115 | #----------------------------------------------------------------------------- | |
116 | flags = dict(base_flags) |
|
116 | flags = dict(base_flags) | |
117 | flags.update(shell_flags) |
|
117 | flags.update(shell_flags) | |
118 | addflag = lambda *args: flags.update(boolean_flag(*args)) |
|
118 | frontend_flags = {} | |
|
119 | addflag = lambda *args: frontend_flags.update(boolean_flag(*args)) | |||
119 | addflag('autoedit-syntax', 'TerminalInteractiveShell.autoedit_syntax', |
|
120 | addflag('autoedit-syntax', 'TerminalInteractiveShell.autoedit_syntax', | |
120 | 'Turn on auto editing of files with syntax errors.', |
|
121 | 'Turn on auto editing of files with syntax errors.', | |
121 | 'Turn off auto editing of files with syntax errors.' |
|
122 | 'Turn off auto editing of files with syntax errors.' | |
@@ -146,7 +147,7 b" classic_config.InteractiveShell.separate_out2 = ''" | |||||
146 | classic_config.InteractiveShell.colors = 'NoColor' |
|
147 | classic_config.InteractiveShell.colors = 'NoColor' | |
147 | classic_config.InteractiveShell.xmode = 'Plain' |
|
148 | classic_config.InteractiveShell.xmode = 'Plain' | |
148 |
|
149 | |||
149 | flags['classic']=( |
|
150 | frontend_flags['classic']=( | |
150 | classic_config, |
|
151 | classic_config, | |
151 | "Gives IPython a similar feel to the classic Python prompt." |
|
152 | "Gives IPython a similar feel to the classic Python prompt." | |
152 | ) |
|
153 | ) | |
@@ -156,21 +157,22 b" flags['classic']=(" | |||||
156 | # help="Start logging to the default log file (./ipython_log.py).") |
|
157 | # help="Start logging to the default log file (./ipython_log.py).") | |
157 | # |
|
158 | # | |
158 | # # quick is harder to implement |
|
159 | # # quick is harder to implement | |
159 | flags['quick']=( |
|
160 | frontend_flags['quick']=( | |
160 | {'TerminalIPythonApp' : {'quick' : True}}, |
|
161 | {'TerminalIPythonApp' : {'quick' : True}}, | |
161 | "Enable quick startup with no config files." |
|
162 | "Enable quick startup with no config files." | |
162 | ) |
|
163 | ) | |
163 |
|
164 | |||
164 | flags['i'] = ( |
|
165 | frontend_flags['i'] = ( | |
165 | {'TerminalIPythonApp' : {'force_interact' : True}}, |
|
166 | {'TerminalIPythonApp' : {'force_interact' : True}}, | |
166 | """If running code from the command line, become interactive afterwards. |
|
167 | """If running code from the command line, become interactive afterwards. | |
167 | Note: can also be given simply as '-i.'""" |
|
168 | Note: can also be given simply as '-i.'""" | |
168 | ) |
|
169 | ) | |
169 | flags['pylab'] = ( |
|
170 | frontend_flags['pylab'] = ( | |
170 | {'TerminalIPythonApp' : {'pylab' : 'auto'}}, |
|
171 | {'TerminalIPythonApp' : {'pylab' : 'auto'}}, | |
171 | """Pre-load matplotlib and numpy for interactive use with |
|
172 | """Pre-load matplotlib and numpy for interactive use with | |
172 | the default matplotlib backend.""" |
|
173 | the default matplotlib backend.""" | |
173 | ) |
|
174 | ) | |
|
175 | flags.update(frontend_flags) | |||
174 |
|
176 | |||
175 | aliases = dict(base_aliases) |
|
177 | aliases = dict(base_aliases) | |
176 | aliases.update(shell_aliases) |
|
178 | aliases.update(shell_aliases) |
@@ -17,7 +17,7 b' import signal' | |||||
17 | import sys |
|
17 | import sys | |
18 | import time |
|
18 | import time | |
19 |
|
19 | |||
20 | from IPython.frontend.terminal.ipapp import TerminalIPythonApp |
|
20 | from IPython.frontend.terminal.ipapp import TerminalIPythonApp, frontend_flags as term_flags | |
21 |
|
21 | |||
22 | from IPython.utils.traitlets import ( |
|
22 | from IPython.utils.traitlets import ( | |
23 | Dict, List, Unicode, Int, CaselessStrEnum, CBool, Any |
|
23 | Dict, List, Unicode, Int, CaselessStrEnum, CBool, Any | |
@@ -26,7 +26,7 b' from IPython.zmq.ipkernel import IPKernelApp' | |||||
26 | from IPython.zmq.session import Session, default_secure |
|
26 | from IPython.zmq.session import Session, default_secure | |
27 | from IPython.zmq.zmqshell import ZMQInteractiveShell |
|
27 | from IPython.zmq.zmqshell import ZMQInteractiveShell | |
28 | from IPython.frontend.kernelmixinapp import ( |
|
28 | from IPython.frontend.kernelmixinapp import ( | |
29 | IPythonMixinConsoleApp, app_aliases, app_flags |
|
29 | IPythonMixinConsoleApp, app_aliases, app_flags, aliases, app_aliases, flags | |
30 | ) |
|
30 | ) | |
31 |
|
31 | |||
32 | from IPython.frontend.zmqterminal.interactiveshell import ZMQTerminalInteractiveShell |
|
32 | from IPython.frontend.zmqterminal.interactiveshell import ZMQTerminalInteractiveShell | |
@@ -44,18 +44,31 b' ipython console --existing # connect to an existing ipython session' | |||||
44 | # Flags and Aliases |
|
44 | # Flags and Aliases | |
45 | #----------------------------------------------------------------------------- |
|
45 | #----------------------------------------------------------------------------- | |
46 |
|
46 | |||
47 | # XXX: the app_flags should really be flags from the mixin |
|
47 | # copy flags from mixin: | |
48 |
flags = dict( |
|
48 | flags = dict(flags) | |
49 | frontend_flags = { } |
|
49 | # start with mixin frontend flags: | |
|
50 | frontend_flags = dict(app_flags) | |||
|
51 | # add TerminalIPApp flags: | |||
|
52 | frontend_flags.update(term_flags) | |||
|
53 | # pylab is not frontend-specific in two-process IPython | |||
|
54 | frontend_flags.pop('pylab') | |||
|
55 | # disable quick startup, as it won't propagate to the kernel anyway | |||
|
56 | frontend_flags.pop('quick') | |||
|
57 | # update full dict with frontend flags: | |||
50 | flags.update(frontend_flags) |
|
58 | flags.update(frontend_flags) | |
51 |
|
59 | |||
52 | frontend_flags = frontend_flags.keys() |
|
60 | # copy flags from mixin | |
53 |
|
61 | aliases = dict(aliases) | ||
54 | aliases = dict(app_aliases) |
|
62 | # start with mixin frontend flags | |
|
63 | frontend_aliases = dict(app_aliases) | |||
|
64 | # load updated frontend flags into full dict | |||
|
65 | aliases.update(frontend_aliases) | |||
55 |
|
66 | |||
56 | frontend_aliases = dict() |
|
67 | # get flags&aliases into sets, and remove a couple that | |
|
68 | # shouldn't be scrubbed from backend flags: | |||
|
69 | frontend_aliases = set(frontend_aliases.keys()) | |||
|
70 | frontend_flags = set(frontend_flags.keys()) | |||
57 |
|
71 | |||
58 | aliases.update(frontend_aliases) |
|
|||
59 |
|
72 | |||
60 | #----------------------------------------------------------------------------- |
|
73 | #----------------------------------------------------------------------------- | |
61 | # Classes |
|
74 | # Classes | |
@@ -63,7 +76,7 b' aliases.update(frontend_aliases)' | |||||
63 |
|
76 | |||
64 |
|
77 | |||
65 | class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonMixinConsoleApp): |
|
78 | class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonMixinConsoleApp): | |
66 |
name = "ipython |
|
79 | name = "ipython-console" | |
67 | """Start a terminal frontend to the IPython zmq kernel.""" |
|
80 | """Start a terminal frontend to the IPython zmq kernel.""" | |
68 |
|
81 | |||
69 | description = """ |
|
82 | description = """ | |
@@ -83,13 +96,13 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonMixinConsoleApp):' | |||||
83 | """ |
|
96 | """ | |
84 | examples = _examples |
|
97 | examples = _examples | |
85 |
|
98 | |||
86 | classes = List([IPKernelApp, ZMQTerminalInteractiveShell]) |
|
99 | classes = List([IPKernelApp, ZMQTerminalInteractiveShell, Session]) | |
87 | flags = Dict(flags) |
|
100 | flags = Dict(flags) | |
88 | aliases = Dict(aliases) |
|
101 | aliases = Dict(aliases) | |
89 | subcommands = Dict() |
|
102 | subcommands = Dict() | |
|
103 | ||||
90 | def parse_command_line(self, argv=None): |
|
104 | def parse_command_line(self, argv=None): | |
91 | super(ZMQTerminalIPythonApp, self).parse_command_line(argv) |
|
105 | super(ZMQTerminalIPythonApp, self).parse_command_line(argv) | |
92 | IPythonMixinConsoleApp.parse_command_line(self,argv) |
|
|||
93 | self.swallow_args(frontend_aliases,frontend_flags,argv=argv) |
|
106 | self.swallow_args(frontend_aliases,frontend_flags,argv=argv) | |
94 |
|
107 | |||
95 | def init_shell(self): |
|
108 | def init_shell(self): |
General Comments 0
You need to be logged in to leave comments.
Login now