forked from M-Labs/thermostat
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:
parent
ddd4ea9958
commit
b587a72345
@ -64,7 +64,15 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.info_box = InfoBox()
|
self.info_box = InfoBox()
|
||||||
|
|
||||||
self.client = WrappedClient(self)
|
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.thermostat = Thermostat(
|
||||||
self, self.client, self.report_refresh_spin.value()
|
self, self.client, self.report_refresh_spin.value()
|
||||||
|
Loading…
Reference in New Issue
Block a user