forked from M-Labs/artiq
1
0
Fork 0

moninj: add to_model_path

This commit is contained in:
Simon Renblad 2024-04-16 17:34:01 +08:00
parent 0c8511eab6
commit 88ec806879
1 changed files with 10 additions and 1 deletions

View File

@ -158,6 +158,9 @@ class _TTLHandler:
self.widget.level_toggled.connect(self.level_toggled) self.widget.level_toggled.connect(self.level_toggled)
self.refresh_display() self.refresh_display()
def to_model_path(self):
return "ttl/{}".format(self.title)
class _DDSWidget(QtWidgets.QFrame): class _DDSWidget(QtWidgets.QFrame):
apply_changes = QtCore.pyqtSignal() apply_changes = QtCore.pyqtSignal()
@ -351,6 +354,9 @@ class _DDSHandler:
def off_clicked(self): def off_clicked(self):
self.dm.dds_channel_toggle(self.dds_name, sw=False) self.dm.dds_channel_toggle(self.dds_name, sw=False)
def to_model_path(self):
return "dds/{}".format(self.title)
class _DACWidget(QtWidgets.QFrame): class _DACWidget(QtWidgets.QFrame):
def __init__(self, channel, title): def __init__(self, channel, title):
@ -401,6 +407,9 @@ class _DACHandler:
if self.widget is not None: if self.widget is not None:
self.widget.set_value(self.cur_value * 100 / 2**16) self.widget.set_value(self.cur_value * 100 / 2**16)
def to_model_path(self):
return "dac/{}/{}".format(self.title, self.channel)
class Model(DictSyncTreeSepModel): class Model(DictSyncTreeSepModel):
def __init__(self, init): def __init__(self, init):
@ -413,7 +422,7 @@ class Model(DictSyncTreeSepModel):
def update(self, d): def update(self, d):
for k, v in d.items(): for k, v in d.items():
self[str(k)] = v self[v.to_model_path()] = v
class _AddChannelDialog(QtWidgets.QDialog): class _AddChannelDialog(QtWidgets.QDialog):