forked from M-Labs/thermostat
linuswck
726f1a3657
- Bugs fix: 1. Params Tree user input will not get overwritten by incoming report thermostat_data_model. 2. PID Autotune Sampling Period is now set according to Thermostat sampling interval 3. PID Autotune won't get stuck in Fail State 4. Various types disconnection related Bugs 5. Number of Samples stored in the plot cannot be set 6. Limit the max settable output current to be 2000mA - Improvement: 1. Params Tree settings can be changed with external json 2. Use a Tab system to show a single channel of config instead of two 3. Expose PID Autotune lookback params 4. Icon is changed to Artiq logo - Restructure: 1. Restructure the code to follow Model-View-Delegate Design Pattern
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
from PyQt6.QtCore import pyqtSlot, QObject
|
|
from PyQt6 import QtWidgets, QtGui
|
|
|
|
|
|
class zero_limits_warning_view(QObject):
|
|
def __init__(self, style, limit_warning):
|
|
super().__init__()
|
|
self._lbl = limit_warning
|
|
self._style = style
|
|
|
|
@pyqtSlot("QVariantList")
|
|
def set_limits_warning(self, channels_zeroed_limits: list):
|
|
channel_disabled = [False, False]
|
|
|
|
report_str = "The following output limit(s) are set to zero:\n"
|
|
for ch, zeroed_limits in enumerate(channels_zeroed_limits):
|
|
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._lbl.setPixmap(icon.pixmap(16, 16))
|
|
self._lbl.setToolTip(report_str)
|
|
else:
|
|
self._lbl.setPixmap(QtGui.QPixmap())
|
|
self._lbl.setToolTip(None)
|