Show More
@@ -1,34 +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, children = |
|
|
20 | def __init__(self, children = (), **kwargs): | |
|
21 | 21 | kwargs['children'] = children |
|
22 | 22 | super(ContainerWidget, self).__init__(**kwargs) |
|
23 | 23 | self.on_displayed(ContainerWidget._fire_children_displayed) |
|
24 | 24 | |
|
25 | 25 | def _fire_children_displayed(self): |
|
26 | 26 | for child in self.children: |
|
27 | 27 | child._handle_displayed() |
|
28 | 28 | |
|
29 | 29 | |
|
30 | 30 | class PopupWidget(ContainerWidget): |
|
31 | 31 | _view_name = Unicode('PopupView', sync=True) |
|
32 | 32 | |
|
33 | 33 | description = Unicode(sync=True) |
|
34 | 34 | button_text = Unicode(sync=True) |
General Comments 0
You need to be logged in to leave comments.
Login now