Show More
@@ -4,12 +4,15 b'' | |||
|
4 | 4 | # Local imports. |
|
5 | 5 | from IPython.kernel.inprocess import ( |
|
6 | 6 | InProcessShellChannel, InProcessIOPubChannel, InProcessStdInChannel, |
|
7 | InProcessHBChannel, InProcessKernelClient | |
|
7 | InProcessHBChannel, InProcessKernelClient, InProcessKernelManager, | |
|
8 | 8 | ) |
|
9 | 9 | |
|
10 | 10 | from IPython.utils.traitlets import Type |
|
11 | from kernel_mixins import QtShellChannelMixin, QtIOPubChannelMixin, \ | |
|
12 |
QtS |
|
|
11 | from .kernel_mixins import ( | |
|
12 | QtShellChannelMixin, QtIOPubChannelMixin, | |
|
13 | QtStdInChannelMixin, QtHBChannelMixin, QtKernelClientMixin, | |
|
14 | QtKernelManagerMixin, | |
|
15 | ) | |
|
13 | 16 | |
|
14 | 17 | |
|
15 | 18 | class QtInProcessShellChannel(QtShellChannelMixin, InProcessShellChannel): |
@@ -32,3 +35,6 b' class QtInProcessKernelClient(QtKernelClientMixin, InProcessKernelClient):' | |||
|
32 | 35 | shell_channel_class = Type(QtInProcessShellChannel) |
|
33 | 36 | stdin_channel_class = Type(QtInProcessStdInChannel) |
|
34 | 37 | hb_channel_class = Type(QtInProcessHBChannel) |
|
38 | ||
|
39 | class QtInProcessKernelManager(QtKernelManagerMixin, InProcessKernelManager): | |
|
40 | client_class = __module__ + '.QtInProcessKernelClient' |
@@ -1,8 +1,7 b'' | |||
|
1 | 1 | import os |
|
2 | 2 | |
|
3 | 3 | from IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget |
|
4 |
from IPython.frontend.qt.inprocess import QtInProcessKernel |
|
|
5 | from IPython.kernel.inprocess import InProcessKernelManager | |
|
4 | from IPython.frontend.qt.inprocess import QtInProcessKernelManager | |
|
6 | 5 | from IPython.lib import guisupport |
|
7 | 6 | |
|
8 | 7 | |
@@ -19,13 +18,13 b' def main():' | |||
|
19 | 18 | # Create an in-process kernel |
|
20 | 19 | # >>> print_process_id() |
|
21 | 20 | # will print the same process ID as the main process |
|
22 | kernel_manager = InProcessKernelManager() | |
|
21 | kernel_manager = QtInProcessKernelManager() | |
|
23 | 22 | kernel_manager.start_kernel() |
|
24 | 23 | kernel = kernel_manager.kernel |
|
25 | 24 | kernel.gui = 'qt4' |
|
26 | 25 | kernel.shell.push({'foo': 43, 'print_process_id': print_process_id}) |
|
27 | 26 | |
|
28 |
kernel_client = |
|
|
27 | kernel_client = kernel_manager.client() | |
|
29 | 28 | kernel_client.start_channels() |
|
30 | 29 | |
|
31 | 30 | def stop(): |
@@ -22,7 +22,7 b' def main():' | |||
|
22 | 22 | client = kernel_manager.client() |
|
23 | 23 | client.start_channels() |
|
24 | 24 | |
|
25 |
shell = ZMQTerminalInteractiveShell( |
|
|
25 | shell = ZMQTerminalInteractiveShell(manager=kernel_manager, client=client) | |
|
26 | 26 | shell.mainloop() |
|
27 | 27 | |
|
28 | 28 |
General Comments 0
You need to be logged in to leave comments.
Login now