diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py index 4c576b3..6db6715 100644 --- a/IPython/html/widgets/widget.py +++ b/IPython/html/widgets/widget.py @@ -308,7 +308,7 @@ class Widget(LoggingConfigurable): their model ids. Return value must be JSON-able.""" if isinstance(x, dict): return {k: self._pack_widgets(v) for k, v in x.items()} - elif isinstance(x, list): + elif isinstance(x, (list, tuple)): return [self._pack_widgets(v) for v in x] elif isinstance(x, Widget): return x.model_id @@ -322,7 +322,7 @@ class Widget(LoggingConfigurable): their model ids.""" if isinstance(x, dict): return {k: self._unpack_widgets(v) for k, v in x.items()} - elif isinstance(x, list): + elif isinstance(x, (list, tuple)): return [self._unpack_widgets(v) for v in x] elif isinstance(x, string_types): return x if x not in Widget.widgets else Widget.widgets[x] @@ -412,7 +412,7 @@ class DOMWidget(Widget): be added to. """ class_list = class_names - if isinstance(class_list, list): + if isinstance(class_list, (list, tuple)): class_list = ' '.join(class_list) self.send({ @@ -433,7 +433,7 @@ class DOMWidget(Widget): be removed from. """ class_list = class_names - if isinstance(class_list, list): + if isinstance(class_list, (list, tuple)): class_list = ' '.join(class_list) self.send({ diff --git a/IPython/html/widgets/widget_bool.py b/IPython/html/widgets/widget_bool.py index cce6b98..211ba31 100644 --- a/IPython/html/widgets/widget_bool.py +++ b/IPython/html/widgets/widget_bool.py @@ -14,7 +14,7 @@ Represents a boolean using a widget. # Imports #----------------------------------------------------------------------------- from .widget import DOMWidget -from IPython.utils.traitlets import Unicode, Bool, List +from IPython.utils.traitlets import Unicode, Bool #----------------------------------------------------------------------------- # Classes diff --git a/IPython/html/widgets/widget_container.py b/IPython/html/widgets/widget_container.py index ddfccd5..c254f66 100644 --- a/IPython/html/widgets/widget_container.py +++ b/IPython/html/widgets/widget_container.py @@ -14,7 +14,7 @@ Represents a container that can be used to group other widgets. # Imports #----------------------------------------------------------------------------- from .widget import DOMWidget -from IPython.utils.traitlets import Unicode, Bool, List, Instance +from IPython.utils.traitlets import Unicode, CTuple, Instance #----------------------------------------------------------------------------- # Classes @@ -24,8 +24,8 @@ class ContainerWidget(DOMWidget): # Keys, all private and managed by helper methods. Flexible box model # classes... - children = List(Instance(DOMWidget)) - _children = List(Instance(DOMWidget), sync=True) + children = CTuple(Instance(DOMWidget)) + _children = CTuple(Instance(DOMWidget), sync=True) def _children_changed(self, name, old, new): """Validate children list. diff --git a/IPython/html/widgets/widget_float.py b/IPython/html/widgets/widget_float.py index ec1868e..cad915e 100644 --- a/IPython/html/widgets/widget_float.py +++ b/IPython/html/widgets/widget_float.py @@ -14,7 +14,7 @@ Represents an unbounded float using a widget. # Imports #----------------------------------------------------------------------------- from .widget import DOMWidget -from IPython.utils.traitlets import Unicode, CFloat, Bool, List, Enum +from IPython.utils.traitlets import Unicode, CFloat, Bool, Enum #----------------------------------------------------------------------------- # Classes diff --git a/IPython/html/widgets/widget_int.py b/IPython/html/widgets/widget_int.py index 5a706bf..4c9aa2c 100644 --- a/IPython/html/widgets/widget_int.py +++ b/IPython/html/widgets/widget_int.py @@ -14,7 +14,7 @@ Represents an unbounded int using a widget. # Imports #----------------------------------------------------------------------------- from .widget import DOMWidget -from IPython.utils.traitlets import Unicode, CInt, Bool, List, Enum +from IPython.utils.traitlets import Unicode, CInt, Bool, Enum #----------------------------------------------------------------------------- # Classes diff --git a/IPython/html/widgets/widget_selectioncontainer.py b/IPython/html/widgets/widget_selectioncontainer.py index 0f9156a..ef91559 100644 --- a/IPython/html/widgets/widget_selectioncontainer.py +++ b/IPython/html/widgets/widget_selectioncontainer.py @@ -15,7 +15,7 @@ pages. # Imports #----------------------------------------------------------------------------- from .widget_container import ContainerWidget -from IPython.utils.traitlets import Unicode, Dict, CInt, List, Instance +from IPython.utils.traitlets import Unicode, Dict, CInt #----------------------------------------------------------------------------- # Classes diff --git a/IPython/html/widgets/widget_string.py b/IPython/html/widgets/widget_string.py index e363336..e3505c5 100644 --- a/IPython/html/widgets/widget_string.py +++ b/IPython/html/widgets/widget_string.py @@ -14,7 +14,7 @@ Represents a unicode string using a widget. # Imports #----------------------------------------------------------------------------- from .widget import DOMWidget, CallbackDispatcher -from IPython.utils.traitlets import Unicode, Bool, List +from IPython.utils.traitlets import Unicode, Bool #----------------------------------------------------------------------------- # Classes