Show More
@@ -49,6 +49,7 b' from IPython.kernel.zmq.kernelapp import (' | |||||
49 | ) |
|
49 | ) | |
50 | from IPython.kernel.zmq.session import Session, default_secure |
|
50 | from IPython.kernel.zmq.session import Session, default_secure | |
51 | from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell |
|
51 | from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell | |
|
52 | from IPython.kernel.connect import ConnectionFileMixin | |||
52 |
|
53 | |||
53 | #----------------------------------------------------------------------------- |
|
54 | #----------------------------------------------------------------------------- | |
54 | # Network Constants |
|
55 | # Network Constants | |
@@ -89,8 +90,8 b' aliases = dict(kernel_aliases)' | |||||
89 |
|
90 | |||
90 | # also scrub aliases from the frontend |
|
91 | # also scrub aliases from the frontend | |
91 | app_aliases = dict( |
|
92 | app_aliases = dict( | |
92 | ip = 'KernelManager.ip', |
|
93 | ip = 'IPythonConsoleApp.ip', | |
93 |
transport = ' |
|
94 | transport = 'IPythonConsoleApp.transport', | |
94 | hb = 'IPythonConsoleApp.hb_port', |
|
95 | hb = 'IPythonConsoleApp.hb_port', | |
95 | shell = 'IPythonConsoleApp.shell_port', |
|
96 | shell = 'IPythonConsoleApp.shell_port', | |
96 | iopub = 'IPythonConsoleApp.iopub_port', |
|
97 | iopub = 'IPythonConsoleApp.iopub_port', | |
@@ -120,7 +121,7 b' except ImportError:' | |||||
120 | else: |
|
121 | else: | |
121 | classes.append(InlineBackend) |
|
122 | classes.append(InlineBackend) | |
122 |
|
123 | |||
123 |
class IPythonConsoleApp(Con |
|
124 | class IPythonConsoleApp(ConnectionFileMixin): | |
124 | name = 'ipython-console-mixin' |
|
125 | name = 'ipython-console-mixin' | |
125 |
|
126 | |||
126 | description = """ |
|
127 | description = """ | |
@@ -254,9 +255,8 b' class IPythonConsoleApp(Configurable):' | |||||
254 | self.log.debug(u"Loading connection file %s", fname) |
|
255 | self.log.debug(u"Loading connection file %s", fname) | |
255 | with open(fname) as f: |
|
256 | with open(fname) as f: | |
256 | cfg = json.load(f) |
|
257 | cfg = json.load(f) | |
257 |
|
258 | self.transport = cfg.get('transport', 'tcp') | ||
258 | self.config.KernelManager.transport = cfg.get('transport', 'tcp') |
|
259 | self.ip = cfg.get('ip', LOCALHOST) | |
259 | self.config.KernelManager.ip = cfg.get('ip', LOCALHOST) |
|
|||
260 |
|
260 | |||
261 | for channel in ('hb', 'shell', 'iopub', 'stdin'): |
|
261 | for channel in ('hb', 'shell', 'iopub', 'stdin'): | |
262 | name = channel + '_port' |
|
262 | name = channel + '_port' | |
@@ -272,11 +272,10 b' class IPythonConsoleApp(Configurable):' | |||||
272 | """set up ssh tunnels, if needed.""" |
|
272 | """set up ssh tunnels, if needed.""" | |
273 | if not self.existing or (not self.sshserver and not self.sshkey): |
|
273 | if not self.existing or (not self.sshserver and not self.sshkey): | |
274 | return |
|
274 | return | |
275 |
|
||||
276 | self.load_connection_file() |
|
275 | self.load_connection_file() | |
277 |
|
276 | |||
278 |
transport = self. |
|
277 | transport = self.transport | |
279 |
ip = self. |
|
278 | ip = self.ip | |
280 |
|
279 | |||
281 | if transport != 'tcp': |
|
280 | if transport != 'tcp': | |
282 | self.log.error("Can only use ssh tunnels with TCP sockets, not %s", transport) |
|
281 | self.log.error("Can only use ssh tunnels with TCP sockets, not %s", transport) | |
@@ -298,7 +297,7 b' class IPythonConsoleApp(Configurable):' | |||||
298 | self.log.info("Forwarding connections to %s via %s"%(ip, self.sshserver)) |
|
297 | self.log.info("Forwarding connections to %s via %s"%(ip, self.sshserver)) | |
299 |
|
298 | |||
300 | # tunnels return a new set of ports, which will be on localhost: |
|
299 | # tunnels return a new set of ports, which will be on localhost: | |
301 |
self |
|
300 | self.ip = LOCALHOST | |
302 | try: |
|
301 | try: | |
303 | newports = tunnel_to_kernel(info, self.sshserver, self.sshkey) |
|
302 | newports = tunnel_to_kernel(info, self.sshserver, self.sshkey) | |
304 | except: |
|
303 | except: | |
@@ -337,6 +336,8 b' class IPythonConsoleApp(Configurable):' | |||||
337 |
|
336 | |||
338 | # Create a KernelManager and start a kernel. |
|
337 | # Create a KernelManager and start a kernel. | |
339 | self.kernel_manager = self.kernel_manager_class( |
|
338 | self.kernel_manager = self.kernel_manager_class( | |
|
339 | ip=self.ip, | |||
|
340 | transport=self.transport, | |||
340 | shell_port=self.shell_port, |
|
341 | shell_port=self.shell_port, | |
341 | iopub_port=self.iopub_port, |
|
342 | iopub_port=self.iopub_port, | |
342 | stdin_port=self.stdin_port, |
|
343 | stdin_port=self.stdin_port, | |
@@ -367,6 +368,8 b' class IPythonConsoleApp(Configurable):' | |||||
367 | self.kernel_client = self.kernel_manager.client() |
|
368 | self.kernel_client = self.kernel_manager.client() | |
368 | else: |
|
369 | else: | |
369 | self.kernel_client = self.kernel_client_class( |
|
370 | self.kernel_client = self.kernel_client_class( | |
|
371 | ip=self.ip, | |||
|
372 | transport=self.transport, | |||
370 | shell_port=self.shell_port, |
|
373 | shell_port=self.shell_port, | |
371 | iopub_port=self.iopub_port, |
|
374 | iopub_port=self.iopub_port, | |
372 | stdin_port=self.stdin_port, |
|
375 | stdin_port=self.stdin_port, |
@@ -249,10 +249,7 b' class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp):' | |||||
249 | self.app.icon = QtGui.QIcon(icon_path) |
|
249 | self.app.icon = QtGui.QIcon(icon_path) | |
250 | QtGui.QApplication.setWindowIcon(self.app.icon) |
|
250 | QtGui.QApplication.setWindowIcon(self.app.icon) | |
251 |
|
251 | |||
252 | try: |
|
252 | ip = self.ip | |
253 | ip = self.config.KernelManager.ip |
|
|||
254 | except AttributeError: |
|
|||
255 | ip = LOCALHOST |
|
|||
256 | local_kernel = (not self.existing) or ip in LOCAL_IPS |
|
253 | local_kernel = (not self.existing) or ip in LOCAL_IPS | |
257 | self.widget = self.widget_factory(config=self.config, |
|
254 | self.widget = self.widget_factory(config=self.config, | |
258 | local_kernel=local_kernel) |
|
255 | local_kernel=local_kernel) |
General Comments 0
You need to be logged in to leave comments.
Login now