forked from M-Labs/artiq
1
0
Fork 0

applets.simple: add append_to_dataset feature

This commit is contained in:
Florian Agbuya 2023-06-02 18:15:59 +08:00 committed by Sébastien Bourdeauducq
parent c298ec4c2e
commit 150d325fc1
1 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,10 @@ class AppletControlIPC:
def set_dataset(self, key, value, persist=None):
self.ipc.set_dataset(key, value, persist)
def append_to_dataset(self, key, value):
mod = {"action": "append", "path": [key, 1], "x": value}
self.ipc.update_dataset(mod)
class AppletControlRPC:
def __init__(self, loop, dataset_ctl):
@ -37,6 +41,10 @@ class AppletControlRPC:
def set_dataset(self, key, value, persist=None):
self._background(self.dataset_ctl.set, key, value, persist)
def append_to_dataset(self, key, value):
mod = {"action": "append", "path": [key, 1], "x": value}
self._background(self.dataset_ctl.update, mod)
class AppletIPCClient(AsyncioChildComm):
def set_close_cb(self, close_cb):
@ -102,6 +110,10 @@ class AppletIPCClient(AsyncioChildComm):
"value": value,
"persist": persist})
def update_dataset(self, mod):
self.write_pyon({"action": "update_dataset",
"mod": mod})
class SimpleApplet:
def __init__(self, main_widget_class, cmd_description=None,