mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-24 10:54:02 +08:00
moninj: merge docks
This commit is contained in:
parent
51837ce1a2
commit
2fde21152a
@ -442,12 +442,10 @@ class _DeviceManager:
|
|||||||
self.widgets_by_uid = dict()
|
self.widgets_by_uid = dict()
|
||||||
|
|
||||||
self.dds_sysclk = 0
|
self.dds_sysclk = 0
|
||||||
self.ttl_cb = lambda: None
|
|
||||||
self.ttl_widgets = dict()
|
self.ttl_widgets = dict()
|
||||||
self.dds_cb = lambda: None
|
|
||||||
self.dds_widgets = dict()
|
self.dds_widgets = dict()
|
||||||
self.dac_cb = lambda: None
|
|
||||||
self.dac_widgets = dict()
|
self.dac_widgets = dict()
|
||||||
|
self.channels_cb = lambda: None
|
||||||
|
|
||||||
def init_ddb(self, ddb):
|
def init_ddb(self, ddb):
|
||||||
self.ddb = ddb
|
self.ddb = ddb
|
||||||
@ -468,17 +466,14 @@ class _DeviceManager:
|
|||||||
self.setup_ttl_monitoring(False, widget.channel)
|
self.setup_ttl_monitoring(False, widget.channel)
|
||||||
widget.deleteLater()
|
widget.deleteLater()
|
||||||
del self.ttl_widgets[widget.channel]
|
del self.ttl_widgets[widget.channel]
|
||||||
self.ttl_cb()
|
|
||||||
elif isinstance(widget, _DDSWidget):
|
elif isinstance(widget, _DDSWidget):
|
||||||
self.setup_dds_monitoring(False, widget.bus_channel, widget.channel)
|
self.setup_dds_monitoring(False, widget.bus_channel, widget.channel)
|
||||||
widget.deleteLater()
|
widget.deleteLater()
|
||||||
del self.dds_widgets[(widget.bus_channel, widget.channel)]
|
del self.dds_widgets[(widget.bus_channel, widget.channel)]
|
||||||
self.dds_cb()
|
|
||||||
elif isinstance(widget, _DACWidget):
|
elif isinstance(widget, _DACWidget):
|
||||||
self.setup_dac_monitoring(False, widget.spi_channel, widget.channel)
|
self.setup_dac_monitoring(False, widget.spi_channel, widget.channel)
|
||||||
widget.deleteLater()
|
widget.deleteLater()
|
||||||
del self.dac_widgets[(widget.spi_channel, widget.channel)]
|
del self.dac_widgets[(widget.spi_channel, widget.channel)]
|
||||||
self.dac_cb()
|
|
||||||
else:
|
else:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
@ -490,19 +485,19 @@ class _DeviceManager:
|
|||||||
|
|
||||||
if isinstance(widget, _TTLWidget):
|
if isinstance(widget, _TTLWidget):
|
||||||
self.ttl_widgets[widget.channel] = widget
|
self.ttl_widgets[widget.channel] = widget
|
||||||
self.ttl_cb()
|
|
||||||
self.setup_ttl_monitoring(True, widget.channel)
|
self.setup_ttl_monitoring(True, widget.channel)
|
||||||
elif isinstance(widget, _DDSWidget):
|
elif isinstance(widget, _DDSWidget):
|
||||||
self.dds_widgets[(widget.bus_channel, widget.channel)] = widget
|
self.dds_widgets[(widget.bus_channel, widget.channel)] = widget
|
||||||
self.dds_cb()
|
|
||||||
self.setup_dds_monitoring(True, widget.bus_channel, widget.channel)
|
self.setup_dds_monitoring(True, widget.bus_channel, widget.channel)
|
||||||
elif isinstance(widget, _DACWidget):
|
elif isinstance(widget, _DACWidget):
|
||||||
self.dac_widgets[(widget.spi_channel, widget.channel)] = widget
|
self.dac_widgets[(widget.spi_channel, widget.channel)] = widget
|
||||||
self.dac_cb()
|
|
||||||
self.setup_dac_monitoring(True, widget.spi_channel, widget.channel)
|
self.setup_dac_monitoring(True, widget.spi_channel, widget.channel)
|
||||||
else:
|
else:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
|
if description != self.description:
|
||||||
|
self.channels_cb()
|
||||||
|
|
||||||
self.description = description
|
self.description = description
|
||||||
|
|
||||||
def ttl_set_mode(self, channel, mode):
|
def ttl_set_mode(self, channel, mode):
|
||||||
@ -764,14 +759,10 @@ class _MonInjDock(QtWidgets.QDockWidget):
|
|||||||
|
|
||||||
class MonInj:
|
class MonInj:
|
||||||
def __init__(self, schedule_ctl):
|
def __init__(self, schedule_ctl):
|
||||||
self.ttl_dock = _MonInjDock("TTL")
|
self.dock = _MonInjDock("MonInj")
|
||||||
self.dds_dock = _MonInjDock("DDS")
|
|
||||||
self.dac_dock = _MonInjDock("DAC")
|
|
||||||
|
|
||||||
self.dm = _DeviceManager(schedule_ctl)
|
self.dm = _DeviceManager(schedule_ctl)
|
||||||
self.dm.ttl_cb = lambda: self.ttl_dock.layout_widgets(self.dm.ttl_widgets.values())
|
self.dm.channels_cb = lambda: self.dock.layout_widgets(self.dm.widgets_by_uid.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())
|
|
||||||
|
|
||||||
async def stop(self):
|
async def stop(self):
|
||||||
if self.dm is not None:
|
if self.dm is not None:
|
||||||
|
@ -261,8 +261,8 @@ def main():
|
|||||||
# lay out docks
|
# lay out docks
|
||||||
right_docks = [
|
right_docks = [
|
||||||
d_explorer, d_shortcuts,
|
d_explorer, d_shortcuts,
|
||||||
d_ttl_dds.ttl_dock, d_ttl_dds.dds_dock, d_ttl_dds.dac_dock,
|
d_ttl_dds.dock, d_datasets, d_applets,
|
||||||
d_datasets, d_applets, d_waveform, d_interactive_args
|
d_waveform, d_interactive_args
|
||||||
]
|
]
|
||||||
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, right_docks[0])
|
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, right_docks[0])
|
||||||
for d1, d2 in zip(right_docks, right_docks[1:]):
|
for d1, d2 in zip(right_docks, right_docks[1:]):
|
||||||
@ -280,8 +280,7 @@ def main():
|
|||||||
atexit_register_coroutine(smgr.stop, loop=loop)
|
atexit_register_coroutine(smgr.stop, loop=loop)
|
||||||
|
|
||||||
# work around for https://github.com/m-labs/artiq/issues/1307
|
# work around for https://github.com/m-labs/artiq/issues/1307
|
||||||
d_ttl_dds.ttl_dock.show()
|
d_ttl_dds.dock.show()
|
||||||
d_ttl_dds.dds_dock.show()
|
|
||||||
|
|
||||||
# create first log dock if not already in state
|
# create first log dock if not already in state
|
||||||
d_log0 = logmgr.first_log_dock()
|
d_log0 = logmgr.first_log_dock()
|
||||||
|
Loading…
Reference in New Issue
Block a user