aboutsummaryrefslogtreecommitdiff
path: root/qolab/gui/web.py
diff options
context:
space:
mode:
Diffstat (limited to 'qolab/gui/web.py')
-rw-r--r--qolab/gui/web.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/qolab/gui/web.py b/qolab/gui/web.py
index 88f17f2..6d85c66 100644
--- a/qolab/gui/web.py
+++ b/qolab/gui/web.py
@@ -1,4 +1,5 @@
import justpy as jp
+import asyncio
import matplotlib.pyplot as plt
button_classes = 'bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full'
@@ -69,7 +70,7 @@ class QOLTimeLog(jp.Div):
def __init__(self, **kwargs):
super().__init__(**kwargs)
root = self
- root.log = None; # log must have 'plot' and 'clear_data' methods
+ root.traces = None; # log must have 'plot' and 'clear_data' methods
root.set_classes(panel_div_classes)
dcontrols = jp.Div(a=root)
dcontrols.set_classes(controls_div_classes)
@@ -80,32 +81,32 @@ class QOLTimeLog(jp.Div):
self.plot()
def _clear_data(self, msg):
- self.clear_log()
+ self.clear_data()
def clear_data(self):
- log = self.log
- if log is not None:
- log.clear_data()
+ traces = self.traces
+ if traces is not None:
+ traces.clear_data()
self.plot()
async def _replot(self, msg):
self.plot()
await self.update()
- async def update_loop(self, wait_time=4):
- wait_time=5
+ async def update_loop(self, update_interval=4):
+ update_interval=5
while True:
- print('updating chart')
+ self.plot()
await self.update()
- await asyncio.sleep(wait_time)
+ await asyncio.sleep(update_interval)
def plot(self):
- log = self.log
+ traces = self.traces
f = plt.figure()
- if log is None:
+ if traces is None:
plt.title('Log data is unavailable')
else:
- log.plot()
+ traces.plot()
self.chart.set_figure(f)
plt.close(f)