diff --git a/pytec/pytec/gui/view/unitful.py b/pytec/pytec/gui/view/unitful.py index 55f20e9..699f4ca 100644 --- a/pytec/pytec/gui/view/unitful.py +++ b/pytec/pytec/gui/view/unitful.py @@ -1,3 +1,5 @@ +import re + from PyQt6.QtCore import QSignalBlocker from PyQt6.QtGui import QValidator @@ -7,6 +9,13 @@ from pyqtgraph.parametertree import registerParameterItemType from pyqtgraph.parametertree.parameterTypes import SimpleParameter, NumericParameterItem +# See https://github.com/pyqtgraph/pyqtgraph/issues/3115 +fn.FLOAT_REGEX = re.compile( + r"(?P[+-]?((((\d+(\.\d*)?)|(\d*\.\d+))([eE][+-]?\d+)?)|((?i:nan)|(inf))))\s*" + + r"((?P[u" + fn.SI_PREFIXES + r"]?)(?P.*))?$" +) + + class UnitfulSpinBox(SpinBox): """ Extension of PyQtGraph's SpinBox widget.