##// END OF EJS Templates
lazy load widgets...
Bussonnier Matthias -
Show More
@@ -5,7 +5,6 b' import sys'
5 5 import traceback
6 6
7 7 from IPython.core import release
8 from IPython.html.widgets import Widget
9 8 from IPython.utils.py3compat import builtin_mod, PY3
10 9 from IPython.utils.tokenutil import token_at_cursor, line_at_cursor
11 10 from IPython.utils.traitlets import Instance, Type, Any
@@ -16,6 +15,12 b' from .kernelbase import Kernel as KernelBase'
16 15 from .serialize import serialize_object, unpack_apply_message
17 16 from .zmqshell import ZMQInteractiveShell
18 17
18
19 def lazy_import_handle_comm_opened(*args, **kwargs):
20 from IPython.html.widgets import Widget
21 Widget.handle_comm_opened(*args, **kwargs)
22
23
19 24 class IPythonKernel(KernelBase):
20 25 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
21 26 shell_class = Type(ZMQInteractiveShell)
@@ -59,7 +64,7 b' class IPythonKernel(KernelBase):'
59 64
60 65 self.comm_manager = CommManager(shell=self.shell, parent=self,
61 66 kernel=self)
62 self.comm_manager.register_target('ipython.widget', Widget.handle_comm_opened)
67 self.comm_manager.register_target('ipython.widget', lazy_import_handle_comm_opened)
63 68
64 69 self.shell.configurables.append(self.comm_manager)
65 70 comm_msg_types = [ 'comm_open', 'comm_msg', 'comm_close' ]
General Comments 0
You need to be logged in to leave comments. Login now