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 committed by Sébastien Bourdeauducq
parent e742dc9503
commit 5cd21c7a6d
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):
@ -186,6 +190,7 @@ class _DDSWidget(QtWidgets.QFrame):
self.dds_name = title self.dds_name = title
self.cur_frequency = 0 self.cur_frequency = 0
self.dds_model = _DDSModel(dds_type, ref_clk, cpld, pll, clk_div) self.dds_model = _DDSModel(dds_type, ref_clk, cpld, pll, clk_div)
self.title = title
QtWidgets.QFrame.__init__(self) QtWidgets.QFrame.__init__(self)
@ -315,6 +320,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):
@ -322,6 +330,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)
@ -352,6 +361,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")