From dafde57e231ab2c217a0afdc125b3381af7a1e78 Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 20 Jun 2024 16:13:27 +0800 Subject: [PATCH] ctrl_panel: Add and improve tooltips and titles For users' better understanding of what the parameters do --- pytec/pytec/gui/view/ctrl_panel.py | 9 ++++++ pytec/pytec/gui/view/param_tree.json | 48 +++++++++++++++++++++------- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/pytec/pytec/gui/view/ctrl_panel.py b/pytec/pytec/gui/view/ctrl_panel.py index a728de1..560a122 100644 --- a/pytec/pytec/gui/view/ctrl_panel.py +++ b/pytec/pytec/gui/view/ctrl_panel.py @@ -42,6 +42,13 @@ class MutexParameter(pTypes.ListParameter): registerParameterType("mutex", MutexParameter) +def set_tree_label_tips(tree): + for item in tree.listAllItems(): + p = item.param + if "tip" in p.opts: + item.setToolTip(0, p.opts["tip"]) + + class CtrlPanel(QObject): set_zero_limits_warning_sig = pyqtSignal(list) @@ -79,6 +86,8 @@ class CtrlPanel(QObject): self.params[i].setValue = self._setValue self.params[i].sigTreeStateChanged.connect(sigTreeStateChanged_handle) + set_tree_label_tips(tree) + for handle in sigActivated_handles[i]: self.params[i].child(*handle[0]).sigActivated.connect(handle[1]) diff --git a/pytec/pytec/gui/view/param_tree.json b/pytec/pytec/gui/view/param_tree.json index ddd4931..572caeb 100644 --- a/pytec/pytec/gui/view/param_tree.json +++ b/pytec/pytec/gui/view/param_tree.json @@ -5,7 +5,8 @@ "title": "Temperature", "type": "float", "format": "{value:.4f} °C", - "readonly": true + "readonly": true, + "tip": "The measured temperature at the thermistor" }, { "name": "tec_i", @@ -13,13 +14,15 @@ "type": "float", "suffix": "mA", "decimals": 6, - "readonly": true + "readonly": true, + "tip": "The measured current through the TEC" }, { "name": "output", "title": "Output Settings", "expanded": true, "type": "group", + "tip": "Settings of the output to the TEC", "children": [ { "name": "control_method", @@ -33,6 +36,7 @@ "topic": "pwm", "field": "pid" }, + "tip": "Select control method of output", "children": [ { "name": "i_set", @@ -51,11 +55,12 @@ "topic": "pwm", "field": "i_set" }, + "tip": "The set current through TEC", "lock": false }, { "name": "target", - "title": "Set Temperature", + "title": "Setpoint", "type": "float", "value": 25, "step": 0.1, @@ -68,6 +73,7 @@ "topic": "pid", "field": "target" }, + "tip": "The temperature setpoint of the TEC", "lock": false } ] @@ -77,6 +83,7 @@ "title": "Limits", "expanded": true, "type": "group", + "tip": "The limits of output, with the polarity at the front panel as reference", "children": [ { "name": "max_i_pos", @@ -94,6 +101,7 @@ "topic": "pwm", "field": "max_i_pos" }, + "tip": "The maximum cooling (+ve) current through the output pins", "lock": false }, { @@ -112,11 +120,12 @@ "topic": "pwm", "field": "max_i_neg" }, + "tip": "The maximum heating (-ve) current through the output pins", "lock": false }, { "name": "max_v", - "title": "Max Voltage Difference", + "title": "Max Absolute Voltage", "type": "float", "value": 0, "step": 0.1, @@ -130,6 +139,7 @@ "topic": "pwm", "field": "max_v" }, + "tip": "The maximum voltage (in both directions) across the output pins", "lock": false } ] @@ -141,7 +151,7 @@ "title": "Thermistor Settings", "expanded": true, "type": "group", - "tip": "Settings of the connected Thermistor", + "tip": "Settings of the connected thermistor\n- Parameters for the resistance to temperature conversion (with the B-Parameter equation)\n- Settings for the 50/60 Hz filter with the thermistor", "children": [ { "name": "t0", @@ -158,6 +168,7 @@ "topic": "s-h", "field": "t0" }, + "tip": "The base temperature", "lock": false }, { @@ -172,6 +183,7 @@ "topic": "s-h", "field": "r0" }, + "tip": "The resistance of the thermistor at base temperature T₀", "lock": false }, { @@ -186,6 +198,7 @@ "topic": "s-h", "field": "b" }, + "tip": "The Beta Parameter", "lock": false }, { @@ -204,6 +217,7 @@ "21.25 Hz": 21.25, "27 Hz": 27.0 }, + "tip": "Adjust the output data rate of the enhanced 50 Hz & 60 Hz rejection filter\n(Helps avoid mains interference)", "lock": false } ] @@ -213,6 +227,7 @@ "title": "PID Settings", "expanded": true, "type": "group", + "tip": "Settings of PID parameters and clamping", "children": [ { "name": "kp", @@ -224,6 +239,7 @@ "topic": "pid", "field": "kp" }, + "tip": "Proportional gain", "lock": false }, { @@ -236,6 +252,7 @@ "topic": "pid", "field": "ki" }, + "tip": "Integral gain", "lock": false }, { @@ -248,6 +265,7 @@ "topic": "pid", "field": "kd" }, + "tip": "Differential gain", "lock": false }, { @@ -255,6 +273,7 @@ "title": "PID Output Clamping", "expanded": true, "type": "group", + "tip": "Clamps PID outputs to specified range\nCould be different than output limits", "children": [ { "name": "output_min", @@ -271,6 +290,7 @@ "topic": "pid", "field": "output_min" }, + "tip": "Minimum PID output", "lock": false }, { @@ -288,6 +308,7 @@ "topic": "pid", "field": "output_max" }, + "tip": "Maximum PID output", "lock": false } ] @@ -297,6 +318,7 @@ "title": "PID Auto Tune", "expanded": false, "type": "group", + "tip": "Automatically tune PID parameters", "children": [ { "name": "target_temp", @@ -305,7 +327,8 @@ "value": 20, "step": 0.1, "format": "{value:.4f} °C", - "pid_autotune": "target_temp" + "pid_autotune": "target_temp", + "tip": "The target temperature to autotune for" }, { "name": "test_current", @@ -319,7 +342,8 @@ 2000 ], "suffix": "mA", - "pid_autotune": "test_current" + "pid_autotune": "test_current", + "tip": "The testing current when autotuning" }, { "name": "temp_swing", @@ -329,7 +353,8 @@ "step": 0.1, "prefix": "±", "format": "{value:.4f} °C", - "pid_autotune": "temp_swing" + "pid_autotune": "temp_swing", + "tip": "The temperature swing around the target" }, { "name": "lookback", @@ -338,13 +363,14 @@ "value": 3.0, "step": 0.1, "format": "{value:.4f} s", - "pid_autotune": "lookback" + "pid_autotune": "lookback", + "tip": "Amount of time referenced for tuning" }, { "name": "run_pid", "title": "Run", "type": "action", - "tip": "Run" + "tip": "Run PID Autotune with above settings" } ] } @@ -360,7 +386,7 @@ "name": "load", "title": "Load from flash", "type": "action", - "tip": "Load settings from flash" + "tip": "Load settings from thermostat" } ] } \ No newline at end of file