##// END OF EJS Templates
Merge pull request #6153 from jasongrout/container-children-arg...
Jonathan Frederic -
r17285:d6d4f536 merge
parent child Browse files
Show More
@@ -1,33 +1,34 b''
1 1 """ContainerWidget class.
2 2
3 3 Represents a container that can be used to group other widgets.
4 4 """
5 5
6 6 # Copyright (c) IPython Development Team.
7 7 # Distributed under the terms of the Modified BSD License.
8 8
9 9 from .widget import DOMWidget
10 10 from IPython.utils.traitlets import Unicode, Tuple, TraitError
11 11
12 12 class ContainerWidget(DOMWidget):
13 13 _view_name = Unicode('ContainerView', sync=True)
14 14
15 15 # Child widgets in the container.
16 16 # Using a tuple here to force reassignment to update the list.
17 17 # When a proper notifying-list trait exists, that is what should be used here.
18 children = Tuple(sync=True)
18 children = Tuple(sync=True, allow_none=False)
19 19
20 def __init__(self, **kwargs):
20 def __init__(self, children = (), **kwargs):
21 kwargs['children'] = children
21 22 super(ContainerWidget, self).__init__(**kwargs)
22 23 self.on_displayed(ContainerWidget._fire_children_displayed)
23 24
24 25 def _fire_children_displayed(self):
25 26 for child in self.children:
26 27 child._handle_displayed()
27 28
28 29
29 30 class PopupWidget(ContainerWidget):
30 31 _view_name = Unicode('PopupView', sync=True)
31 32
32 33 description = Unicode(sync=True)
33 34 button_text = Unicode(sync=True)
General Comments 0
You need to be logged in to leave comments. Login now