forked from M-Labs/artiq
1
0
Fork 0

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
1 changed files with 12 additions and 0 deletions

View File

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