From bc4ac43e0b5bc3d6c3e21f2cf752ce7b29bb994c Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 20 Jun 2024 12:07:19 +0800 Subject: [PATCH 01/10] Put comments in right place --- pytec/tec_qt.py | 4 ++-- pytec/view/live_plot_view.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 4acd26d..317a176 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -213,8 +213,8 @@ class MainWindow(QtWidgets.QMainWindow): return with QSignalBlocker(self.thermostat_ctrl_menu.fan_power_slider): self.thermostat_ctrl_menu.fan_power_slider.setValue( - fan_settings["fan_pwm"] or 100 - ) # 0 = PWM off = full strength + fan_settings["fan_pwm"] or 100 # 0 = PWM off = full strength + ) with QSignalBlocker(self.thermostat_ctrl_menu.fan_auto_box): self.thermostat_ctrl_menu.fan_auto_box.setChecked(fan_settings["auto_mode"]) if not self.hw_rev_data["settings"]["fan_pwm_recommended"]: diff --git a/pytec/view/live_plot_view.py b/pytec/view/live_plot_view.py index e9ea57a..a4771fd 100644 --- a/pytec/view/live_plot_view.py +++ b/pytec/view/live_plot_view.py @@ -66,9 +66,10 @@ class _TecGraphs: self._t_line = self._t_widget.getPlotItem().addLine(label="{value} °C") self._t_line.setVisible(False) + # Hack for keeping setpoint line in plot range self._t_setpoint_plot = ( LiveLinePlot() - ) # Hack for keeping setpoint line in plot range + ) for graph in t_widget, i_widget: time_axis = LiveAxis( @@ -83,8 +84,8 @@ class _TecGraphs: # Enable linking of axes in the graph widget's context menu graph.register( - graph.getPlotItem().titleLabel.text - ) # Slight hack getting the title + graph.getPlotItem().titleLabel.text # Slight hack getting the title + ) temperature_axis = LiveAxis("left", text="Temperature", units="°C") temperature_axis.showLabel() From a16d2e9a9e7c1a987a6c99240070dfa94030d88f Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 20 Jun 2024 17:08:07 +0800 Subject: [PATCH 02/10] Follow CapWords convention for class names Re: PEP8 --- pytec/tec_qt.py | 28 +++++++++++++-------------- pytec/view/conn_menu.py | 2 +- pytec/view/ctrl_panel.py | 2 +- pytec/view/info_box.py | 2 +- pytec/view/net_settings_input_diag.py | 2 +- pytec/view/plot_options_menu.py | 2 +- pytec/view/thermostat_ctrl_menu.py | 2 +- pytec/view/zero_limits_warning.py | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 317a176..fbbde13 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -1,11 +1,11 @@ -from view.zero_limits_warning import zero_limits_warning_view -from view.net_settings_input_diag import net_settings_input_diag -from view.thermostat_ctrl_menu import thermostat_ctrl_menu -from view.conn_menu import conn_menu -from view.plot_options_menu import plot_options_menu +from view.zero_limits_warning import ZeroLimitsWarningView +from view.net_settings_input_diag import NetSettingsInputDiag +from view.thermostat_ctrl_menu import ThermostatCtrlMenu +from view.conn_menu import ConnMenu +from view.plot_options_menu import PlotOptionsMenu from view.live_plot_view import LiveDataPlotter -from view.ctrl_panel import ctrl_panel -from view.info_box import info_box +from view.ctrl_panel import CtrlPanel +from view.info_box import InfoBox from model.pid_autotuner import PIDAutoTuner from model.thermostat_data_model import WrappedClient, Thermostat import json @@ -66,7 +66,7 @@ class MainWindow(QtWidgets.QMainWindow): self.show() self.hw_rev_data = None - self.info_box = info_box() + self.info_box = InfoBox() self.client = WrappedClient(self) self.client.connection_error.connect(self.bail) @@ -94,10 +94,10 @@ class MainWindow(QtWidgets.QMainWindow): ] self.thermostat.info_box_trigger.connect(self.info_box.display_info_box) - self.zero_limits_warning = zero_limits_warning_view( + self.zero_limits_warning = ZeroLimitsWarningView( self.style(), self.limits_warning ) - self.ctrl_panel_view = ctrl_panel( + self.ctrl_panel_view = CtrlPanel( [self.ch0_tree, self.ch1_tree], get_ctrl_panel_config(args), self.send_command, @@ -136,17 +136,17 @@ class MainWindow(QtWidgets.QMainWindow): self.thermostat.report_update.connect(self.channel_graphs.update_report) self.thermostat.pid_update.connect(self.channel_graphs.update_pid) - self.plot_options_menu = plot_options_menu() + self.plot_options_menu = PlotOptionsMenu() self.plot_options_menu.clear.triggered.connect(self.clear_graphs) self.plot_options_menu.samples_spinbox.valueChanged.connect( self.channel_graphs.set_max_samples ) self.plot_settings.setMenu(self.plot_options_menu) - self.conn_menu = conn_menu() + self.conn_menu = ConnMenu() self.connect_btn.setMenu(self.conn_menu) - self.thermostat_ctrl_menu = thermostat_ctrl_menu(self.style()) + self.thermostat_ctrl_menu = ThermostatCtrlMenu(self.style()) self.thermostat_ctrl_menu.fan_set_act.connect(self.fan_set_request) self.thermostat_ctrl_menu.fan_auto_set_act.connect(self.fan_auto_set_request) self.thermostat_ctrl_menu.reset_act.connect(self.reset_request) @@ -399,7 +399,7 @@ class MainWindow(QtWidgets.QMainWindow): @asyncSlot(bool) async def net_settings_request(self, _): ipv4 = await self.thermostat.get_ipv4() - self.net_settings_input_diag = net_settings_input_diag(ipv4["addr"]) + self.net_settings_input_diag = NetSettingsInputDiag(ipv4["addr"]) self.net_settings_input_diag.set_ipv4_act.connect(self.set_net_settings_request) @asyncSlot(str) diff --git a/pytec/view/conn_menu.py b/pytec/view/conn_menu.py index 80da10c..89c9896 100644 --- a/pytec/view/conn_menu.py +++ b/pytec/view/conn_menu.py @@ -1,7 +1,7 @@ from PyQt6 import QtWidgets, QtCore -class conn_menu(QtWidgets.QMenu): +class ConnMenu(QtWidgets.QMenu): def __init__(self): super().__init__() self.setTitle("Connection Settings") diff --git a/pytec/view/ctrl_panel.py b/pytec/view/ctrl_panel.py index 9ad5a99..0c8d9d2 100644 --- a/pytec/view/ctrl_panel.py +++ b/pytec/view/ctrl_panel.py @@ -42,7 +42,7 @@ class MutexParameter(pTypes.ListParameter): registerParameterType("mutex", MutexParameter) -class ctrl_panel(QObject): +class CtrlPanel(QObject): set_zero_limits_warning_sig = pyqtSignal(list) def __init__( diff --git a/pytec/view/info_box.py b/pytec/view/info_box.py index 3d5c491..cde0591 100644 --- a/pytec/view/info_box.py +++ b/pytec/view/info_box.py @@ -2,7 +2,7 @@ from PyQt6 import QtWidgets from PyQt6.QtCore import pyqtSlot -class info_box(QtWidgets.QMessageBox): +class InfoBox(QtWidgets.QMessageBox): def __init__(self): super().__init__() self.setIcon(QtWidgets.QMessageBox.Icon.Information) diff --git a/pytec/view/net_settings_input_diag.py b/pytec/view/net_settings_input_diag.py index fb1c242..1ef4f61 100644 --- a/pytec/view/net_settings_input_diag.py +++ b/pytec/view/net_settings_input_diag.py @@ -3,7 +3,7 @@ from PyQt6.QtWidgets import QAbstractButton from PyQt6.QtCore import pyqtSignal, pyqtSlot -class net_settings_input_diag(QtWidgets.QInputDialog): +class NetSettingsInputDiag(QtWidgets.QInputDialog): set_ipv4_act = pyqtSignal(str) def __init__(self, current_ipv4_settings): diff --git a/pytec/view/plot_options_menu.py b/pytec/view/plot_options_menu.py index 427684a..7817d58 100644 --- a/pytec/view/plot_options_menu.py +++ b/pytec/view/plot_options_menu.py @@ -1,7 +1,7 @@ from PyQt6 import QtWidgets, QtGui -class plot_options_menu(QtWidgets.QMenu): +class PlotOptionsMenu(QtWidgets.QMenu): def __init__(self, max_samples=1000): super().__init__() self.setTitle("Plot Settings") diff --git a/pytec/view/thermostat_ctrl_menu.py b/pytec/view/thermostat_ctrl_menu.py index e22dfba..2ef321b 100644 --- a/pytec/view/thermostat_ctrl_menu.py +++ b/pytec/view/thermostat_ctrl_menu.py @@ -2,7 +2,7 @@ from PyQt6 import QtWidgets, QtGui, QtCore from PyQt6.QtCore import pyqtSignal, pyqtSlot -class thermostat_ctrl_menu(QtWidgets.QMenu): +class ThermostatCtrlMenu(QtWidgets.QMenu): fan_set_act = pyqtSignal(int) fan_auto_set_act = pyqtSignal(int) diff --git a/pytec/view/zero_limits_warning.py b/pytec/view/zero_limits_warning.py index 574e04d..113aef0 100644 --- a/pytec/view/zero_limits_warning.py +++ b/pytec/view/zero_limits_warning.py @@ -2,7 +2,7 @@ from PyQt6.QtCore import pyqtSlot, QObject from PyQt6 import QtWidgets, QtGui -class zero_limits_warning_view(QObject): +class ZeroLimitsWarningView(QObject): def __init__(self, style, limit_warning): super().__init__() self._lbl = limit_warning From 1707728c3cebbea3fa7894689c389660499663ab Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 20 Jun 2024 17:09:29 +0800 Subject: [PATCH 03/10] thermostat_data_model.py -> thermostat.py --- pytec/model/{thermostat_data_model.py => thermostat.py} | 0 pytec/tec_qt.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename pytec/model/{thermostat_data_model.py => thermostat.py} (100%) diff --git a/pytec/model/thermostat_data_model.py b/pytec/model/thermostat.py similarity index 100% rename from pytec/model/thermostat_data_model.py rename to pytec/model/thermostat.py diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index fbbde13..427ffc8 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -7,7 +7,7 @@ from view.live_plot_view import LiveDataPlotter from view.ctrl_panel import CtrlPanel from view.info_box import InfoBox from model.pid_autotuner import PIDAutoTuner -from model.thermostat_data_model import WrappedClient, Thermostat +from model.thermostat import WrappedClient, Thermostat import json from autotune import PIDAutotuneState from qasync import asyncSlot, asyncClose From 7069111e21fb71ef8bc50a698e01e34d31bcacce Mon Sep 17 00:00:00 2001 From: atse Date: Wed, 10 Jul 2024 15:13:18 +0800 Subject: [PATCH 04/10] Expose frontend scripts exclusively in pytec --- pytec/pyproject.toml | 2 +- pytec/setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pytec/pyproject.toml b/pytec/pyproject.toml index 73ce527..9922950 100644 --- a/pytec/pyproject.toml +++ b/pytec/pyproject.toml @@ -15,7 +15,7 @@ tec_qt = "tec_qt:main" [tool.setuptools] packages.find = {} -py-modules = ["aioexample", "autotune", "example", "plot", "tec_qt", "ui_tec_qt", "waitingspinnerwidget"] +py-modules = ["autotune", "plot", "tec_qt"] [tool.setuptools.package-data] "*" = ["*.*"] diff --git a/pytec/setup.py b/pytec/setup.py index 4ac8f58..7e3828f 100644 --- a/pytec/setup.py +++ b/pytec/setup.py @@ -14,5 +14,5 @@ setup( "tec_qt = tec_qt:main", ] }, - py_modules=['tec_qt', 'ui_tec_qt', 'autotune', 'waitingspinnerwidget'], + py_modules=['autotune', 'plot', 'tec_qt'], ) From c415d9de8acdf8fe6ce6706b5219a39601cda05a Mon Sep 17 00:00:00 2001 From: atse Date: Wed, 10 Jul 2024 15:16:21 +0800 Subject: [PATCH 05/10] Use MANIFEST.in Allows for more accurate control over included files in pytec package --- pytec/MANIFEST.in | 3 +++ pytec/pyproject.toml | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 pytec/MANIFEST.in diff --git a/pytec/MANIFEST.in b/pytec/MANIFEST.in new file mode 100644 index 0000000..2148229 --- /dev/null +++ b/pytec/MANIFEST.in @@ -0,0 +1,3 @@ +include resources/*.ico +include view/param_tree.json +include view/tec_qt.ui diff --git a/pytec/pyproject.toml b/pytec/pyproject.toml index 9922950..4af3992 100644 --- a/pytec/pyproject.toml +++ b/pytec/pyproject.toml @@ -16,6 +16,3 @@ tec_qt = "tec_qt:main" [tool.setuptools] packages.find = {} py-modules = ["autotune", "plot", "tec_qt"] - -[tool.setuptools.package-data] -"*" = ["*.*"] From 26c7382b1e8a32fcd0600425d4100bd13d74cbf4 Mon Sep 17 00:00:00 2001 From: atse Date: Wed, 10 Jul 2024 14:52:09 +0800 Subject: [PATCH 06/10] Move GUI components and examples into folder For better organisation --- pytec/MANIFEST.in | 7 +++-- pytec/{ => examples}/aioexample.py | 0 pytec/{ => examples}/example.py | 0 pytec/{ => pytec/gui}/model/pid_autotuner.py | 0 pytec/{ => pytec/gui}/model/property.py | 0 pytec/{ => pytec/gui}/model/thermostat.py | 2 +- pytec/{ => pytec/gui}/resources/artiq.ico | Bin pytec/{ => pytec/gui}/view/conn_menu.py | 0 pytec/{ => pytec/gui}/view/ctrl_panel.py | 0 pytec/{ => pytec/gui}/view/info_box.py | 0 pytec/{ => pytec/gui}/view/live_plot_view.py | 0 .../gui}/view/net_settings_input_diag.py | 0 pytec/{ => pytec/gui}/view/param_tree.json | 0 .../{ => pytec/gui}/view/plot_options_menu.py | 0 pytec/{ => pytec/gui}/view/tec_qt.ui | 2 +- .../gui}/view/thermostat_ctrl_menu.py | 0 .../gui}/view/waitingspinnerwidget.py | 0 .../gui}/view/zero_limits_warning.py | 0 pytec/tec_qt.py | 26 +++++++++--------- 19 files changed, 19 insertions(+), 18 deletions(-) rename pytec/{ => examples}/aioexample.py (100%) rename pytec/{ => examples}/example.py (100%) rename pytec/{ => pytec/gui}/model/pid_autotuner.py (100%) rename pytec/{ => pytec/gui}/model/property.py (100%) rename pytec/{ => pytec/gui}/model/thermostat.py (98%) rename pytec/{ => pytec/gui}/resources/artiq.ico (100%) rename pytec/{ => pytec/gui}/view/conn_menu.py (100%) rename pytec/{ => pytec/gui}/view/ctrl_panel.py (100%) rename pytec/{ => pytec/gui}/view/info_box.py (100%) rename pytec/{ => pytec/gui}/view/live_plot_view.py (100%) rename pytec/{ => pytec/gui}/view/net_settings_input_diag.py (100%) rename pytec/{ => pytec/gui}/view/param_tree.json (100%) rename pytec/{ => pytec/gui}/view/plot_options_menu.py (100%) rename pytec/{ => pytec/gui}/view/tec_qt.ui (99%) rename pytec/{ => pytec/gui}/view/thermostat_ctrl_menu.py (100%) rename pytec/{ => pytec/gui}/view/waitingspinnerwidget.py (100%) rename pytec/{ => pytec/gui}/view/zero_limits_warning.py (100%) diff --git a/pytec/MANIFEST.in b/pytec/MANIFEST.in index 2148229..5be0b39 100644 --- a/pytec/MANIFEST.in +++ b/pytec/MANIFEST.in @@ -1,3 +1,4 @@ -include resources/*.ico -include view/param_tree.json -include view/tec_qt.ui +graft examples +include pytec/gui/resources/artiq.ico +include pytec/gui/view/param_tree.json +include pytec/gui/view/tec_qt.ui diff --git a/pytec/aioexample.py b/pytec/examples/aioexample.py similarity index 100% rename from pytec/aioexample.py rename to pytec/examples/aioexample.py diff --git a/pytec/example.py b/pytec/examples/example.py similarity index 100% rename from pytec/example.py rename to pytec/examples/example.py diff --git a/pytec/model/pid_autotuner.py b/pytec/pytec/gui/model/pid_autotuner.py similarity index 100% rename from pytec/model/pid_autotuner.py rename to pytec/pytec/gui/model/pid_autotuner.py diff --git a/pytec/model/property.py b/pytec/pytec/gui/model/property.py similarity index 100% rename from pytec/model/property.py rename to pytec/pytec/gui/model/property.py diff --git a/pytec/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py similarity index 98% rename from pytec/model/thermostat.py rename to pytec/pytec/gui/model/thermostat.py index d1a47aa..25246d5 100644 --- a/pytec/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -1,7 +1,7 @@ from pytec.aioclient import Client from PyQt6.QtCore import pyqtSignal, QObject, pyqtSlot from qasync import asyncSlot -from model.property import Property, PropertyMeta +from pytec.gui.model.property import Property, PropertyMeta import asyncio import logging diff --git a/pytec/resources/artiq.ico b/pytec/pytec/gui/resources/artiq.ico similarity index 100% rename from pytec/resources/artiq.ico rename to pytec/pytec/gui/resources/artiq.ico diff --git a/pytec/view/conn_menu.py b/pytec/pytec/gui/view/conn_menu.py similarity index 100% rename from pytec/view/conn_menu.py rename to pytec/pytec/gui/view/conn_menu.py diff --git a/pytec/view/ctrl_panel.py b/pytec/pytec/gui/view/ctrl_panel.py similarity index 100% rename from pytec/view/ctrl_panel.py rename to pytec/pytec/gui/view/ctrl_panel.py diff --git a/pytec/view/info_box.py b/pytec/pytec/gui/view/info_box.py similarity index 100% rename from pytec/view/info_box.py rename to pytec/pytec/gui/view/info_box.py diff --git a/pytec/view/live_plot_view.py b/pytec/pytec/gui/view/live_plot_view.py similarity index 100% rename from pytec/view/live_plot_view.py rename to pytec/pytec/gui/view/live_plot_view.py diff --git a/pytec/view/net_settings_input_diag.py b/pytec/pytec/gui/view/net_settings_input_diag.py similarity index 100% rename from pytec/view/net_settings_input_diag.py rename to pytec/pytec/gui/view/net_settings_input_diag.py diff --git a/pytec/view/param_tree.json b/pytec/pytec/gui/view/param_tree.json similarity index 100% rename from pytec/view/param_tree.json rename to pytec/pytec/gui/view/param_tree.json diff --git a/pytec/view/plot_options_menu.py b/pytec/pytec/gui/view/plot_options_menu.py similarity index 100% rename from pytec/view/plot_options_menu.py rename to pytec/pytec/gui/view/plot_options_menu.py diff --git a/pytec/view/tec_qt.ui b/pytec/pytec/gui/view/tec_qt.ui similarity index 99% rename from pytec/view/tec_qt.ui rename to pytec/pytec/gui/view/tec_qt.ui index c7d8b35..8b20fd9 100644 --- a/pytec/view/tec_qt.ui +++ b/pytec/pytec/gui/view/tec_qt.ui @@ -588,7 +588,7 @@ QtWaitingSpinner QWidget -
view.waitingspinnerwidget
+
pytec.gui.view.waitingspinnerwidget
1
diff --git a/pytec/view/thermostat_ctrl_menu.py b/pytec/pytec/gui/view/thermostat_ctrl_menu.py similarity index 100% rename from pytec/view/thermostat_ctrl_menu.py rename to pytec/pytec/gui/view/thermostat_ctrl_menu.py diff --git a/pytec/view/waitingspinnerwidget.py b/pytec/pytec/gui/view/waitingspinnerwidget.py similarity index 100% rename from pytec/view/waitingspinnerwidget.py rename to pytec/pytec/gui/view/waitingspinnerwidget.py diff --git a/pytec/view/zero_limits_warning.py b/pytec/pytec/gui/view/zero_limits_warning.py similarity index 100% rename from pytec/view/zero_limits_warning.py rename to pytec/pytec/gui/view/zero_limits_warning.py diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 427ffc8..dbc967c 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -1,13 +1,13 @@ -from view.zero_limits_warning import ZeroLimitsWarningView -from view.net_settings_input_diag import NetSettingsInputDiag -from view.thermostat_ctrl_menu import ThermostatCtrlMenu -from view.conn_menu import ConnMenu -from view.plot_options_menu import PlotOptionsMenu -from view.live_plot_view import LiveDataPlotter -from view.ctrl_panel import CtrlPanel -from view.info_box import InfoBox -from model.pid_autotuner import PIDAutoTuner -from model.thermostat import WrappedClient, Thermostat +from pytec.gui.view.zero_limits_warning import ZeroLimitsWarningView +from pytec.gui.view.net_settings_input_diag import NetSettingsInputDiag +from pytec.gui.view.thermostat_ctrl_menu import ThermostatCtrlMenu +from pytec.gui.view.conn_menu import ConnMenu +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 +from pytec.gui.view.info_box import InfoBox +from pytec.gui.model.pid_autotuner import PIDAutoTuner +from pytec.gui.model.thermostat import WrappedClient, Thermostat import json from autotune import PIDAutotuneState from qasync import asyncSlot, asyncClose @@ -47,7 +47,7 @@ def get_argparser(): parser.add_argument( "-p", "--param_tree", - default=importlib.resources.files("view").joinpath("param_tree.json"), + default=importlib.resources.files("pytec.gui.view").joinpath("param_tree.json"), help="Param Tree Description JSON File", ) @@ -60,7 +60,7 @@ class MainWindow(QtWidgets.QMainWindow): def __init__(self, args): super(MainWindow, self).__init__() - ui_file_path = importlib.resources.files("view").joinpath("tec_qt.ui") + ui_file_path = importlib.resources.files("pytec.gui.view").joinpath("tec_qt.ui") uic.loadUi(ui_file_path, self) self.show() @@ -419,7 +419,7 @@ async def coro_main(): app = QtWidgets.QApplication.instance() app.aboutToQuit.connect(app_quit_event.set) app.setWindowIcon( - QtGui.QIcon(str(importlib.resources.files("resources").joinpath("artiq.ico"))) + QtGui.QIcon(str(importlib.resources.files("pytec.gui.resources").joinpath("artiq.ico"))) ) main_window = MainWindow(args) From 70db0a39eb599c2074efd7f17a8f56fbaf61a489 Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 8 Jul 2024 12:33:45 +0800 Subject: [PATCH 07/10] Remove duplicated antialias config option Already set in live_plot_view.py --- pytec/tec_qt.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index dbc967c..8402c56 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -23,9 +23,6 @@ from functools import partial import importlib.resources -pg.setConfigOptions(antialias=True) - - def get_argparser(): parser = argparse.ArgumentParser(description="Thermostat Control Panel") From 271fe449baf391dbab85d3a889be075693cd36b1 Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 8 Jul 2024 13:22:53 +0800 Subject: [PATCH 08/10] Remove duplicated show call MainWindow.show() already called in coro_main --- pytec/tec_qt.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 8402c56..e2d5312 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -60,8 +60,6 @@ class MainWindow(QtWidgets.QMainWindow): ui_file_path = importlib.resources.files("pytec.gui.view").joinpath("tec_qt.ui") uic.loadUi(ui_file_path, self) - self.show() - self.hw_rev_data = None self.info_box = InfoBox() From e6f62e9e19cf1cd37a5ef4aa554832c04b351ab4 Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 20 Jun 2024 12:29:05 +0800 Subject: [PATCH 09/10] flake: sha256 -> hash --- flake.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 824bf39..9056fa9 100644 --- a/flake.nix +++ b/flake.nix @@ -62,7 +62,7 @@ format = "pyproject"; src = pkgs.fetchPypi { inherit pname version; - sha256 = "sha256-jcdo/R7l3hBEx8MF7M8tOdJNh4A+pxGJ1AJPtHX0mF8="; + hash = "sha256-jcdo/R7l3hBEx8MF7M8tOdJNh4A+pxGJ1AJPtHX0mF8="; }; buildInputs = [ pkgs.python3Packages.poetry-core ]; propagatedBuildInputs = [ pkgs.python3Packages.pyqt6 ]; @@ -74,7 +74,7 @@ format = "pyproject"; src = pkgs.fetchPypi { inherit pname version; - sha256 = "sha256-WBCNhBHHBU4IQdi3ke6F4QH8KWubNZwOAd3jipj/Ks4="; + hash = "sha256-WBCNhBHHBU4IQdi3ke6F4QH8KWubNZwOAd3jipj/Ks4="; }; propagatedBuildInputs = with pkgs.python3Packages; [ numpy pyqt6 ]; }; @@ -85,7 +85,7 @@ format = "pyproject"; src = pkgs.fetchPypi { inherit pname version; - sha256 = "sha256-jqj8X6H1N5mJQ4OrY5ANqRB0YJByqg/bNneEALWmH1A="; + hash = "sha256-jqj8X6H1N5mJQ4OrY5ANqRB0YJByqg/bNneEALWmH1A="; }; buildInputs = [ pkgs.python3Packages.poetry-core ]; propagatedBuildInputs = [ pyqtgraph pkgs.python3Packages.numpy ]; From 44bea87f0385014e82b2bbeb4c343ca8d98b9e1f Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 8 Jul 2024 11:54:44 +0800 Subject: [PATCH 10/10] Thermostat.disconnect -> Thermostat.end_session QObject already has a disconnect method, avoid overriding it. --- pytec/pytec/gui/model/thermostat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 25246d5..4f2c195 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -104,7 +104,7 @@ class Thermostat(QObject, metaclass=PropertyMeta): self.report[i]["interval"] for i in range(len(self.report)) ] - async def disconnect(self): + async def end_session(self): await self._client.end_session() async def set_ipv4(self, ipv4):