##// END OF EJS Templates
finish plumbing config to Session objects...
MinRK -
Show More
@@ -30,6 +30,7 b' from IPython.zmq.ipkernel import ('
30 aliases as ipkernel_aliases,
30 aliases as ipkernel_aliases,
31 IPKernelApp
31 IPKernelApp
32 )
32 )
33 from IPython.zmq.session import Session
33 from IPython.zmq.zmqshell import ZMQInteractiveShell
34 from IPython.zmq.zmqshell import ZMQInteractiveShell
34
35
35
36
@@ -214,7 +215,7 b' aliases.update(dict('
214 class IPythonQtConsoleApp(BaseIPythonApplication):
215 class IPythonQtConsoleApp(BaseIPythonApplication):
215 name = 'ipython-qtconsole'
216 name = 'ipython-qtconsole'
216 default_config_file_name='ipython_config.py'
217 default_config_file_name='ipython_config.py'
217 classes = [IPKernelApp, IPythonWidget, ZMQInteractiveShell, ProfileDir]
218 classes = [IPKernelApp, IPythonWidget, ZMQInteractiveShell, ProfileDir, Session]
218 flags = Dict(flags)
219 flags = Dict(flags)
219 aliases = Dict(aliases)
220 aliases = Dict(aliases)
220
221
@@ -289,7 +290,8 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
289 shell_address=(self.ip, self.shell_port),
290 shell_address=(self.ip, self.shell_port),
290 sub_address=(self.ip, self.iopub_port),
291 sub_address=(self.ip, self.iopub_port),
291 stdin_address=(self.ip, self.stdin_port),
292 stdin_address=(self.ip, self.stdin_port),
292 hb_address=(self.ip, self.hb_port)
293 hb_address=(self.ip, self.hb_port),
294 config=self.config
293 )
295 )
294 # start the kernel
296 # start the kernel
295 if not self.existing:
297 if not self.existing:
@@ -590,7 +590,7 b' class IPKernelApp(KernelApp, InteractiveShellApp):'
590
590
591 aliases = Dict(aliases)
591 aliases = Dict(aliases)
592 flags = Dict(flags)
592 flags = Dict(flags)
593 classes = [Kernel, ZMQInteractiveShell, ProfileDir]
593 classes = [Kernel, ZMQInteractiveShell, ProfileDir, Session]
594 # configurables
594 # configurables
595 pylab = CaselessStrEnum(['tk', 'qt', 'wx', 'gtk', 'osx', 'inline', 'auto'],
595 pylab = CaselessStrEnum(['tk', 'qt', 'wx', 'gtk', 'osx', 'inline', 'auto'],
596 config=True,
596 config=True,
@@ -73,7 +73,7 b' class KernelApp(BaseIPythonApplication):'
73 name='pykernel'
73 name='pykernel'
74 aliases = Dict(kernel_aliases)
74 aliases = Dict(kernel_aliases)
75 flags = Dict(kernel_flags)
75 flags = Dict(kernel_flags)
76
76 classes = [Session]
77 # the kernel class, as an importstring
77 # the kernel class, as an importstring
78 kernel_class = Unicode('IPython.zmq.pykernel.Kernel')
78 kernel_class = Unicode('IPython.zmq.pykernel.Kernel')
79 kernel = Any()
79 kernel = Any()
@@ -163,7 +163,7 b' class KernelApp(BaseIPythonApplication):'
163
163
164 def init_session(self):
164 def init_session(self):
165 """create our session object"""
165 """create our session object"""
166 self.session = Session(username=u'kernel')
166 self.session = Session(config=self.config, username=u'kernel')
167
167
168 def init_io(self):
168 def init_io(self):
169 """redirects stdout/stderr, and installs a display hook"""
169 """redirects stdout/stderr, and installs a display hook"""
@@ -32,6 +32,7 b' from zmq import POLLIN, POLLOUT, POLLERR'
32 from zmq.eventloop import ioloop
32 from zmq.eventloop import ioloop
33
33
34 # Local imports.
34 # Local imports.
35 from IPython.config.loader import Config
35 from IPython.utils import io
36 from IPython.utils import io
36 from IPython.utils.localinterfaces import LOCALHOST, LOCAL_IPS
37 from IPython.utils.localinterfaces import LOCALHOST, LOCAL_IPS
37 from IPython.utils.traitlets import HasTraits, Any, Instance, Type, TCPAddress
38 from IPython.utils.traitlets import HasTraits, Any, Instance, Type, TCPAddress
@@ -676,11 +677,16 b' class KernelManager(HasTraits):'
676 The REP channel is for the kernel to request stdin (raw_input) from the
677 The REP channel is for the kernel to request stdin (raw_input) from the
677 frontend.
678 frontend.
678 """
679 """
680 # config object for passing to child configurables
681 config = Instance(Config)
682
679 # The PyZMQ Context to use for communication with the kernel.
683 # The PyZMQ Context to use for communication with the kernel.
680 context = Instance(zmq.Context,(),{})
684 context = Instance(zmq.Context)
685 def _context_default(self):
686 return zmq.Context.instance()
681
687
682 # The Session to use for communication with the kernel.
688 # The Session to use for communication with the kernel.
683 session = Instance(Session,(),{})
689 session = Instance(Session)
684
690
685 # The kernel process with which the KernelManager is communicating.
691 # The kernel process with which the KernelManager is communicating.
686 kernel = Instance(Popen)
692 kernel = Instance(Popen)
@@ -706,8 +712,10 b' class KernelManager(HasTraits):'
706
712
707 def __init__(self, **kwargs):
713 def __init__(self, **kwargs):
708 super(KernelManager, self).__init__(**kwargs)
714 super(KernelManager, self).__init__(**kwargs)
715 if self.session is None:
716 self.session = Session(config=self.config)
709 # Uncomment this to try closing the context.
717 # Uncomment this to try closing the context.
710 # atexit.register(self.context.close)
718 # atexit.register(self.context.term)
711
719
712 #--------------------------------------------------------------------------
720 #--------------------------------------------------------------------------
713 # Channel management methods:
721 # Channel management methods:
General Comments 0
You need to be logged in to leave comments. Login now