forked from M-Labs/thermostat
Set Limits Warning Fix
This commit is contained in:
parent
cb2fa36e68
commit
d60172d7eb
@ -510,35 +510,35 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
self.plot_settings.setMenu(self.plot_menu)
|
||||
|
||||
@pyqtSlot(set)
|
||||
def set_limits_warning(self, limits_zeroed: set):
|
||||
for channel in limits_zeroed:
|
||||
if len(channel) != 0:
|
||||
break
|
||||
else:
|
||||
self.limits_warning.setPixmap(QtGui.QPixmap())
|
||||
self.limits_warning.setToolTip("")
|
||||
return
|
||||
@pyqtSlot(list)
|
||||
def set_limits_warning(self, limits_zeroed: list):
|
||||
channel_disabled = [False, False]
|
||||
|
||||
report_str = "The following output limits are set to zero:\n"
|
||||
for ch in range(2):
|
||||
zeroed = False
|
||||
if 'max_i_pos' in limits_zeroed[ch] and 'max_i_neg' in limits_zeroed[ch]:
|
||||
report_str += "Max Current, Min Current"
|
||||
zeroed = True
|
||||
if 'max_v' in limits_zeroed[ch]:
|
||||
report_str += ", " if zeroed else ""
|
||||
report_str += "Max Absolute Voltage"
|
||||
zeroed = True
|
||||
if zeroed:
|
||||
report_str = "The following output limit(s) are set to zero:\n"
|
||||
for ch, zeroed_limits in enumerate(limits_zeroed):
|
||||
if {'max_i_pos', 'max_i_neg'}.issubset(zeroed_limits):
|
||||
report_str += "Max Cooling Current, Max Heating Current"
|
||||
channel_disabled[ch] = True
|
||||
|
||||
if 'max_v' in zeroed_limits:
|
||||
if channel_disabled[ch]:
|
||||
report_str += ", "
|
||||
report_str += "Max Voltage Difference"
|
||||
channel_disabled[ch] = True
|
||||
|
||||
if channel_disabled[ch]:
|
||||
report_str += f" for Channel {ch}\n"
|
||||
|
||||
report_str += "\nThese limit(s) are restricting the channel(s) from producing current."
|
||||
|
||||
if True in channel_disabled:
|
||||
pixmapi = getattr(QtWidgets.QStyle.StandardPixmap, "SP_MessageBoxWarning")
|
||||
icon = self.style().standardIcon(pixmapi)
|
||||
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)
|
||||
def set_max_samples(self, samples: int):
|
||||
|
Loading…
Reference in New Issue
Block a user