2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-26 03:38:25 +08:00

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

View File

@ -22,6 +22,10 @@ class AppletControlIPC:
def set_dataset(self, key, value, persist=None): def set_dataset(self, key, value, persist=None):
self.ipc.set_dataset(key, value, persist) 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: class AppletControlRPC:
def __init__(self, loop, dataset_ctl): def __init__(self, loop, dataset_ctl):
@ -37,6 +41,10 @@ class AppletControlRPC:
def set_dataset(self, key, value, persist=None): def set_dataset(self, key, value, persist=None):
self._background(self.dataset_ctl.set, key, value, persist) 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): class AppletIPCClient(AsyncioChildComm):
def set_close_cb(self, close_cb): def set_close_cb(self, close_cb):
@ -102,6 +110,10 @@ class AppletIPCClient(AsyncioChildComm):
"value": value, "value": value,
"persist": persist}) "persist": persist})
def update_dataset(self, mod):
self.write_pyon({"action": "update_dataset",
"mod": mod})
class SimpleApplet: class SimpleApplet:
def __init__(self, main_widget_class, cmd_description=None, def __init__(self, main_widget_class, cmd_description=None,