From 878c641fe857558cab0657cb09a0246ac33ea83f 2013-04-24 04:47:50 From: MinRK Date: 2013-04-24 04:47:50 Subject: [PATCH] fix in process qt and in process examples --- diff --git a/IPython/frontend/qt/inprocess.py b/IPython/frontend/qt/inprocess.py index 26e25a9..8de6051 100644 --- a/IPython/frontend/qt/inprocess.py +++ b/IPython/frontend/qt/inprocess.py @@ -4,12 +4,15 @@ # Local imports. from IPython.kernel.inprocess import ( InProcessShellChannel, InProcessIOPubChannel, InProcessStdInChannel, - InProcessHBChannel, InProcessKernelClient + InProcessHBChannel, InProcessKernelClient, InProcessKernelManager, ) from IPython.utils.traitlets import Type -from kernel_mixins import QtShellChannelMixin, QtIOPubChannelMixin, \ - QtStdInChannelMixin, QtHBChannelMixin, QtKernelClientMixin +from .kernel_mixins import ( + QtShellChannelMixin, QtIOPubChannelMixin, + QtStdInChannelMixin, QtHBChannelMixin, QtKernelClientMixin, + QtKernelManagerMixin, +) class QtInProcessShellChannel(QtShellChannelMixin, InProcessShellChannel): @@ -32,3 +35,6 @@ class QtInProcessKernelClient(QtKernelClientMixin, InProcessKernelClient): shell_channel_class = Type(QtInProcessShellChannel) stdin_channel_class = Type(QtInProcessStdInChannel) hb_channel_class = Type(QtInProcessHBChannel) + +class QtInProcessKernelManager(QtKernelManagerMixin, InProcessKernelManager): + client_class = __module__ + '.QtInProcessKernelClient' diff --git a/examples/inprocess/embedded_qtconsole.py b/examples/inprocess/embedded_qtconsole.py index 9bd2f92..f453b2d 100644 --- a/examples/inprocess/embedded_qtconsole.py +++ b/examples/inprocess/embedded_qtconsole.py @@ -1,8 +1,7 @@ import os from IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget -from IPython.frontend.qt.inprocess import QtInProcessKernelClient -from IPython.kernel.inprocess import InProcessKernelManager +from IPython.frontend.qt.inprocess import QtInProcessKernelManager from IPython.lib import guisupport @@ -19,13 +18,13 @@ def main(): # Create an in-process kernel # >>> print_process_id() # will print the same process ID as the main process - kernel_manager = InProcessKernelManager() + kernel_manager = QtInProcessKernelManager() kernel_manager.start_kernel() kernel = kernel_manager.kernel kernel.gui = 'qt4' kernel.shell.push({'foo': 43, 'print_process_id': print_process_id}) - kernel_client = QtInProcessKernelClient(kernel=kernel) + kernel_client = kernel_manager.client() kernel_client.start_channels() def stop(): diff --git a/examples/inprocess/embedded_terminal.py b/examples/inprocess/embedded_terminal.py index cda7625..469f2e1 100644 --- a/examples/inprocess/embedded_terminal.py +++ b/examples/inprocess/embedded_terminal.py @@ -22,7 +22,7 @@ def main(): client = kernel_manager.client() client.start_channels() - shell = ZMQTerminalInteractiveShell(kernel_manager=kernel_manager, kernel_client=client) + shell = ZMQTerminalInteractiveShell(manager=kernel_manager, client=client) shell.mainloop()