From c8b3bc9c0f948e9ea5028ff96e4d107d32bd02ae 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 f0be92d..ce67931 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -114,6 +114,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()) ) @@ -163,8 +164,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")