From f887413d827b848c1d1a085177f50a93f8101a03 Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 22 Aug 2024 17:11:56 +0800 Subject: [PATCH] conneting --- pytec/tec_qt.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index ec63cad..5c31b51 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -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) )