From fae9122ad5532d51f648e50fd4ac94ede13b0212 Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 9 Sep 2024 15:06:22 +0800 Subject: [PATCH] Sensible names for views --- ...onn_menu.py => connection_details_menu.py} | 2 +- ...rl_menu.py => thermostat_settings_menu.py} | 2 +- ...warning.py => zero_limits_warning_view.py} | 0 pytec/tec_qt.py | 26 ++++++++++--------- 4 files changed, 16 insertions(+), 14 deletions(-) rename pytec/pytec/gui/view/{conn_menu.py => connection_details_menu.py} (98%) rename pytec/pytec/gui/view/{thermostat_ctrl_menu.py => thermostat_settings_menu.py} (99%) rename pytec/pytec/gui/view/{zero_limits_warning.py => zero_limits_warning_view.py} (100%) diff --git a/pytec/pytec/gui/view/conn_menu.py b/pytec/pytec/gui/view/connection_details_menu.py similarity index 98% rename from pytec/pytec/gui/view/conn_menu.py rename to pytec/pytec/gui/view/connection_details_menu.py index d815740..3f321da 100644 --- a/pytec/pytec/gui/view/conn_menu.py +++ b/pytec/pytec/gui/view/connection_details_menu.py @@ -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 diff --git a/pytec/pytec/gui/view/thermostat_ctrl_menu.py b/pytec/pytec/gui/view/thermostat_settings_menu.py similarity index 99% rename from pytec/pytec/gui/view/thermostat_ctrl_menu.py rename to pytec/pytec/gui/view/thermostat_settings_menu.py index 9cdf8f2..8848fb0 100644 --- a/pytec/pytec/gui/view/thermostat_ctrl_menu.py +++ b/pytec/pytec/gui/view/thermostat_settings_menu.py @@ -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 diff --git a/pytec/pytec/gui/view/zero_limits_warning.py b/pytec/pytec/gui/view/zero_limits_warning_view.py similarity index 100% rename from pytec/pytec/gui/view/zero_limits_warning.py rename to pytec/pytec/gui/view/zero_limits_warning_view.py diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 034396d..fcabb7f 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -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()