moninj: add to_model_path

This commit is contained in:
Simon Renblad 2024-04-16 17:34:01 +08:00
parent 8bde26956a
commit 9c8c4b843e

View File

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