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