From ad656d1e53b2892138c92f63087c6c3d21632541 Mon Sep 17 00:00:00 2001 From: Steve Fan <19037626d@connect.polyu.hk> Date: Tue, 22 Feb 2022 16:18:27 +0800 Subject: [PATCH] dashboard: add device database reload action in context menu (#1853) --- artiq/dashboard/explorer.py | 8 +++++++- artiq/frontend/artiq_dashboard.py | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/artiq/dashboard/explorer.py b/artiq/dashboard/explorer.py index 481596b24..f9dab39dd 100644 --- a/artiq/dashboard/explorer.py +++ b/artiq/dashboard/explorer.py @@ -159,7 +159,7 @@ class WaitingPanel(LayoutWidget): class ExplorerDock(QtWidgets.QDockWidget): def __init__(self, exp_manager, d_shortcuts, explist_sub, explist_status_sub, - schedule_ctl, experiment_db_ctl): + schedule_ctl, experiment_db_ctl, device_db_ctl): QtWidgets.QDockWidget.__init__(self, "Explorer") self.setObjectName("Explorer") self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | @@ -251,6 +251,12 @@ class ExplorerDock(QtWidgets.QDockWidget): scan_repository_action.triggered.connect(scan_repository) self.el.addAction(scan_repository_action) + scan_ddb_action = QtWidgets.QAction("Scan device database", self.el) + def scan_ddb(): + asyncio.ensure_future(device_db_ctl.scan()) + scan_ddb_action.triggered.connect(scan_ddb) + self.el.addAction(scan_ddb_action) + self.current_directory = "" open_file_action = QtWidgets.QAction("Open file outside repository", self.el) diff --git a/artiq/frontend/artiq_dashboard.py b/artiq/frontend/artiq_dashboard.py index bd9127f9d..b1bfca59d 100755 --- a/artiq/frontend/artiq_dashboard.py +++ b/artiq/frontend/artiq_dashboard.py @@ -109,7 +109,7 @@ def main(): # create connections to master rpc_clients = dict() - for target in "schedule", "experiment_db", "dataset_db": + for target in "schedule", "experiment_db", "dataset_db", "device_db": client = AsyncioClient() loop.run_until_complete(client.connect_rpc( args.server, args.port_control, "master_" + target)) @@ -171,7 +171,8 @@ def main(): sub_clients["explist"], sub_clients["explist_status"], rpc_clients["schedule"], - rpc_clients["experiment_db"]) + rpc_clients["experiment_db"], + rpc_clients["device_db"]) smgr.register(d_explorer) d_datasets = datasets.DatasetsDock(sub_clients["datasets"],