diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 8a9f884..781a6a8 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -86,16 +86,14 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): def _on_connection_changed(self, result): self.graph_group.setEnabled(result) - self.hw_rev_lbl.setEnabled(result) self.fan_group.setEnabled(result) self.report_group.setEnabled(result) self.ip_set_line.setEnabled(not result) self.port_set_spin.setEnabled(not result) - self.status_lbl.setText("Connected" if result else "Disconnected") self.connect_btn.setText("Disconnect" if result else "Connect") if not result: - self.hw_rev_lbl.setText("Thermostat vX.Y") + self.status_lbl.setText("Disconnected") self.fan_pwm_warning.setPixmap(QtGui.QPixmap()) self.fan_pwm_warning.setToolTip("") @@ -109,9 +107,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.fan_pwm_warning.setPixmap(QtGui.QPixmap()) self.fan_pwm_warning.setToolTip("") - def _hw_rev(self, hw_rev_d: dict): + def _status(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.status_lbl.setText(f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}") self.fan_group.setEnabled(hw_rev_d["settings"]["fan_available"]) self.fan_pwm_recommended = hw_rev_d["settings"]["fan_pwm_recommended"] @@ -173,7 +171,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.connect_btn.setEnabled(True) self._on_connection_changed(True) - self._hw_rev(await self.tec_client.hw_rev()) + self._status(await self.tec_client.hw_rev()) self.fan_update(await self.tec_client.fan()) self.client_watcher = ClientWatcher(self, self.tec_client, self.report_refresh_spin.value()) diff --git a/pytec/tec_qt.ui b/pytec/tec_qt.ui index bc97494..551ef66 100644 --- a/pytec/tec_qt.ui +++ b/pytec/tec_qt.ui @@ -307,6 +307,162 @@ + + + + false + + + + 40 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 9 + + + + + + 16 + 0 + + + + + + + + + + + + 0 + 0 + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + + 40 + 0 + + + + Fan: + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + 200 + 0 + + + + 1 + + + 100 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 70 + 0 + + + + + 70 + 16777215 + + + + Auto + + + + + + + + + + + + + 0 + 0 + + + + Qt::Vertical + + + @@ -458,209 +614,6 @@ - - - - - 0 - 0 - - - - Qt::Vertical - - - - - - - false - - - - 40 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 9 - - - - - - 16 - 0 - - - - - - - - - - - - 0 - 0 - - - - - 40 - 0 - - - - - 40 - 16777215 - - - - - 40 - 0 - - - - Fan: - - - - - - - - 0 - 0 - - - - - 200 - 0 - - - - - 200 - 16777215 - - - - - 200 - 0 - - - - 1 - - - 100 - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - - 70 - 0 - - - - - 70 - 16777215 - - - - Auto - - - - - - - - - - - - - 0 - 0 - - - - Qt::Vertical - - - - - - - false - - - - 0 - 0 - - - - - 150 - 0 - - - - - 150 - 16777215 - - - - - 150 - 0 - - - - Thermostat vX.Y - - - diff --git a/pytec/ui_tec_qt.py b/pytec/ui_tec_qt.py index 63fe098..8144ebd 100644 --- a/pytec/ui_tec_qt.py +++ b/pytec/ui_tec_qt.py @@ -146,6 +146,69 @@ class Ui_MainWindow(object): self.line_0.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.line_0.setObjectName("line_0") self.settings_layout.addWidget(self.line_0) + self.fan_group = QtWidgets.QWidget(parent=self.bottom_settings_group) + self.fan_group.setEnabled(False) + self.fan_group.setMinimumSize(QtCore.QSize(40, 0)) + self.fan_group.setObjectName("fan_group") + self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.fan_group) + self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_6.setSpacing(0) + self.horizontalLayout_6.setObjectName("horizontalLayout_6") + 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) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.fan_lbl.sizePolicy().hasHeightForWidth()) + self.fan_lbl.setSizePolicy(sizePolicy) + self.fan_lbl.setMinimumSize(QtCore.QSize(40, 0)) + self.fan_lbl.setMaximumSize(QtCore.QSize(40, 16777215)) + self.fan_lbl.setBaseSize(QtCore.QSize(40, 0)) + self.fan_lbl.setObjectName("fan_lbl") + self.gan_layout.addWidget(self.fan_lbl) + self.fan_power_slider = QtWidgets.QSlider(parent=self.fan_group) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.fan_power_slider.sizePolicy().hasHeightForWidth()) + self.fan_power_slider.setSizePolicy(sizePolicy) + self.fan_power_slider.setMinimumSize(QtCore.QSize(200, 0)) + self.fan_power_slider.setMaximumSize(QtCore.QSize(200, 16777215)) + self.fan_power_slider.setBaseSize(QtCore.QSize(200, 0)) + self.fan_power_slider.setMinimum(1) + self.fan_power_slider.setMaximum(100) + self.fan_power_slider.setOrientation(QtCore.Qt.Orientation.Horizontal) + self.fan_power_slider.setObjectName("fan_power_slider") + self.gan_layout.addWidget(self.fan_power_slider) + self.fan_auto_box = QtWidgets.QCheckBox(parent=self.fan_group) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.fan_auto_box.sizePolicy().hasHeightForWidth()) + self.fan_auto_box.setSizePolicy(sizePolicy) + self.fan_auto_box.setMinimumSize(QtCore.QSize(70, 0)) + self.fan_auto_box.setMaximumSize(QtCore.QSize(70, 16777215)) + self.fan_auto_box.setObjectName("fan_auto_box") + self.gan_layout.addWidget(self.fan_auto_box) + self.horizontalLayout_6.addLayout(self.gan_layout) + self.settings_layout.addWidget(self.fan_group) + self.line_1 = QtWidgets.QFrame(parent=self.bottom_settings_group) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.line_1.sizePolicy().hasHeightForWidth()) + self.line_1.setSizePolicy(sizePolicy) + self.line_1.setFrameShape(QtWidgets.QFrame.Shape.VLine) + self.line_1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) + self.line_1.setObjectName("line_1") + self.settings_layout.addWidget(self.line_1) self.report_group = QtWidgets.QWidget(parent=self.bottom_settings_group) self.report_group.setEnabled(False) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) @@ -206,91 +269,6 @@ class Ui_MainWindow(object): self.report_layout.setStretch(2, 1) self.horizontalLayout_4.addLayout(self.report_layout) self.settings_layout.addWidget(self.report_group) - self.line_1 = QtWidgets.QFrame(parent=self.bottom_settings_group) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.line_1.sizePolicy().hasHeightForWidth()) - self.line_1.setSizePolicy(sizePolicy) - self.line_1.setFrameShape(QtWidgets.QFrame.Shape.VLine) - self.line_1.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) - self.line_1.setObjectName("line_1") - self.settings_layout.addWidget(self.line_1) - self.fan_group = QtWidgets.QWidget(parent=self.bottom_settings_group) - self.fan_group.setEnabled(False) - self.fan_group.setMinimumSize(QtCore.QSize(40, 0)) - self.fan_group.setObjectName("fan_group") - self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.fan_group) - self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_6.setSpacing(0) - self.horizontalLayout_6.setObjectName("horizontalLayout_6") - 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) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.fan_lbl.sizePolicy().hasHeightForWidth()) - self.fan_lbl.setSizePolicy(sizePolicy) - self.fan_lbl.setMinimumSize(QtCore.QSize(40, 0)) - self.fan_lbl.setMaximumSize(QtCore.QSize(40, 16777215)) - self.fan_lbl.setBaseSize(QtCore.QSize(40, 0)) - self.fan_lbl.setObjectName("fan_lbl") - self.gan_layout.addWidget(self.fan_lbl) - self.fan_power_slider = QtWidgets.QSlider(parent=self.fan_group) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.fan_power_slider.sizePolicy().hasHeightForWidth()) - self.fan_power_slider.setSizePolicy(sizePolicy) - self.fan_power_slider.setMinimumSize(QtCore.QSize(200, 0)) - self.fan_power_slider.setMaximumSize(QtCore.QSize(200, 16777215)) - self.fan_power_slider.setBaseSize(QtCore.QSize(200, 0)) - self.fan_power_slider.setMinimum(1) - self.fan_power_slider.setMaximum(100) - self.fan_power_slider.setOrientation(QtCore.Qt.Orientation.Horizontal) - self.fan_power_slider.setObjectName("fan_power_slider") - self.gan_layout.addWidget(self.fan_power_slider) - self.fan_auto_box = QtWidgets.QCheckBox(parent=self.fan_group) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.fan_auto_box.sizePolicy().hasHeightForWidth()) - self.fan_auto_box.setSizePolicy(sizePolicy) - self.fan_auto_box.setMinimumSize(QtCore.QSize(70, 0)) - self.fan_auto_box.setMaximumSize(QtCore.QSize(70, 16777215)) - self.fan_auto_box.setObjectName("fan_auto_box") - self.gan_layout.addWidget(self.fan_auto_box) - self.horizontalLayout_6.addLayout(self.gan_layout) - self.settings_layout.addWidget(self.fan_group) - self.line_3 = QtWidgets.QFrame(parent=self.bottom_settings_group) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.line_3.sizePolicy().hasHeightForWidth()) - self.line_3.setSizePolicy(sizePolicy) - self.line_3.setFrameShape(QtWidgets.QFrame.Shape.VLine) - self.line_3.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) - self.line_3.setObjectName("line_3") - self.settings_layout.addWidget(self.line_3) - self.hw_rev_lbl = QtWidgets.QLabel(parent=self.bottom_settings_group) - self.hw_rev_lbl.setEnabled(False) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.hw_rev_lbl.sizePolicy().hasHeightForWidth()) - self.hw_rev_lbl.setSizePolicy(sizePolicy) - self.hw_rev_lbl.setMinimumSize(QtCore.QSize(150, 0)) - self.hw_rev_lbl.setMaximumSize(QtCore.QSize(150, 16777215)) - self.hw_rev_lbl.setBaseSize(QtCore.QSize(150, 0)) - self.hw_rev_lbl.setObjectName("hw_rev_lbl") - self.settings_layout.addWidget(self.hw_rev_lbl) self.horizontalLayout_2.addLayout(self.settings_layout) self.main_layout.addWidget(self.bottom_settings_group) self.gridLayout_2.addLayout(self.main_layout, 0, 1, 1, 1) @@ -310,12 +288,11 @@ class Ui_MainWindow(object): self.ip_set_line.setPlaceholderText(_translate("MainWindow", "IP:port for the Thermostat")) self.connect_btn.setText(_translate("MainWindow", "Connect")) self.status_lbl.setText(_translate("MainWindow", "Disconnected")) + self.fan_lbl.setText(_translate("MainWindow", "Fan:")) + self.fan_auto_box.setText(_translate("MainWindow", "Auto")) self.report_refresh_spin.setSuffix(_translate("MainWindow", " s")) self.report_box.setText(_translate("MainWindow", "Report")) self.report_apply_btn.setText(_translate("MainWindow", "Apply")) - self.fan_lbl.setText(_translate("MainWindow", "Fan:")) - self.fan_auto_box.setText(_translate("MainWindow", "Auto")) - self.hw_rev_lbl.setText(_translate("MainWindow", "Thermostat vX.Y")) from pyqtgraph import PlotWidget from pyqtgraph.parametertree import ParameterTree