Make connection loss handling more elegant

Show an info box on connection lost informing the user that the
Thermostat was forcefully disconnected.
This commit is contained in:
atse 2024-06-20 15:25:04 +08:00
parent ddd4ea9958
commit b587a72345

View File

@ -64,7 +64,15 @@ class MainWindow(QtWidgets.QMainWindow):
self.info_box = InfoBox()
self.client = WrappedClient(self)
self.client.connection_error.connect(self.bail)
def handle_connection_error():
self.info_box.display_info_box(
"Connection Error", "Thermostat connection lost. Is it unplugged?"
)
self.bail()
self.client.connection_error.connect(handle_connection_error)
self.thermostat = Thermostat(
self, self.client, self.report_refresh_spin.value()