forked from M-Labs/artiq
1
0
Fork 0

moninj: merge docks

This commit is contained in:
Simon Renblad 2024-04-24 10:51:54 +08:00
parent 648d7a3d87
commit 687c12033e
2 changed files with 9 additions and 19 deletions

View File

@ -487,12 +487,10 @@ class _DeviceManager:
self.handlers_by_uid = dict()
self.dds_sysclk = 0
self.ttl_cb = lambda: None
self.ttl_handlers = dict()
self.dds_cb = lambda: None
self.dds_handlers = dict()
self.dac_cb = lambda: None
self.dac_handlers = dict()
self.channels_cb = lambda: None
def init_ddb(self, ddb):
self.ddb = ddb
@ -513,17 +511,14 @@ class _DeviceManager:
self.setup_ttl_monitoring(False, handler.channel)
handler.delete_widget()
del self.ttl_handlers[handler.channel]
self.ttl_cb()
elif isinstance(handler, _DDSHandler):
self.setup_dds_monitoring(False, handler.bus_channel, handler.channel)
handler.delete_widget()
del self.dds_handlers[(handler.bus_channel, handler.channel)]
self.dds_cb()
elif isinstance(handler, _DACHandler):
self.setup_dac_monitoring(False, handler.spi_channel, handler.channel)
handler.delete_widget()
del self.dac_handlers[(handler.spi_channel, handler.channel)]
self.dac_cb()
else:
raise ValueError
@ -536,19 +531,19 @@ class _DeviceManager:
if isinstance(handler, _TTLHandler):
self.ttl_handlers[handler.channel] = handler
self.ttl_cb()
self.setup_ttl_monitoring(True, handler.channel)
elif isinstance(handler, _DDSHandler):
self.dds_handlers[(handler.bus_channel, handler.channel)] = handler
self.dds_cb()
self.setup_dds_monitoring(True, handler.bus_channel, handler.channel)
elif isinstance(handler, _DACHandler):
self.dac_handlers[(handler.spi_channel, handler.channel)] = handler
self.dac_cb()
self.setup_dac_monitoring(True, handler.spi_channel, handler.channel)
else:
raise ValueError
if self.description != description:
self.channels_cb()
self.description = description
def ttl_set_mode(self, channel, mode):
@ -811,14 +806,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_handlers.values())
self.dm.dds_cb = lambda: self.dds_dock.layout_widgets(self.dm.dds_handlers.values())
self.dm.dac_cb = lambda: self.dac_dock.layout_widgets(self.dm.dac_handlers.values())
self.dm.channels_cb = lambda: self.dock.layout_widgets(self.dm.handlers_by_uid.values())
async def stop(self):
if self.dm is not None:

View File

@ -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()