##// END OF EJS Templates
Merge pull request #7120 from Carreau/fix-widget-load...
Thomas Kluyver -
r19339:ea03b8bb merge
parent child Browse files
Show More
@@ -39,7 +39,9 b' casper.notebook_test(function () {'
39 39 this.wait_for_output(button_index, 1);
40 40
41 41 this.then(function () {
42 this.test.assertEquals(this.get_output_cell(button_index, 1).data['text/plain'], "'Clicked'",
42 this.test.assertEquals(this.get_output_cell(button_index, 1).text, "WARNING: The widget API is still considered experimental and \n may change by the next major release of IPython.\n",
43 'Importing widgets show a warning');
44 this.test.assertEquals(this.get_output_cell(button_index, 2).data['text/plain'], "'Clicked'",
43 45 'Button click event fires.');
44 46 });
45 }); No newline at end of file
47 });
@@ -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