Make sure containers transmit the children; take care of case where children is possibly empty.

pull/37/head
Jason Grout 12 years ago committed by Jonathan Frederic
parent 7810c78aea
commit 07ffef8392

@ -219,7 +219,7 @@ class BaseWidget(LoggingConfigurable):
# up encoding
if isinstance(value, BaseWidget):
value = value.comm.comm_id
elif isinstance(value, list) and isinstance(value[0], BaseWidget):
elif isinstance(value, list) and len(value)>0 and isinstance(value[0], BaseWidget):
# assume all elements of the list are widgets
value = [i.comm.comm_id for i in value]
state[k] = value

@ -23,13 +23,14 @@ class ContainerWidget(Widget):
target_name = Unicode('ContainerWidgetModel')
default_view_name = Unicode('ContainerView')
children = [] #List(Instance('IPython.html.widgets.widget.Widget'))
# Keys, all private and managed by helper methods. Flexible box model
# classes...
_keys = ['_vbox', '_hbox', '_align_start', '_align_end', '_align_center',
'_pack_start', '_pack_end', '_pack_center', '_flex0', '_flex1',
'_flex2', 'description', 'button_text']
'_flex2', 'description', 'button_text',
'children']
children = List(Instance(Widget))
description = Unicode()
button_text = Unicode()
_hbox = Bool(False)

@ -25,11 +25,11 @@ class MulticontainerWidget(Widget):
default_view_name = Unicode('TabView')
# Keys
_keys = ['_titles', 'selected_index']
_keys = ['_titles', 'selected_index', 'children']
_titles = Dict(help="Titles of the pages")
selected_index = Int(0)
children = [] #List(Instance('IPython.html.widgets.widget.Widget'))
children = List(Instance(Widget))
# Public methods
def set_title(self, index, title):

Loading…
Cancel
Save