Set Limits Warning Fix

This commit is contained in:
atse 2023-10-16 11:24:41 +08:00
parent cb2fa36e68
commit d60172d7eb

View File

@ -510,35 +510,35 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.plot_settings.setMenu(self.plot_menu) self.plot_settings.setMenu(self.plot_menu)
@pyqtSlot(set) @pyqtSlot(list)
def set_limits_warning(self, limits_zeroed: set): def set_limits_warning(self, limits_zeroed: list):
for channel in limits_zeroed: channel_disabled = [False, False]
if len(channel) != 0:
break
else:
self.limits_warning.setPixmap(QtGui.QPixmap())
self.limits_warning.setToolTip("")
return
report_str = "The following output limits are set to zero:\n" report_str = "The following output limit(s) are set to zero:\n"
for ch in range(2): for ch, zeroed_limits in enumerate(limits_zeroed):
zeroed = False if {'max_i_pos', 'max_i_neg'}.issubset(zeroed_limits):
if 'max_i_pos' in limits_zeroed[ch] and 'max_i_neg' in limits_zeroed[ch]: report_str += "Max Cooling Current, Max Heating Current"
report_str += "Max Current, Min Current" channel_disabled[ch] = True
zeroed = True
if 'max_v' in limits_zeroed[ch]: if 'max_v' in zeroed_limits:
report_str += ", " if zeroed else "" if channel_disabled[ch]:
report_str += "Max Absolute Voltage" report_str += ", "
zeroed = True report_str += "Max Voltage Difference"
if zeroed: channel_disabled[ch] = True
if channel_disabled[ch]:
report_str += f" for Channel {ch}\n" report_str += f" for Channel {ch}\n"
report_str += "\nThese limit(s) are restricting the channel(s) from producing current." report_str += "\nThese limit(s) are restricting the channel(s) from producing current."
pixmapi = getattr(QtWidgets.QStyle.StandardPixmap, "SP_MessageBoxWarning") if True in channel_disabled:
icon = self.style().standardIcon(pixmapi) pixmapi = getattr(QtWidgets.QStyle.StandardPixmap, "SP_MessageBoxWarning")
self.limits_warning.setPixmap(icon.pixmap(16, 16)) icon = self.style().standardIcon(pixmapi)
self.limits_warning.setToolTip(report_str) self.limits_warning.setPixmap(icon.pixmap(16, 16))
self.limits_warning.setToolTip(report_str)
else:
self.limits_warning.setPixmap(QtGui.QPixmap())
self.limits_warning.setToolTip(None)
@pyqtSlot(int) @pyqtSlot(int)
def set_max_samples(self, samples: int): def set_max_samples(self, samples: int):