moninj: add uid method to widgets

This commit is contained in:
Simon Renblad 2024-05-02 14:06:39 +08:00
parent 5297518525
commit 1f228a500b

View File

@ -32,6 +32,7 @@ class _TTLWidget(QtWidgets.QFrame):
self.channel = channel
self.set_mode = dm.ttl_set_mode
self.force_out = force_out
self.title = title
self.setFrameShape(QtWidgets.QFrame.Box)
self.setFrameShadow(QtWidgets.QFrame.Raised)
@ -145,6 +146,9 @@ class _TTLWidget(QtWidgets.QFrame):
def sort_key(self):
return self.channel
def uid(self):
return self.title
class _DDSModel:
def __init__(self, dds_type, ref_clk, cpld=None, pll=1, clk_div=0):
@ -185,6 +189,7 @@ class _DDSWidget(QtWidgets.QFrame):
self.dds_name = title
self.cur_frequency = 0
self.dds_model = dds_model
self.title = title
QtWidgets.QFrame.__init__(self)
@ -314,6 +319,9 @@ class _DDSWidget(QtWidgets.QFrame):
def sort_key(self):
return (self.bus_channel, self.channel)
def uid(self):
return self.title
class _DACWidget(QtWidgets.QFrame):
def __init__(self, dm, spi_channel, channel, title):
@ -321,6 +329,7 @@ class _DACWidget(QtWidgets.QFrame):
self.spi_channel = spi_channel
self.channel = channel
self.cur_value = 0
self.title = title
self.setFrameShape(QtWidgets.QFrame.Box)
self.setFrameShadow(QtWidgets.QFrame.Raised)
@ -351,6 +360,9 @@ class _DACWidget(QtWidgets.QFrame):
def sort_key(self):
return (self.spi_channel, self.channel)
def uid(self):
return (self.title, self.channel)
_WidgetDesc = namedtuple("_WidgetDesc", "uid comment cls arguments")