This commit is contained in:
atse 2024-08-28 11:06:26 +08:00
parent 6e357c14e2
commit 46831917ba

View File

@ -63,15 +63,16 @@ class MainWindow(QtWidgets.QMainWindow):
self.thermostat = Thermostat(self, self.report_refresh_spin.value())
self._connecting_task = None
def handle_connection_error():
@asyncSlot()
async def handle_connection_error():
self.info_box.display_info_box(
"Connection Error", "Thermostat connection lost. Is it unplugged?"
)
await self.thermostat.end_session()
self.thermostat.connection_error.connect(handle_connection_error)
self.thermostat.connection_error.connect(self.thermostat.timed_out)
self.thermostat.connection_error.connect(self.thermostat.end_session)
self.thermostat.connection_state_changed.connect(self._on_connection_changed)