forked from M-Labs/thermostat
Lock connection details while connecting
Fix connect button behaviour
This commit is contained in:
parent
ad5e36beab
commit
1fd49360d0
@ -148,8 +148,14 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
try:
|
||||
if self.tec_client is None:
|
||||
self.status_lbl.setText("Connecting...")
|
||||
self.ip_set_line.setEnabled(False)
|
||||
self.port_set_spin.setEnabled(False)
|
||||
self.connect_btn.setEnabled(False)
|
||||
|
||||
self.tec_client = Client()
|
||||
await self.tec_client.connect(host=ip, port=port, timeout=30)
|
||||
|
||||
self.connect_btn.setEnabled(True)
|
||||
self._on_connection_changed(True)
|
||||
self._hw_rev(await self.tec_client.hw_rev())
|
||||
self.fan_update(await self.tec_client.fan())
|
||||
@ -171,6 +177,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
except Exception as e:
|
||||
logging.error(f"Failed communicating to the {ip}:{port}: {e}")
|
||||
self._on_connection_changed(False)
|
||||
self.connect_btn.setEnabled(True)
|
||||
|
||||
|
||||
async def coro_main():
|
||||
|
Loading…
Reference in New Issue
Block a user