From 6d5c204004f31a75ab558166f7ba2a5637c91a53 Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Mon, 21 Oct 2024 16:29:39 -0400 Subject: [PATCH] added Switch All ch On --- IsegGUI.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/IsegGUI.py b/IsegGUI.py index f6845a9..f9f78d0 100755 --- a/IsegGUI.py +++ b/IsegGUI.py @@ -132,9 +132,13 @@ class MyWindow(QMainWindow): self.txtRefresh.returnPressed.connect(partial(self.UnSetTextColor, self.txtRefresh)) gLayout.addWidget(self.txtRefresh, 1, 1) + self.AllChkOn = QPushButton("Switch all channels On.") + gLayout.addWidget(self.AllChkOn, 2, 1) + self.AllChkOn.clicked.connect(partial(self.SwitchOnAllCh)) + self.AllChkOff = QPushButton("Switch all channels off.") - gLayout.addWidget(self.AllChkOff, 2, 1) - self.AllChkOff.clicked.connect(partial(self.SetAllOnOff)) + gLayout.addWidget(self.AllChkOff, 3, 1) + self.AllChkOff.clicked.connect(partial(self.SwitchOffAllCh)) #=========== set tab self.tabWidget = QTabWidget(self) @@ -306,7 +310,20 @@ class MyWindow(QMainWindow): newValue = mpod.GetCurrent(mod*100+ch) self.txtI[mod][ch].setText("{:.1f}".format(newValue)) - def SetAllOnOff(self): + def SwitchOnAllCh(self): + for k in range(0, nMod): + for ch, a in enumerate(modChList[k]) : + state = self.chkON[k][ch].checkState() + if state != Qt.CheckState.Checked: + print("Switching On Mod-%d, ch-%d" % (k, ch)) + mpod.SwitchOnHV( int(k) * 100 + int(ch), 1) + self.chkON[k][ch].setChecked(True) + onOffList[sum(nChPerMod[:k]) + ch] = 1 + time.sleep(0.01) # wait 10 mili-sec + + print("========== done") + + def SwitchOffAllCh(self): for k in range(0, nMod): for ch, a in enumerate(modChList[k]) : state = self.chkON[k][ch].checkState()