From 7b662374bc3f29af3aed666ac6a713e1685c63d6 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 c707f5b..d7a00ae 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -99,7 +99,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()) ) @@ -143,6 +142,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...") @@ -175,11 +178,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)