forked from M-Labs/thermostat
Replace fan group highlighting with warning icon
Highlighting is too confusing
This commit is contained in:
parent
8045d8c93d
commit
47dbe95045
|
@ -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)
|
||||
|
|
|
@ -503,6 +503,19 @@
|
|||
<property name="spacing">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="fan_pwm_warning">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fan_lbl">
|
||||
<property name="sizePolicy">
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue