From 40c05192372fd23bee578d34196dd4096ef92527 Mon Sep 17 00:00:00 2001 From: atse Date: Tue, 27 Aug 2024 10:40:06 +0800 Subject: [PATCH] Fix updating status label for hwrev = None --- pytec/pytec/gui/model/thermostat.py | 2 +- pytec/tec_qt.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 31c1deb..42b24f8 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -39,8 +39,8 @@ 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) - self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED) hw_rev_data = await self.get_hw_rev() + self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED) self.start_watching() return hw_rev_data diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 8f9a16b..f5c77d7 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -116,6 +116,7 @@ class MainWindow(QtWidgets.QMainWindow): self.thermostat.interval_update.connect( self.autotuners.update_sampling_interval ) + 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()) ) @@ -172,8 +173,6 @@ class MainWindow(QtWidgets.QMainWindow): self.conn_menu.port_set_spin.setEnabled(False) self.connect_btn.setText("Disconnect") - self._status(self.hw_rev_data) - case ThermostatConnectionState.CONNECTING: self.status_lbl.setText("Connecting...") self.connect_btn.setText("Stop")