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