##// END OF EJS Templates
add manager and client as trait lets of ZMQInteractiveShell...
MinRK -
Show More
@@ -421,11 +421,11 b' class InteractiveShell(SingletonConfigurable):'
421
421
422 def __init__(self, config=None, ipython_dir=None, profile_dir=None,
422 def __init__(self, config=None, ipython_dir=None, profile_dir=None,
423 user_module=None, user_ns=None,
423 user_module=None, user_ns=None,
424 custom_exceptions=((), None)):
424 custom_exceptions=((), None), **kwargs):
425
425
426 # This is where traits with a config_key argument are updated
426 # This is where traits with a config_key argument are updated
427 # from the values on config.
427 # from the values on config.
428 super(InteractiveShell, self).__init__(config=config)
428 super(InteractiveShell, self).__init__(config=config, **kwargs)
429 self.configurables = [self]
429 self.configurables = [self]
430
430
431 # These are relatively independent and stateless
431 # These are relatively independent and stateless
@@ -115,8 +115,8 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):'
115 self.shell = ZMQTerminalInteractiveShell.instance(config=self.config,
115 self.shell = ZMQTerminalInteractiveShell.instance(config=self.config,
116 display_banner=False, profile_dir=self.profile_dir,
116 display_banner=False, profile_dir=self.profile_dir,
117 ipython_dir=self.ipython_dir,
117 ipython_dir=self.ipython_dir,
118 kernel_manager=self.kernel_manager,
118 manager=self.kernel_manager,
119 kernel_client=self.kernel_client,
119 client=self.kernel_client,
120 )
120 )
121
121
122 def init_gui_pylab(self):
122 def init_gui_pylab(self):
@@ -125,7 +125,7 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):'
125
125
126 def handle_sigint(self, *args):
126 def handle_sigint(self, *args):
127 if self.shell._executing:
127 if self.shell._executing:
128 if self.kernel_manager.has_kernel:
128 if self.kernel_manager:
129 # interrupt already gets passed to subprocess by signal handler.
129 # interrupt already gets passed to subprocess by signal handler.
130 # Only if we prevent that should we need to explicitly call
130 # Only if we prevent that should we need to explicitly call
131 # interrupt_kernel, until which time, this would result in a
131 # interrupt_kernel, until which time, this would result in a
@@ -1,12 +1,9 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Frontend of ipython working with python-zmq
2 """terminal client to the IPython kernel
3
3
4 Ipython's frontend, is a ipython interface that send request to kernel and proccess the kernel's outputs.
5
6 For more details, see the ipython-zmq design
7 """
4 """
8 #-----------------------------------------------------------------------------
5 #-----------------------------------------------------------------------------
9 # Copyright (C) 2011 The IPython Development Team
6 # Copyright (C) 2013 The IPython Development Team
10 #
7 #
11 # Distributed under the terms of the BSD License. The full license is in
8 # Distributed under the terms of the BSD License. The full license is in
12 # the file COPYING, distributed as part of this software.
9 # the file COPYING, distributed as part of this software.
@@ -37,7 +34,7 b' from IPython.core.alias import AliasManager, AliasError'
37 from IPython.core import page
34 from IPython.core import page
38 from IPython.utils.warn import warn, error, fatal
35 from IPython.utils.warn import warn, error, fatal
39 from IPython.utils import io
36 from IPython.utils import io
40 from IPython.utils.traitlets import List, Enum, Any
37 from IPython.utils.traitlets import List, Enum, Any, Instance, Unicode
41 from IPython.utils.tempdir import NamedFileInTemporaryDirectory
38 from IPython.utils.tempdir import NamedFileInTemporaryDirectory
42
39
43 from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
40 from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
@@ -105,12 +102,12 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):'
105 """
102 """
106 )
103 )
107
104
108 def __init__(self, *args, **kwargs):
105 manager = Instance('IPython.kernel.KernelManager')
109 self.manager = kwargs.pop('kernel_manager', None)
106 client = Instance('IPython.kernel.KernelClient')
110 self.client = kwargs.pop('kernel_client')
107 def _client_changed(self, name, old, new):
111 self.session_id = self.client.session.session
108 self.session_id = new.session.session
112 super(ZMQTerminalInteractiveShell, self).__init__(*args, **kwargs)
109 session_id = Unicode()
113
110
114 def init_completer(self):
111 def init_completer(self):
115 """Initialize the completion machinery.
112 """Initialize the completion machinery.
116
113
@@ -368,11 +368,13 b' class TerminalInteractiveShell(InteractiveShell):'
368
368
369 def __init__(self, config=None, ipython_dir=None, profile_dir=None,
369 def __init__(self, config=None, ipython_dir=None, profile_dir=None,
370 user_ns=None, user_module=None, custom_exceptions=((),None),
370 user_ns=None, user_module=None, custom_exceptions=((),None),
371 usage=None, banner1=None, banner2=None, display_banner=None):
371 usage=None, banner1=None, banner2=None, display_banner=None,
372 **kwargs):
372
373
373 super(TerminalInteractiveShell, self).__init__(
374 super(TerminalInteractiveShell, self).__init__(
374 config=config, ipython_dir=ipython_dir, profile_dir=profile_dir, user_ns=user_ns,
375 config=config, ipython_dir=ipython_dir, profile_dir=profile_dir, user_ns=user_ns,
375 user_module=user_module, custom_exceptions=custom_exceptions
376 user_module=user_module, custom_exceptions=custom_exceptions,
377 **kwargs
376 )
378 )
377 # use os.system instead of utils.process.system by default,
379 # use os.system instead of utils.process.system by default,
378 # because piped system doesn't make sense in the Terminal:
380 # because piped system doesn't make sense in the Terminal:
General Comments 0
You need to be logged in to leave comments. Login now