From 6014dce1581505dc745ea0955aa87aa3b49cb35f Mon Sep 17 00:00:00 2001 From: atse Date: Fri, 25 Aug 2023 23:44:01 +0800 Subject: [PATCH] Try triggering on show --- pytec/tec_qt.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 85cc3cc..2190956 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -58,7 +58,11 @@ class MutexParameter(pTypes.ListParameter): for param in self.children(): param.hide() - self._get_param_from_value(value.value()).show() + child_to_show = self._get_param_from_value(value.value()) + child_to_show.show() + + if child_to_show.opts.get('triggerOnShow', None): + child_to_show.sigValueChanged.emit(child_to_show, child_to_show.value()) registerParameterType('mutex', MutexParameter) @@ -162,7 +166,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): {'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [ {'name': 'Control Method', 'type': 'mutex', 'limits': {'Current Setpoint': False, 'Temperature PID': True}, 'commands': [f'pwm {ch} pid'], 'children': [ - {'name': 'Constant Current', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (-3, 3), 'siPrefix': True, + {'name': 'Constant Current', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (-3, 3), 'siPrefix': True, 'triggerOnShow': True, 'suffix': 'A', 'param': [('pwm', ch, 'i_set')]}, {'name': 'Set Temperature', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-273, 300), 'siPrefix': True, 'suffix': '°C', 'param': [('pid', ch, 'target')]}, @@ -629,7 +633,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): if pid_enabled: getattr(self, f'ch{ch}_t_line').setValue(inner_param.child('Set Temperature').value()) else: - await self.client.set_param('pwm', ch, 'i_set', inner_param.child('Constant Current').value()) return case 'Set Temperature': getattr(self, f'ch{ch}_t_line').setValue(data)