ctrl_panel: Fix editing fields with unit "°C"

A faulty regular expression within PyQtGraph causes any Parameter with
a suffix that doesn't begin with an alphanumeric character (as matched
with \w) to act abnormally. For instance, entering "100 °C" into the
input boxes gets interpreted as 10 °C.

Use a custom regular expression for Parameters with this unit, which
simply matches for any character in the suffix group.
This commit is contained in:
atse 2024-07-30 13:31:42 +08:00
parent 9a00c2b8f2
commit 38099d6d7b

View File

@ -89,6 +89,7 @@
],
"format": "{value:.4f} {suffix}",
"suffix": "°C",
"regex": "(?P<number>[+-]?((((\\d+(\\.\\d*)?)|(\\d*\\.\\d+))([eE][+-]?\\d+)?)|((?i:nan)|(inf))))\\s*((?P<siPrefix>[uyzafpnµm kMGTPEZY]?)(?P<suffix>.*))?$",
"noUnitEditing": true,
"compactHeight": false,
"param": [
@ -201,6 +202,7 @@
],
"format": "{value:.4f} {suffix}",
"suffix": "°C",
"regex": "(?P<number>[+-]?((((\\d+(\\.\\d*)?)|(\\d*\\.\\d+))([eE][+-]?\\d+)?)|((?i:nan)|(inf))))\\s*((?P<siPrefix>[uyzafpnµm kMGTPEZY]?)(?P<suffix>.*))?$",
"noUnitEditing": true,
"compactHeight": false,
"param": [
@ -392,6 +394,7 @@
"step": 0.1,
"format": "{value:.4f} {suffix}",
"suffix": "°C",
"regex": "(?P<number>[+-]?((((\\d+(\\.\\d*)?)|(\\d*\\.\\d+))([eE][+-]?\\d+)?)|((?i:nan)|(inf))))\\s*((?P<siPrefix>[uyzafpnµm kMGTPEZY]?)(?P<suffix>.*))?$",
"noUnitEditing": true,
"compactHeight": false,
"pid_autotune": [
@ -430,6 +433,7 @@
"step": 0.1,
"format": "{value:.4f} {suffix}",
"suffix": "°C",
"regex": "(?P<number>[+-]?((((\\d+(\\.\\d*)?)|(\\d*\\.\\d+))([eE][+-]?\\d+)?)|((?i:nan)|(inf))))\\s*((?P<siPrefix>[uyzafpnµm kMGTPEZY]?)(?P<suffix>.*))?$",
"noUnitEditing": true,
"compactHeight": false,
"pid_autotune": [