Concentrate ThermostatCtrlMenu UI changes

This commit is contained in:
atse 2024-08-28 10:33:59 +08:00
parent 82315d65b2
commit 8a83bbc1d1
2 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,7 @@ from PyQt6 import QtWidgets, QtGui, QtCore
from PyQt6.QtCore import pyqtSignal, pyqtSlot, QSignalBlocker from PyQt6.QtCore import pyqtSignal, pyqtSlot, QSignalBlocker
from qasync import asyncSlot from qasync import asyncSlot
from pytec.gui.view.net_settings_input_diag import NetSettingsInputDiag from pytec.gui.view.net_settings_input_diag import NetSettingsInputDiag
from pytec.gui.model.thermostat import ThermostatConnectionState
class ThermostatCtrlMenu(QtWidgets.QMenu): class ThermostatCtrlMenu(QtWidgets.QMenu):
@ -15,6 +16,9 @@ class ThermostatCtrlMenu(QtWidgets.QMenu):
self.hw_rev_data = dict() self.hw_rev_data = dict()
self._thermostat.hw_rev_update.connect(self.hw_rev) 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 = QtWidgets.QWidget()
self.fan_group.setEnabled(False) self.fan_group.setEnabled(False)
@ -144,6 +148,12 @@ class ThermostatCtrlMenu(QtWidgets.QMenu):
self.fan_pwm_warning.setPixmap(QtGui.QPixmap()) self.fan_pwm_warning.setPixmap(QtGui.QPixmap())
self.fan_pwm_warning.setToolTip("") self.fan_pwm_warning.setToolTip("")
@pyqtSlot(ThermostatConnectionState)
def thermostat_state_change_handler(self, state):
if state == ThermostatConnectionState.DISCONNECTED:
self.fan_pwm_warning.setPixmap(QtGui.QPixmap())
self.fan_pwm_warning.setToolTip("")
@pyqtSlot("QVariantMap") @pyqtSlot("QVariantMap")
def hw_rev(self, hw_rev): def hw_rev(self, hw_rev):
self.hw_rev_data = hw_rev self.hw_rev_data = hw_rev

View File

@ -156,8 +156,6 @@ class MainWindow(QtWidgets.QMainWindow):
self.background_task_lbl.setText("Ready.") self.background_task_lbl.setText("Ready.")
self.loading_spinner.hide() self.loading_spinner.hide()
self.loading_spinner.stop() 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.channel_graphs.clear_graphs()
self.report_box.setChecked(False) self.report_box.setChecked(False)
for ch in range(self.NUM_CHANNELS): for ch in range(self.NUM_CHANNELS):