forked from M-Labs/thermostat
Move sigActivatedHandle to CtrlPanel
This commit is contained in:
parent
bd6adf9526
commit
d3df467017
@ -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
|
||||
|
@ -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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user