diff --git a/pytec/pytec/gui/view/ctrl_panel.py b/pytec/pytec/gui/view/ctrl_panel.py index 76e49cf..ee64c67 100644 --- a/pytec/pytec/gui/view/ctrl_panel.py +++ b/pytec/pytec/gui/view/ctrl_panel.py @@ -46,8 +46,6 @@ registerParameterType("mutex", MutexParameter) class CtrlPanel(QObject): - set_zero_limits_warning_sig = pyqtSignal(list) - def __init__( self, thermostat, @@ -228,8 +226,6 @@ class CtrlPanel(QObject): @pyqtSlot("QVariantList") def update_pwm(self, pwm_data): - channels_zeroed_limits = [set() for i in range(self.NUM_CHANNELS)] - for pwm_params in pwm_data: channel = pwm_params["channel"] with QSignalBlocker(self.params[channel]): @@ -243,11 +239,6 @@ class CtrlPanel(QObject): "Output Config", "Limits", "Max Heating Current" ).setValue(pwm_params["max_i_neg"]["value"] * 1000) - for limit in "max_i_pos", "max_i_neg", "max_v": - if pwm_params[limit]["value"] == 0.0: - channels_zeroed_limits[channel].add(limit) - self.set_zero_limits_warning_sig.emit(channels_zeroed_limits) - @pyqtSlot("QVariantList") def update_postfilter(self, postfilter_data): for postfilter_params in postfilter_data: diff --git a/pytec/pytec/gui/view/zero_limits_warning.py b/pytec/pytec/gui/view/zero_limits_warning.py index 113aef0..de0e641 100644 --- a/pytec/pytec/gui/view/zero_limits_warning.py +++ b/pytec/pytec/gui/view/zero_limits_warning.py @@ -3,15 +3,24 @@ from PyQt6 import QtWidgets, QtGui class ZeroLimitsWarningView(QObject): - def __init__(self, style, limit_warning): + def __init__(self, thermostat, style, limit_warning): super().__init__() + self._thermostat = thermostat + self._thermostat.pwm_update.connect(self.set_limits_warning) self._lbl = limit_warning self._style = style @pyqtSlot("QVariantList") - def set_limits_warning(self, channels_zeroed_limits: list): - channel_disabled = [False, False] + def set_limits_warning(self, pwm_data: list): + channels_zeroed_limits = [set() for i in range(self._thermostat.NUM_CHANNELS)] + for pwm_params in pwm_data: + channel = pwm_params["channel"] + for limit in "max_i_pos", "max_i_neg", "max_v": + if pwm_params[limit]["value"] == 0.0: + channels_zeroed_limits[channel].add(limit) + + 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): diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index d7af6b8..775c1fe 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -116,10 +116,7 @@ class MainWindow(QtWidgets.QMainWindow): # Status line self.zero_limits_warning = ZeroLimitsWarningView( - self.style(), self.limits_warning - ) - self.ctrl_panel_view.set_zero_limits_warning_sig.connect( - self.zero_limits_warning.set_limits_warning + self.thermostat, self.style(), self.limits_warning ) self.loading_spinner.hide()