moninj: to_model_path

This commit is contained in:
Simon Renblad 2024-04-24 13:41:14 +08:00
parent 2fe89fcac3
commit 9cbbd5056a

View File

@ -161,6 +161,9 @@ class _TTLHandler:
def sort_key(self):
return (0, self.channel, 0)
def to_model_path(self):
return "ttl/{}".format(self.title)
class _DDSWidget(QtWidgets.QFrame):
apply_changes = QtCore.pyqtSignal()
@ -357,6 +360,9 @@ class _DDSHandler:
def sort_key(self):
return (1, self.bus_channel, self.channel)
def to_model_path(self):
return "dds/{}".format(self.title)
class _DACWidget(QtWidgets.QFrame):
def __init__(self, channel, title):
@ -364,13 +370,13 @@ class _DACWidget(QtWidgets.QFrame):
self.setFrameShape(QtWidgets.QFrame.Box)
self.setFrameShadow(QtWidgets.QFrame.Raised)
self.title = "{} ch{}".format(title, channel)
grid = QtWidgets.QGridLayout()
grid.setContentsMargins(0, 0, 0, 0)
grid.setHorizontalSpacing(0)
grid.setVerticalSpacing(0)
self.setLayout(grid)
label = QtWidgets.QLabel("{} ch{}".format(title, channel))
label = QtWidgets.QLabel(self.title)
label.setAlignment(QtCore.Qt.AlignCenter)
grid.addWidget(label, 1, 1)
@ -386,6 +392,9 @@ class _DACWidget(QtWidgets.QFrame):
self.value.setText("<font size=\"4\">{:.3f}</font><font size=\"2\"> %</font>"
.format(value))
def to_model_path(self):
return "dac/{}".format(self.title)
class _DACHandler:
def __init__(self, dm, spi_channel, channel, title):