From ba369c880ef0a702428eb3d50a40ea47acc923dd Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 26 Aug 2024 15:22:41 +0800 Subject: [PATCH] Move sigActivatedHandle to CtrlPanel --- pytec/pytec/gui/view/ctrl_panel.py | 13 +++++++++++++ pytec/tec_qt.py | 11 ----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pytec/pytec/gui/view/ctrl_panel.py b/pytec/pytec/gui/view/ctrl_panel.py index 3de91d6..966ecb4 100644 --- a/pytec/pytec/gui/view/ctrl_panel.py +++ b/pytec/pytec/gui/view/ctrl_panel.py @@ -5,6 +5,7 @@ from pyqtgraph.parametertree import ( registerParameterType, ) from qasync import asyncSlot +from functools import partial class MutexParameter(pTypes.ListParameter): @@ -83,9 +84,21 @@ class CtrlPanel(QObject): self.params[i].setValue = self._setValue self.params[i].sigTreeStateChanged.connect(self.send_command) + self.params[i].child("Save to flash").sigActivated.connect( + partial(self.thermostat.save_cfg, i) + ) + self.params[i].child("Load from flash").sigActivated.connect( + partial(self.thermostat.load_cfg, i) + ) for handle in sigActivated_handles[i]: self.params[i].child(*handle[0]).sigActivated.connect(handle[1]) + self.thermostat.pid_update.connect(self.update_pid) + self.thermostat.report_update.connect(self.update_report) + self.thermostat.thermistor_update.connect(self.update_thermistor) + self.thermostat.pwm_update.connect(self.update_pwm) + self.thermostat.postfilter_update.connect(self.update_postfilter) + def _setValue(self, value, blockSignal=None): """ Implement 'lock' mechanism for Parameter Type diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 370cdae..8945501 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -85,8 +85,6 @@ class MainWindow(QtWidgets.QMainWindow): param_tree_sigActivated_handles = [ [ - [["Save to flash"], partial(self.thermostat.save_cfg, ch)], - [["Load from flash"], partial(self.thermostat.load_cfg, ch)], [ ["PID Config", "PID Auto Tune", "Run"], partial(self.pid_auto_tune_request, ch), @@ -112,17 +110,8 @@ class MainWindow(QtWidgets.QMainWindow): ) self.thermostat.fan_update.connect(self.fan_update) - self.thermostat.report_update.connect(self.ctrl_panel_view.update_report) self.thermostat.report_update.connect(self.autotuners.tick) self.thermostat.report_update.connect(self.pid_autotune_handler) - self.thermostat.pid_update.connect(self.ctrl_panel_view.update_pid) - self.thermostat.pwm_update.connect(self.ctrl_panel_view.update_pwm) - self.thermostat.thermistor_update.connect( - self.ctrl_panel_view.update_thermistor - ) - self.thermostat.postfilter_update.connect( - self.ctrl_panel_view.update_postfilter - ) self.thermostat.interval_update.connect( self.autotuners.update_sampling_interval )