diff options
Diffstat (limited to 'qolab/gui')
-rw-r--r-- | qolab/gui/web.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/qolab/gui/web.py b/qolab/gui/web.py index 7a41332..8bbb9c9 100644 --- a/qolab/gui/web.py +++ b/qolab/gui/web.py @@ -12,7 +12,8 @@ labelnames_classes = 'font-bold' panel_div_classes = 'space-x-4 border' controls_div_classes = 'flex flex-wrap space-x-4 p-1 border' controls_group_classes = 'flex flex-wrap space-x-4 p-1' -dict_group_classes = 'bg-gray-100 flex flex-wrap space-x-0 p-0 px-2 border-2' +dict_classes = 'px-2 border-2' +dict_components_classes = 'flex flex-wrap border-2' input_classes = "m-2 bg-gray-200 border-2 border-gray-200 rounded w-20 text-gray-700 focus:outline-none focus:bg-white focus:border-purple-500" @@ -193,21 +194,27 @@ class QOLDictionary(jp.Div): def __init__(self, container=None, **kwargs): super().__init__(**kwargs) root = self - root.set_classes(dict_group_classes) + root.set_classes(dict_classes) + self.dlabel=jp.Div(a=root, classes='bg-gray-100') + self.dlabel.on('click', self._toggle_show) + root.slabel=jp.Span(text = self.name, a=root.dlabel) + root.slabel.set_classes(labelnames_classes) + self.c=jp.Div(a=root) + root.c.set_classes(dict_components_classes) root.container=container - self.reflect_container() + self.display_container_dictionary() - def reflect_container(self): - root = self - s=jp.Span(text = self.name, a=root) - s.set_classes(labelnames_classes) + async def _toggle_show(self, msg): + self.c.show = not self.c.show + + def display_container_dictionary(self): if self.container is None: return for k,v in self.container.items(): if not isinstance(v, dict): - QOLParamReadOnly(label=k, value=v, a=root) + QOLParamReadOnly(label=k, value=v, a=self.c) else: - QOLDictionary(container=v, name=k, a=root) + QOLDictionary(container=v, name=k, a=self.c) |