From 1f228a500bb8751e7f56b359af66c58b3f14c9c7 Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Thu, 2 May 2024 14:06:39 +0800 Subject: [PATCH] moninj: add uid method to widgets --- artiq/dashboard/moninj.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/artiq/dashboard/moninj.py b/artiq/dashboard/moninj.py index 45dc89f1d..375a31341 100644 --- a/artiq/dashboard/moninj.py +++ b/artiq/dashboard/moninj.py @@ -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")