Improve conditionals

This commit is contained in:
atse 2023-08-23 17:06:31 +08:00
parent 68124cd92b
commit 6bca8a2728
1 changed files with 3 additions and 5 deletions

View File

@ -651,9 +651,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.params[channel].child("PID Config", "Kp").setValue(settings["parameters"]["kp"]) self.params[channel].child("PID Config", "Kp").setValue(settings["parameters"]["kp"])
self.params[channel].child("PID Config", "Ki").setValue(settings["parameters"]["ki"]) self.params[channel].child("PID Config", "Ki").setValue(settings["parameters"]["ki"])
self.params[channel].child("PID Config", "Kd").setValue(settings["parameters"]["kd"]) self.params[channel].child("PID Config", "Kd").setValue(settings["parameters"]["kd"])
if self.params[channel].child("Output Config", "Control Method").value(): self.params[channel].child("Output Config", "Control Method", "Set Temperature").setValue(settings["target"])
self.params[channel].child("Output Config", "Control Method", "Set Temperature").setValue(settings["target"]) getattr(self, f'ch{channel}_t_line').setValue(settings["target"])
getattr(self, f'ch{channel}_t_line').setValue(settings["target"])
@pyqtSlot(list) @pyqtSlot(list)
def update_report(self, report_data): def update_report(self, report_data):
@ -663,9 +662,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.params[channel].child("Output Config", "Control Method").setValue(settings["pid_engaged"]) self.params[channel].child("Output Config", "Control Method").setValue(settings["pid_engaged"])
getattr(self, f'ch{channel}_t_line').setVisible(settings["pid_engaged"]) getattr(self, f'ch{channel}_t_line').setVisible(settings["pid_engaged"])
self.params[channel].child("Output Config", "Control Method", "Constant Current").setValue(settings["i_set"]) self.params[channel].child("Output Config", "Control Method", "Constant Current").setValue(settings["i_set"])
if settings['temperature'] is not None: if settings['temperature'] is not None and settings['tec_i'] is not None:
self.params[channel].child("Temperature").setValue(settings['temperature']) self.params[channel].child("Temperature").setValue(settings['temperature'])
if settings['tec_i'] is not None:
self.params[channel].child("Current through TEC").setValue(settings['tec_i']) self.params[channel].child("Current through TEC").setValue(settings['tec_i'])
@pyqtSlot(list) @pyqtSlot(list)