Unprivate conn_menu

Used for autoconnect
This commit is contained in:
atse 2024-09-09 15:00:14 +08:00
parent 9c0c6ab323
commit 28a76d091d

View File

@ -107,8 +107,8 @@ class MainWindow(QtWidgets.QMainWindow):
) )
# Bottom bar menus # Bottom bar menus
self._conn_menu = ConnMenu(self._thermostat, self.connect_btn) self.conn_menu = ConnMenu(self._thermostat, self.connect_btn)
self.connect_btn.setMenu(self._conn_menu) self.connect_btn.setMenu(self.conn_menu)
self._thermostat_ctrl_menu = ThermostatCtrlMenu( self._thermostat_ctrl_menu = ThermostatCtrlMenu(
self._thermostat, self._info_box, self.style() self._thermostat, self._info_box, self.style()
@ -189,8 +189,8 @@ class MainWindow(QtWidgets.QMainWindow):
case ThermostatConnectionState.DISCONNECTED: case ThermostatConnectionState.DISCONNECTED:
self._connecting_task = asyncio.create_task( self._connecting_task = asyncio.create_task(
self._thermostat.start_session( self._thermostat.start_session(
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._thermostat.connection_state = ThermostatConnectionState.CONNECTING self._thermostat.connection_state = ThermostatConnectionState.CONNECTING
@ -234,9 +234,9 @@ async def coro_main():
if args.connect: if args.connect:
if args.HOST: if args.HOST:
main_window._conn_menu.host_set_line.setText(args.HOST) main_window.conn_menu.host_set_line.setText(args.HOST)
if args.PORT: if args.PORT:
main_window._conn_menu.port_set_spin.setValue(int(args.PORT)) main_window.conn_menu.port_set_spin.setValue(int(args.PORT))
main_window.connect_btn.click() main_window.connect_btn.click()
await app_quit_event.wait() await app_quit_event.wait()