Show More
@@ -308,7 +308,7 b' class Widget(LoggingConfigurable):' | |||
|
308 | 308 | their model ids. Return value must be JSON-able.""" |
|
309 | 309 | if isinstance(x, dict): |
|
310 | 310 | return {k: self._pack_widgets(v) for k, v in x.items()} |
|
311 | elif isinstance(x, list): | |
|
311 | elif isinstance(x, (list, tuple)): | |
|
312 | 312 | return [self._pack_widgets(v) for v in x] |
|
313 | 313 | elif isinstance(x, Widget): |
|
314 | 314 | return x.model_id |
@@ -322,7 +322,7 b' class Widget(LoggingConfigurable):' | |||
|
322 | 322 | their model ids.""" |
|
323 | 323 | if isinstance(x, dict): |
|
324 | 324 | return {k: self._unpack_widgets(v) for k, v in x.items()} |
|
325 | elif isinstance(x, list): | |
|
325 | elif isinstance(x, (list, tuple)): | |
|
326 | 326 | return [self._unpack_widgets(v) for v in x] |
|
327 | 327 | elif isinstance(x, string_types): |
|
328 | 328 | return x if x not in Widget.widgets else Widget.widgets[x] |
@@ -412,7 +412,7 b' class DOMWidget(Widget):' | |||
|
412 | 412 | be added to. |
|
413 | 413 | """ |
|
414 | 414 | class_list = class_names |
|
415 | if isinstance(class_list, list): | |
|
415 | if isinstance(class_list, (list, tuple)): | |
|
416 | 416 | class_list = ' '.join(class_list) |
|
417 | 417 | |
|
418 | 418 | self.send({ |
@@ -433,7 +433,7 b' class DOMWidget(Widget):' | |||
|
433 | 433 | be removed from. |
|
434 | 434 | """ |
|
435 | 435 | class_list = class_names |
|
436 | if isinstance(class_list, list): | |
|
436 | if isinstance(class_list, (list, tuple)): | |
|
437 | 437 | class_list = ' '.join(class_list) |
|
438 | 438 | |
|
439 | 439 | self.send({ |
@@ -14,7 +14,7 b' Represents a boolean using a widget.' | |||
|
14 | 14 | # Imports |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | from .widget import DOMWidget |
|
17 |
from IPython.utils.traitlets import Unicode, Bool |
|
|
17 | from IPython.utils.traitlets import Unicode, Bool | |
|
18 | 18 | |
|
19 | 19 | #----------------------------------------------------------------------------- |
|
20 | 20 | # Classes |
@@ -14,7 +14,7 b' Represents a container that can be used to group other widgets.' | |||
|
14 | 14 | # Imports |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | from .widget import DOMWidget |
|
17 |
from IPython.utils.traitlets import Unicode, |
|
|
17 | from IPython.utils.traitlets import Unicode, CTuple, Instance | |
|
18 | 18 | |
|
19 | 19 | #----------------------------------------------------------------------------- |
|
20 | 20 | # Classes |
@@ -24,8 +24,8 b' class ContainerWidget(DOMWidget):' | |||
|
24 | 24 | |
|
25 | 25 | # Keys, all private and managed by helper methods. Flexible box model |
|
26 | 26 | # classes... |
|
27 |
children = |
|
|
28 |
_children = |
|
|
27 | children = CTuple(Instance(DOMWidget)) | |
|
28 | _children = CTuple(Instance(DOMWidget), sync=True) | |
|
29 | 29 | |
|
30 | 30 | def _children_changed(self, name, old, new): |
|
31 | 31 | """Validate children list. |
@@ -14,7 +14,7 b' Represents an unbounded float using a widget.' | |||
|
14 | 14 | # Imports |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | from .widget import DOMWidget |
|
17 |
from IPython.utils.traitlets import Unicode, CFloat, Bool, |
|
|
17 | from IPython.utils.traitlets import Unicode, CFloat, Bool, Enum | |
|
18 | 18 | |
|
19 | 19 | #----------------------------------------------------------------------------- |
|
20 | 20 | # Classes |
@@ -14,7 +14,7 b' Represents an unbounded int using a widget.' | |||
|
14 | 14 | # Imports |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | from .widget import DOMWidget |
|
17 |
from IPython.utils.traitlets import Unicode, CInt, Bool, |
|
|
17 | from IPython.utils.traitlets import Unicode, CInt, Bool, Enum | |
|
18 | 18 | |
|
19 | 19 | #----------------------------------------------------------------------------- |
|
20 | 20 | # Classes |
@@ -15,7 +15,7 b' pages.' | |||
|
15 | 15 | # Imports |
|
16 | 16 | #----------------------------------------------------------------------------- |
|
17 | 17 | from .widget_container import ContainerWidget |
|
18 |
from IPython.utils.traitlets import Unicode, Dict, CInt |
|
|
18 | from IPython.utils.traitlets import Unicode, Dict, CInt | |
|
19 | 19 | |
|
20 | 20 | #----------------------------------------------------------------------------- |
|
21 | 21 | # Classes |
@@ -14,7 +14,7 b' Represents a unicode string using a widget.' | |||
|
14 | 14 | # Imports |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | from .widget import DOMWidget, CallbackDispatcher |
|
17 |
from IPython.utils.traitlets import Unicode, Bool |
|
|
17 | from IPython.utils.traitlets import Unicode, Bool | |
|
18 | 18 | |
|
19 | 19 | #----------------------------------------------------------------------------- |
|
20 | 20 | # Classes |
General Comments 0
You need to be logged in to leave comments.
Login now