diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index f787f12..9c730e8 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -133,13 +133,6 @@ class MainWindow(QtWidgets.QMainWindow): lambda: self.thermostat.set_update_s(self.report_refresh_spin.value()) ) - if args.connect: - if args.HOST: - self.host_set_line.setText(args.HOST) - if args.PORT: - self.port_set_spin.setValue(int(args.PORT)) - self.connect_btn.click() - @asyncSlot(ThermostatConnectionState) async def _on_connection_changed(self, state): self.graph_group.setEnabled(state == ThermostatConnectionState.CONNECTED) @@ -242,6 +235,13 @@ async def coro_main(): main_window = MainWindow(args) main_window.show() + if args.connect: + if args.HOST: + main_window.conn_menu.host_set_line.setText(args.HOST) + if args.PORT: + main_window.conn_menu.port_set_spin.setValue(int(args.PORT)) + main_window.connect_btn.click() + await app_quit_event.wait()