From 70aee9591431fa1d4e7f2b40f296970f621d0cfd Mon Sep 17 00:00:00 2001 From: atse Date: Fri, 23 Aug 2024 13:10:51 +0800 Subject: [PATCH] Compact --- pytec/tec_qt.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index b08e680..b031fe3 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -256,12 +256,13 @@ class MainWindow(QtWidgets.QMainWindow): @asyncSlot() async def on_connect_btn_clicked(self): 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) + 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: await self._connecting_task