aboutsummaryrefslogtreecommitdiff
path: root/qolab/gui
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-19 00:17:51 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-19 00:17:51 -0500
commit6f0db786def1d1aad6dde896f2bb058e5bb9f3a9 (patch)
treeca9636ae66af7029077b6fd078a87bc89355ceaf /qolab/gui
parentc7922d68fd7feea7b431eb11bd6dd328b4a4f5fb (diff)
downloadpyExpControl-6f0db786def1d1aad6dde896f2bb058e5bb9f3a9.tar.gz
pyExpControl-6f0db786def1d1aad6dde896f2bb058e5bb9f3a9.zip
save control have autosave loop now
Diffstat (limited to 'qolab/gui')
-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()