From a903154c105a2cdb0b03799975427f86263e0450 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Fri, 17 Dec 2021 11:27:31 -0500 Subject: added chart gui --- qolab/gui/web.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'qolab/gui') 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) -- cgit v1.2.3