diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-17 11:27:31 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-17 11:27:31 -0500 |
commit | a903154c105a2cdb0b03799975427f86263e0450 (patch) | |
tree | b7f97dd5d4c432398644df631685a71c9beff43e /qolab | |
parent | 476248687008977a2af2e102edbd258b5ec2b98c (diff) | |
download | qolab-a903154c105a2cdb0b03799975427f86263e0450.tar.gz qolab-a903154c105a2cdb0b03799975427f86263e0450.zip |
added chart gui
Diffstat (limited to 'qolab')
-rw-r--r-- | qolab/gui/web.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/qolab/gui/web.py b/qolab/gui/web.py index 0b15ff8..612f72a 100644 --- a/qolab/gui/web.py +++ b/qolab/gui/web.py @@ -7,6 +7,7 @@ checkbox_classed = label_div_classes labelnames_classes = 'font-bold' panel_div_classes = 'space-x-4 border' controls_div_classes = 'flex space-x-4 border' +controls_group_classes = 'flex space-x-4' 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" @@ -74,21 +75,23 @@ class QOLTimeLog(jp.Div): dcontrols.set_classes(controls_div_classes) bclear = QOLPushButtonNoUndo(a=dcontrols, text='Clear log', click=self._clear_data) breplot = QOLPushButton(a=dcontrols, text='Replot', click=self._replot) + save_controls = QOLSaveControls(a=dcontrols) self.chart = jp.Matplotlib(a=root) - # f = plt.figure() - # plt.close(f) self.plot() def _clear_data(self, msg): - self.clear_data() + self.clear_log() - def plot(self): - log.clear_data() + def clear_data(self): + log = self.log + if log is not None: + log.clear_data() + self.plot() def _replot(self, msg): self.plot() - def plot(self): + async def plot(self): log = self.log f = plt.figure() if log is None: @@ -104,7 +107,7 @@ class QOLSaveControls(jp.Div): def __init__(self, **kwargs): super().__init__(**kwargs) root = self - root.set_classes(controls_div_classes) + root.set_classes(controls_group_classes) root.save=QOLPushButton(a=root, text='Save', name='Save', click=self._save) root.next_file=QOLPushButton(a=root, text='Next file', name='NextFile', click=self._next_file) @@ -136,7 +139,7 @@ if __name__ == '__main__': def test(self, msg): print(rw.getValue()) QOLPushButtonNoUndo(text='Danger', a=wp, onclick=test) - sc = QOLSaveControls(a=wp) + # sc = QOLSaveControls(a=wp) jp.justpy(gui_test) |