From 773a19ffca3f5ec3362f244969baac678726cb04 Mon Sep 17 00:00:00 2001 From: Alice Date: Wed, 10 Jun 2026 10:55:41 +0200 Subject: [PATCH] added checkboxes for different images --- pyctbgui/pyctbgui/services/Plot.py | 21 ++++ pyctbgui/pyctbgui/services/Transceiver.py | 7 +- pyctbgui/pyctbgui/ui/plot.ui | 136 ++++++++++++++-------- 3 files changed, 113 insertions(+), 51 deletions(-) diff --git a/pyctbgui/pyctbgui/services/Plot.py b/pyctbgui/pyctbgui/services/Plot.py index 10e99926f..1174ed256 100644 --- a/pyctbgui/pyctbgui/services/Plot.py +++ b/pyctbgui/pyctbgui/services/Plot.py @@ -52,6 +52,13 @@ class PlotTab(QtWidgets.QWidget): self.adcTab = self.mainWindow.adcTab self.initializeColorMaps() + # TODO use list comprehension + self.checkBoxCounters = [self.view.checkBoxCounter0, self.view.checkBoxCounter1, self.view.checkBoxCounter2, self.view.checkBoxCounter3] + + for checkBox in self.checkBoxCounters: + checkBox.setChecked(True) + checkBox.setEnabled(True) + self.imagePlots = ( self.mainWindow.plotAnalogImage, self.mainWindow.plotDigitalImage, @@ -94,6 +101,11 @@ class PlotTab(QtWidgets.QWidget): self.view.radioButtonFixed.clicked.connect(partial(self.setColorRangeMode, Defines.colorRange.fixed)) self.view.radioButtonCenter.clicked.connect(partial(self.setColorRangeMode, Defines.colorRange.center)) + # TODO: need to disable for all but matterhorn/non transceiver I guess, need to be disabled + # shown counters + for index, checkBox in enumerate(self.checkBoxCounters): + checkBox.stateChanged.connect(partial(self.displayCounter, index)) + # show image Values for analog image nMaxY = lambda : self.mainWindow.nAnalogRows nMaxX = lambda : self.mainWindow.nAnalogCols @@ -121,6 +133,15 @@ class PlotTab(QtWidgets.QWidget): self.view.checkBoxShowLegend.stateChanged.connect(self.toggleLegend) + + def displayCounter(self, index : int, state : int): + # toggle the display of the counter i and update the splitter + self.transceiverTab.shownCounters[index] = (state == QtCore.Qt.Checked) + self.transceiverTab.update_ImageSplitter() + + def enableCounterCheckBox(self, index : int, enabled : bool): + self.checkBoxCounters[index].setEnabled(enabled) + def refresh(self): self.getZMQHWM() diff --git a/pyctbgui/pyctbgui/services/Transceiver.py b/pyctbgui/pyctbgui/services/Transceiver.py index f9e7d32cd..b8ee07075 100644 --- a/pyctbgui/pyctbgui/services/Transceiver.py +++ b/pyctbgui/pyctbgui/services/Transceiver.py @@ -182,9 +182,12 @@ class TransceiverTab(QtWidgets.QWidget): def update_numCounters(self, num_counters): # update the number of counters and adjust the image splitter accordingly self.nCounters = num_counters - self.shownCounters = [i < self.nCounters for i in range(Defines.transceiver.maxcount)] - self.update_ImageSplitter() + for i in range(Defines.transceiver.maxcount): + self.shownCounters[i] = i < self.nCounters + self.plotTab.enableCounterCheckBox(i, self.shownCounters[i]) + + def update_ImageSplitter(self): for i, showncounter in enumerate(self.shownCounters): self.transceiverImageViews[i].setVisible(showncounter) diff --git a/pyctbgui/pyctbgui/ui/plot.ui b/pyctbgui/pyctbgui/ui/plot.ui index 848d48f16..088f914e7 100644 --- a/pyctbgui/pyctbgui/ui/plot.ui +++ b/pyctbgui/pyctbgui/ui/plot.ui @@ -25,7 +25,7 @@ 10 50 841 - 141 + 161 @@ -45,19 +45,6 @@ - - - - false - - - Distribution - - - buttonGroup - - - @@ -71,6 +58,32 @@ + + + + true + + + + 0 + 31 + + + + <html><head/><body><p>If set to high readout, zmq HWM is set to 2 and buffer size to 1MB to drop zmq packets to catch up.</p><p>If set to low readout (default), zmq HWM is set to zmq default (1000) and buffer size to os default to not drop any zmq packets.</p></body></html> + + + + Low - drop no zmq packet + + + + + High - drop zmq packets to catch up + + + + @@ -273,11 +286,20 @@ - - - - Options: + + + + true + + Waveform + + + true + + + buttonGroup + @@ -296,30 +318,24 @@ - - + + - true + false - - - 0 - 31 - + + Distribution - - <html><head/><body><p>If set to high readout, zmq HWM is set to 2 and buffer size to 1MB to drop zmq packets to catch up.</p><p>If set to low readout (default), zmq HWM is set to zmq default (1000) and buffer size to os default to not drop any zmq packets.</p></body></html> + + buttonGroup + + + + + + + Options: - - - Low - drop no zmq packet - - - - - High - drop zmq packets to catch up - - @@ -345,20 +361,42 @@ - - - - true + + + + <html><head/><body><p>If set to high readout, zmq HWM is set to 2 and buffer size to 1MB to drop zmq packets to catch up.</p><p>If set to low readout (default), zmq HWM is set to zmq default (1000) and buffer size to os default to not drop any zmq packets.</p></body></html> - Waveform + Counters: - - true + + + + + + Counter 0 + + + + + + + Counter 1 + + + + + + + Counter 2 + + + + + + + Counter 3 - - buttonGroup - @@ -1078,8 +1116,8 @@ - +