From d3df467017a59508338fbde2794bf0d1c65f0c4b 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 49d891b..951588c 100644 --- a/pytec/pytec/gui/view/ctrl_panel.py +++ b/pytec/pytec/gui/view/ctrl_panel.py @@ -6,6 +6,7 @@ from pyqtgraph.parametertree import ( registerParameterType, ) from qasync import asyncSlot +from functools import partial class MutexParameter(pTypes.ListParameter): @@ -84,9 +85,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 24f186c..e27efe1 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -83,8 +83,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), @@ -110,17 +108,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 )