forked from M-Labs/thermostat
conneting
This commit is contained in:
parent
388c914c18
commit
71f40027f5
@ -239,17 +239,19 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
except:
|
||||
pass
|
||||
|
||||
def _connecting(self):
|
||||
self.status_lbl.setText("Connecting...")
|
||||
self.connect_btn.setText("Stop")
|
||||
self.conn_menu.host_set_line.setEnabled(False)
|
||||
self.conn_menu.port_set_spin.setEnabled(False)
|
||||
|
||||
@asyncSlot()
|
||||
async def on_connect_btn_clicked(self):
|
||||
if (self._connecting_task is None) and (not self.thermostat.connected()):
|
||||
self.status_lbl.setText("Connecting...")
|
||||
self.connect_btn.setText("Stop")
|
||||
self.conn_menu.host_set_line.setEnabled(False)
|
||||
self.conn_menu.port_set_spin.setEnabled(False)
|
||||
|
||||
host = self.conn_menu.host_set_line.text()
|
||||
port = self.conn_menu.port_set_spin.value()
|
||||
|
||||
self._connecting()
|
||||
self._connecting_task = asyncio.create_task(
|
||||
self.thermostat.start_session(host=host, port=port)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user