From 8cfb47880ab590c3f1ffd185dbe8c3c1ca139de4 Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Thu, 16 May 2024 12:59:41 -0400 Subject: [PATCH] basic function is done --- IsegGUI.py | 39 ++++++++++++++++++++++++++++++++------- IsegLibrary.py | 2 +- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/IsegGUI.py b/IsegGUI.py index 8dd035e..577f51c 100755 --- a/IsegGUI.py +++ b/IsegGUI.py @@ -187,26 +187,51 @@ class MyWindow(QMainWindow): value = float(self.txtV[mod][ch].text()) print("mod : " + str(mod) + ", ch : " + str(ch) + " | " + str(value)) mpod.SetHV( mod*100 + ch, value) + newValue = mpod.GetHV(mod*100+ch) + self.txtV[mod][ch].setText("{:.1f}".format(newValue)) def SetI(self, mod, ch): value = float(self.txtI[mod][ch].text()) print("mod : " + str(mod) + ", ch : " + str(ch) + " | " + str(value)) mpod.SetCurrent( mod*100 + ch, value/1000.) + newValue = mpod.GetCurrent(mod*100+ch) + self.txtI[mod][ch].setText("{:.1f}".format(newValue)) def SetOnOff(self, mod, ch): state = self.chkON[mod][ch].checkState() - print("mod : " + str(mod) + ", ch : " + str(ch) + " | " + str(state)) - if state == Qt.Checked : - mpod.SwitchOnHV( mod*100 + ch, True) + if state == Qt.CheckState.Checked: + if onOffList[sum(nChPerMod[:mod]) + ch] == 3 : + mpod.SwitchOnHV(mod*100 + ch, 2) + mpod.SwitchOnHV( mod*100 + ch, 1) + onOffList[sum(nChPerMod[:mod]) + ch] = 1 else: - mpod.SwitchOnHV( mod*100 + ch, False) + mpod.SwitchOnHV( mod*100 + ch, 0) + onOffList[sum(nChPerMod[:mod]) + ch] = 0 + + value = mpod.IsHVOn(mod*100 + ch) + # print("mod : " + str(mod) + ", ch : " + str(ch) + " | " + str(state) + " | " + str(onOffList[sum(nChPerMod[:mod]) + ch]) + " | " + str(value)) + if value == 0 : + self.chkON[mod][ch].setChecked(False) + self.chkON[mod][ch].setStyleSheet("") + if value == 1 : + self.chkON[mod][ch].setChecked(True) + self.chkON[mod][ch].setStyleSheet("") + if value == 3 : + self.chkON[mod][ch].setChecked(False) + self.chkON[mod][ch].setStyleSheet("background-color: red;") - def on_timeout(self): - print("Timer timed out!") def updateTimer(self): self.time += 1 - print(f'Time: {self.time}') + # print(f'Time: {self.time}') + outVList = mpod.GetAllOutputHV() + outIList = mpod.GetAllLC() + # print(outVList) + for k in range(0, nMod): + for i, a in enumerate(modChList[k]) : + self.txtVOut[k][i].setText("{:.2f}".format(outVList[sum(nChPerMod[:k]) + i])) + self.txtIOut[k][i].setText("{:.2f}".format(outIList[sum(nChPerMod[:k]) + i])) + if __name__ == "__main__": app = QApplication(sys.argv) diff --git a/IsegLibrary.py b/IsegLibrary.py index 87a866c..51bf88b 100755 --- a/IsegLibrary.py +++ b/IsegLibrary.py @@ -88,7 +88,7 @@ class Mpod: def IsHVOn(self, ch): if (self.isConnected == False ) : return 0 - return self.SendCmd(0, "outputSwitch.u"+str(ch)) + return extract_number_between_parentheses(self.SendCmd(0, "outputSwitch.u"+str(ch))) def GetHVRiseRate(self, ch): if (self.isConnected == False ) : return 0