conneting

This commit is contained in:
atse 2024-08-22 17:11:56 +08:00
parent 388c914c18
commit 71f40027f5

View File

@ -239,17 +239,19 @@ class MainWindow(QtWidgets.QMainWindow):
except: except:
pass 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() @asyncSlot()
async def on_connect_btn_clicked(self): async def on_connect_btn_clicked(self):
if (self._connecting_task is None) and (not self.thermostat.connected()): 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() host = self.conn_menu.host_set_line.text()
port = self.conn_menu.port_set_spin.value() port = self.conn_menu.port_set_spin.value()
self._connecting()
self._connecting_task = asyncio.create_task( self._connecting_task = asyncio.create_task(
self.thermostat.start_session(host=host, port=port) self.thermostat.start_session(host=host, port=port)
) )