diff --git a/pytec/model/thermostat.py b/pytec/model/thermostat.py index d1a47aa..08e7429 100644 --- a/pytec/model/thermostat.py +++ b/pytec/model/thermostat.py @@ -13,7 +13,6 @@ class WrappedClient(QObject, Client): try: return await super()._read_line() except (Exception, TimeoutError, asyncio.exceptions.TimeoutError): - logging.error("Client connection error, disconnecting", exc_info=True) self.connection_error.emit() diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 126674b..41318fe 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -69,7 +69,14 @@ class MainWindow(QtWidgets.QMainWindow): self.info_box = InfoBox() self.client = WrappedClient(self) - self.client.connection_error.connect(self.bail) + + def handle_connection_error(): + logging.error("Client connection error, disconnecting") + self.info_box.display_info_box("Connection Error", "Thermostat disconnected. Is it unplugged?") + + self.bail() + + self.client.connection_error.connect(handle_connection_error) self.thermostat = Thermostat( self, self.client, self.report_refresh_spin.value()