This commit is contained in:
atse 2024-08-23 13:10:51 +08:00
parent e3701ece99
commit 70aee95914

View File

@ -256,12 +256,13 @@ class MainWindow(QtWidgets.QMainWindow):
@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()):
host = self.conn_menu.host_set_line.text()
port = self.conn_menu.port_set_spin.value()
await self._on_connection_changed(ThermostatConnectionState.CONNECTING) await self._on_connection_changed(ThermostatConnectionState.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=self.conn_menu.host_set_line.text(),
port=self.conn_menu.port_set_spin.value(),
)
) )
try: try:
await self._connecting_task await self._connecting_task