From 8755439481e3cab2237433a6afe622405aeeb86e Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Thu, 2 May 2024 14:20:36 +0800 Subject: [PATCH] moninj: merge docks --- artiq/dashboard/moninj.py | 21 ++++++--------------- artiq/frontend/artiq_dashboard.py | 7 +++---- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/artiq/dashboard/moninj.py b/artiq/dashboard/moninj.py index ef6171f94..b4beffd44 100644 --- a/artiq/dashboard/moninj.py +++ b/artiq/dashboard/moninj.py @@ -442,12 +442,10 @@ class _DeviceManager: self.widgets_by_uid = dict() self.dds_sysclk = 0 - self.ttl_cb = lambda: None self.ttl_widgets = dict() - self.dds_cb = lambda: None self.dds_widgets = dict() - self.dac_cb = lambda: None self.dac_widgets = dict() + self.channels_cb = lambda: None def init_ddb(self, ddb): self.ddb = ddb @@ -468,17 +466,14 @@ class _DeviceManager: self.setup_ttl_monitoring(False, widget.channel) widget.deleteLater() del self.ttl_widgets[widget.channel] - self.ttl_cb() elif isinstance(widget, _DDSWidget): self.setup_dds_monitoring(False, widget.bus_channel, widget.channel) widget.deleteLater() del self.dds_widgets[(widget.bus_channel, widget.channel)] - self.dds_cb() elif isinstance(widget, _DACWidget): self.setup_dac_monitoring(False, widget.spi_channel, widget.channel) widget.deleteLater() del self.dac_widgets[(widget.spi_channel, widget.channel)] - self.dac_cb() else: raise ValueError @@ -490,19 +485,19 @@ class _DeviceManager: if isinstance(widget, _TTLWidget): self.ttl_widgets[widget.channel] = widget - self.ttl_cb() self.setup_ttl_monitoring(True, widget.channel) elif isinstance(widget, _DDSWidget): self.dds_widgets[(widget.bus_channel, widget.channel)] = widget - self.dds_cb() self.setup_dds_monitoring(True, widget.bus_channel, widget.channel) elif isinstance(widget, _DACWidget): self.dac_widgets[(widget.spi_channel, widget.channel)] = widget - self.dac_cb() self.setup_dac_monitoring(True, widget.spi_channel, widget.channel) else: raise ValueError + if description != self.description: + self.channels_cb() + self.description = description def ttl_set_mode(self, channel, mode): @@ -764,14 +759,10 @@ class _MonInjDock(QtWidgets.QDockWidget): class MonInj: def __init__(self, schedule_ctl): - self.ttl_dock = _MonInjDock("TTL") - self.dds_dock = _MonInjDock("DDS") - self.dac_dock = _MonInjDock("DAC") + self.dock = _MonInjDock("MonInj") self.dm = _DeviceManager(schedule_ctl) - self.dm.ttl_cb = lambda: self.ttl_dock.layout_widgets(self.dm.ttl_widgets.values()) - self.dm.dds_cb = lambda: self.dds_dock.layout_widgets(self.dm.dds_widgets.values()) - self.dm.dac_cb = lambda: self.dac_dock.layout_widgets(self.dm.dac_widgets.values()) + self.dm.channels_cb = lambda: self.dock.layout_widgets(self.dm.widgets_by_uid.values()) async def stop(self): if self.dm is not None: diff --git a/artiq/frontend/artiq_dashboard.py b/artiq/frontend/artiq_dashboard.py index 634f5e29d..1e95def0b 100755 --- a/artiq/frontend/artiq_dashboard.py +++ b/artiq/frontend/artiq_dashboard.py @@ -261,8 +261,8 @@ def main(): # lay out docks right_docks = [ d_explorer, d_shortcuts, - d_ttl_dds.ttl_dock, d_ttl_dds.dds_dock, d_ttl_dds.dac_dock, - d_datasets, d_applets, d_waveform, d_interactive_args + d_ttl_dds.dock, d_datasets, d_applets, + d_waveform, d_interactive_args ] main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, right_docks[0]) for d1, d2 in zip(right_docks, right_docks[1:]): @@ -280,8 +280,7 @@ def main(): atexit_register_coroutine(smgr.stop, loop=loop) # work around for https://github.com/m-labs/artiq/issues/1307 - d_ttl_dds.ttl_dock.show() - d_ttl_dds.dds_dock.show() + d_ttl_dds.dock.show() # create first log dock if not already in state d_log0 = logmgr.first_log_dock()