aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qolab/gui/web.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/qolab/gui/web.py b/qolab/gui/web.py
index e45af3c..ee7dacb 100644
--- a/qolab/gui/web.py
+++ b/qolab/gui/web.py
@@ -143,9 +143,22 @@ class QOLSaveControls(jp.Div):
root.getNextDataFile = None
root.bsave=QOLPushButton(a=root, text='Save', name='Save', click=self._save)
root.bnext_file=QOLPushButton(a=root, text='Next file', name='NextFile', click=self._next_file)
- self.autosave=QOLCheckbox(label='autosave', a=root )
+ self.autosave_flag=QOLCheckbox(label='autosave', a=root )
self.autosave_interval = QOLParamReadOnly(label='AutoSaveInterval', value=10, a=root)
self.file_name=QOLParamReadOnly(label='FileName', a=root)
+ self.start_task()
+
+ def start_task(self):
+ jp.run_task( self.autosave_loop() )
+
+ def stop_tasks(self):
+ pass
+
+ async def autosave_loop(self):
+ while True:
+ if self.autosave_flag.getValue():
+ self.save()
+ await asyncio.sleep(10)
async def _save(self, msg):
self.save()