From 150d325fc19c38b6abb1e90f6c29841561833c3d Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Fri, 2 Jun 2023 18:15:59 +0800 Subject: [PATCH] applets.simple: add append_to_dataset feature --- artiq/applets/simple.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/artiq/applets/simple.py b/artiq/applets/simple.py index c9b512a56..80cab97f6 100644 --- a/artiq/applets/simple.py +++ b/artiq/applets/simple.py @@ -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,