forked from M-Labs/thermostat
Sensible names for views
This commit is contained in:
parent
28a76d091d
commit
fae9122ad5
@ -3,7 +3,7 @@ from PyQt6.QtCore import pyqtSlot
|
||||
from pytec.gui.model.thermostat import ThermostatConnectionState
|
||||
|
||||
|
||||
class ConnMenu(QtWidgets.QMenu):
|
||||
class ConnectionDetailsMenu(QtWidgets.QMenu):
|
||||
def __init__(self, thermostat, connect_btn):
|
||||
super().__init__()
|
||||
self._thermostat = thermostat
|
@ -6,7 +6,7 @@ from pytec.gui.view.net_settings_input_diag import NetSettingsInputDiag
|
||||
from pytec.gui.model.thermostat import ThermostatConnectionState
|
||||
|
||||
|
||||
class ThermostatCtrlMenu(QtWidgets.QMenu):
|
||||
class ThermostatSettingsMenu(QtWidgets.QMenu):
|
||||
def __init__(self, thermostat, info_box, style):
|
||||
super().__init__()
|
||||
self._thermostat = thermostat
|
@ -1,6 +1,6 @@
|
||||
from pytec.gui.view.zero_limits_warning import ZeroLimitsWarningView
|
||||
from pytec.gui.view.thermostat_ctrl_menu import ThermostatCtrlMenu
|
||||
from pytec.gui.view.conn_menu import ConnMenu
|
||||
from pytec.gui.view.zero_limits_warning_view import ZeroLimitsWarningView
|
||||
from pytec.gui.view.thermostat_settings_menu import ThermostatSettingsMenu
|
||||
from pytec.gui.view.connection_details_menu import ConnectionDetailsMenu
|
||||
from pytec.gui.view.plot_options_menu import PlotOptionsMenu
|
||||
from pytec.gui.view.live_plot_view import LiveDataPlotter
|
||||
from pytec.gui.view.ctrl_panel import CtrlPanel
|
||||
@ -107,19 +107,21 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
)
|
||||
|
||||
# Bottom bar menus
|
||||
self.conn_menu = ConnMenu(self._thermostat, self.connect_btn)
|
||||
self.connect_btn.setMenu(self.conn_menu)
|
||||
self.connection_details_menu = ConnectionDetailsMenu(
|
||||
self._thermostat, self.connect_btn
|
||||
)
|
||||
self.connect_btn.setMenu(self.connection_details_menu)
|
||||
|
||||
self._thermostat_ctrl_menu = ThermostatCtrlMenu(
|
||||
self._thermostat_settings_menu = ThermostatSettingsMenu(
|
||||
self._thermostat, self._info_box, self.style()
|
||||
)
|
||||
self.thermostat_settings.setMenu(self._thermostat_ctrl_menu)
|
||||
self.thermostat_settings.setMenu(self._thermostat_settings_menu)
|
||||
|
||||
self._plot_options_menu = PlotOptionsMenu(self._channel_graphs)
|
||||
self.plot_settings.setMenu(self._plot_options_menu)
|
||||
|
||||
# Status line
|
||||
self._zero_limits_warning = ZeroLimitsWarningView(
|
||||
self._zero_limits_warning_view = ZeroLimitsWarningView(
|
||||
self._thermostat, self.style(), self.limits_warning
|
||||
)
|
||||
self.loading_spinner.hide()
|
||||
@ -189,8 +191,8 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
case ThermostatConnectionState.DISCONNECTED:
|
||||
self._connecting_task = asyncio.create_task(
|
||||
self._thermostat.start_session(
|
||||
host=self.conn_menu.host_set_line.text(),
|
||||
port=self.conn_menu.port_set_spin.value(),
|
||||
host=self.connection_details_menu.host_set_line.text(),
|
||||
port=self.connection_details_menu.port_set_spin.value(),
|
||||
)
|
||||
)
|
||||
self._thermostat.connection_state = ThermostatConnectionState.CONNECTING
|
||||
@ -234,9 +236,9 @@ async def coro_main():
|
||||
|
||||
if args.connect:
|
||||
if args.HOST:
|
||||
main_window.conn_menu.host_set_line.setText(args.HOST)
|
||||
main_window.connection_details_menu.host_set_line.setText(args.HOST)
|
||||
if args.PORT:
|
||||
main_window.conn_menu.port_set_spin.setValue(int(args.PORT))
|
||||
main_window.connection_details_menu.port_set_spin.setValue(int(args.PORT))
|
||||
main_window.connect_btn.click()
|
||||
|
||||
await app_quit_event.wait()
|
||||
|
Loading…
Reference in New Issue
Block a user