From 903f9f8767171da4171d971d4cb109ae347140f5 Mon Sep 17 00:00:00 2001 From: atse Date: Tue, 27 Aug 2024 18:01:27 +0800 Subject: [PATCH] hwrev updates --- pytec/pytec/gui/model/thermostat.py | 1 - pytec/tec_qt.py | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 9c3e78d..61eb27f 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -39,7 +39,6 @@ class Thermostat(QObject, metaclass=PropertyMeta): async def start_session(self, host, port): self.connection_state_changed.emit(ThermostatConnectionState.CONNECTING) await self._client.connect(host, port) - await self.get_hw_rev() self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED) self.start_watching() diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 74db4dc..f827838 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -97,7 +97,6 @@ class MainWindow(QtWidgets.QMainWindow): self.zero_limits_warning.set_limits_warning ) - self.thermostat.hw_rev_update.connect(self._status) self.report_apply_btn.clicked.connect( lambda: self.thermostat.set_update_s(self.report_refresh_spin.value()) ) @@ -134,6 +133,10 @@ class MainWindow(QtWidgets.QMainWindow): self.conn_menu.host_set_line.setEnabled(False) self.conn_menu.port_set_spin.setEnabled(False) self.connect_btn.setText("Disconnect") + hw_rev_d = await self.thermostat.get_hw_rev() + self.status_lbl.setText( + f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}" + ) case ThermostatConnectionState.CONNECTING: self.status_lbl.setText("Connecting...") @@ -166,11 +169,6 @@ class MainWindow(QtWidgets.QMainWindow): else: await self.autotuners.stop_pid_from_running(ch) - def _status(self, hw_rev_d: dict): - self.status_lbl.setText( - f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}" - ) - @asyncSlot(int) async def on_report_box_stateChanged(self, enabled): await self.thermostat.set_report_mode(enabled)