diff --git a/pytec/pytec/gui/view/thermostat_ctrl_menu.py b/pytec/pytec/gui/view/thermostat_ctrl_menu.py index f264b9f..2278eef 100644 --- a/pytec/pytec/gui/view/thermostat_ctrl_menu.py +++ b/pytec/pytec/gui/view/thermostat_ctrl_menu.py @@ -3,6 +3,7 @@ from PyQt6 import QtWidgets, QtGui, QtCore from PyQt6.QtCore import pyqtSignal, pyqtSlot, QSignalBlocker from qasync import asyncSlot from pytec.gui.view.net_settings_input_diag import NetSettingsInputDiag +from pytec.gui.model.thermostat import ThermostatConnectionState class ThermostatCtrlMenu(QtWidgets.QMenu): @@ -15,6 +16,9 @@ class ThermostatCtrlMenu(QtWidgets.QMenu): self.hw_rev_data = dict() self._thermostat.hw_rev_update.connect(self.hw_rev) + self._thermostat.connection_state_changed.connect( + self.thermostat_state_change_handler + ) self.fan_group = QtWidgets.QWidget() self.fan_group.setEnabled(False) @@ -144,6 +148,12 @@ class ThermostatCtrlMenu(QtWidgets.QMenu): self.fan_pwm_warning.setPixmap(QtGui.QPixmap()) self.fan_pwm_warning.setToolTip("") + @pyqtSlot(ThermostatConnectionState) + def thermostat_state_change_handler(self, state): + if state == ThermostatConnectionState.DISCONNECTED: + self.thermostat_ctrl_menu.fan_pwm_warning.setPixmap(QtGui.QPixmap()) + self.thermostat_ctrl_menu.fan_pwm_warning.setToolTip("") + @pyqtSlot("QVariantMap") def hw_rev(self, hw_rev): self.hw_rev_data = hw_rev diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index e391f24..a24fed1 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -164,8 +164,6 @@ class MainWindow(QtWidgets.QMainWindow): self.background_task_lbl.setText("Ready.") self.loading_spinner.hide() self.loading_spinner.stop() - self.thermostat_ctrl_menu.fan_pwm_warning.setPixmap(QtGui.QPixmap()) - self.thermostat_ctrl_menu.fan_pwm_warning.setToolTip("") self.channel_graphs.clear_graphs() self.report_box.setChecked(False) for ch in range(self.NUM_CHANNELS):