diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 996ffc2..b98dc5a 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -1,4 +1,4 @@ -from PyQt6 import QtWidgets +from PyQt6 import QtWidgets, QtGui from PyQt6.QtCore import pyqtSignal, QObject, QSignalBlocker, pyqtSlot from pyqtgraph import PlotWidget from pyqtgraph.parametertree import Parameter, ParameterTree, ParameterItem, registerParameterType @@ -97,18 +97,21 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.connect_btn.setText("Disconnect" if result else "Connect") if not result: self.hw_rev_lbl.setText("Thermostat vX.Y") - self.fan_group.setStyleSheet("") + self.fan_pwm_warning.setPixmap(QtGui.QPixmap()) + self.fan_pwm_warning.setToolTip("") def _hw_rev(self, hw_rev_d: dict): logging.debug(hw_rev_d) self.hw_rev_lbl.setText(f"Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}") self.fan_group.setEnabled(hw_rev_d["settings"]["fan_available"]) if hw_rev_d["settings"]["fan_pwm_recommended"]: - self.fan_group.setStyleSheet("") - self.fan_group.setToolTip("") + self.fan_pwm_warning.setPixmap(QtGui.QPixmap()) + self.fan_pwm_warning.setToolTip("") else: - self.fan_group.setStyleSheet("background-color: yellow") - self.fan_group.setToolTip("fan_pwm not recommended on this hardware revision") + pixmapi = getattr(QtWidgets.QStyle.StandardPixmap, "SP_MessageBoxWarning") + icon = self.style().standardIcon(pixmapi) + self.fan_pwm_warning.setPixmap(icon.pixmap(16, 16)) + self.fan_pwm_warning.setToolTip("Fan power adjustment not recommended on this hardware revision!") def fan_update(self, fan_settings): logging.debug(fan_settings) diff --git a/pytec/tec_qt.ui b/pytec/tec_qt.ui index b108b7c..0557111 100644 --- a/pytec/tec_qt.ui +++ b/pytec/tec_qt.ui @@ -503,6 +503,19 @@ 9 + + + + + 16 + 0 + + + + + + + diff --git a/pytec/ui_tec_qt.py b/pytec/ui_tec_qt.py index 0a727bb..bc06921 100644 --- a/pytec/ui_tec_qt.py +++ b/pytec/ui_tec_qt.py @@ -227,6 +227,11 @@ class Ui_MainWindow(object): self.gan_layout = QtWidgets.QHBoxLayout() self.gan_layout.setSpacing(9) self.gan_layout.setObjectName("gan_layout") + self.fan_pwm_warning = QtWidgets.QLabel(parent=self.fan_group) + self.fan_pwm_warning.setMinimumSize(QtCore.QSize(16, 0)) + self.fan_pwm_warning.setText("") + self.fan_pwm_warning.setObjectName("fan_pwm_warning") + self.gan_layout.addWidget(self.fan_pwm_warning) self.fan_lbl = QtWidgets.QLabel(parent=self.fan_group) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding) sizePolicy.setHorizontalStretch(0)