Fix updating status label for hwrev = None

This commit is contained in:
atse 2024-08-27 10:40:06 +08:00
parent 3283b126b8
commit 5f30f12875
2 changed files with 2 additions and 3 deletions

View File

@ -39,8 +39,8 @@ class Thermostat(QObject, metaclass=PropertyMeta):
async def start_session(self, host, port): async def start_session(self, host, port):
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTING) self.connection_state_changed.emit(ThermostatConnectionState.CONNECTING)
await self._client.connect(host, port) await self._client.connect(host, port)
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED)
hw_rev_data = await self.get_hw_rev() hw_rev_data = await self.get_hw_rev()
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED)
self.start_watching() self.start_watching()
return hw_rev_data return hw_rev_data

View File

@ -114,6 +114,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.thermostat.interval_update.connect( self.thermostat.interval_update.connect(
self.autotuners.update_sampling_interval self.autotuners.update_sampling_interval
) )
self.thermostat.hw_rev_update.connect(self._status)
self.report_apply_btn.clicked.connect( self.report_apply_btn.clicked.connect(
lambda: self.thermostat.set_update_s(self.report_refresh_spin.value()) 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.conn_menu.port_set_spin.setEnabled(False)
self.connect_btn.setText("Disconnect") self.connect_btn.setText("Disconnect")
self._status(self.hw_rev_data)
case ThermostatConnectionState.CONNECTING: case ThermostatConnectionState.CONNECTING:
self.status_lbl.setText("Connecting...") self.status_lbl.setText("Connecting...")
self.connect_btn.setText("Stop") self.connect_btn.setText("Stop")