mirror of
https://github.com/nqrduck/nqrduck-spectrometer.git
synced 2024-11-09 12:30:01 +00:00
Added scientific notation to regex.
This commit is contained in:
parent
038bc8c0ef
commit
28b8936389
1 changed files with 7 additions and 1 deletions
|
@ -9,7 +9,7 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Setting(QObject):
|
class Setting(QObject):
|
||||||
"""A setting for the spectrometer is a value that is the same for all events in a pulse sequence.
|
"""A setting for the spectrometer is a value that is the same for all events in a pulse sequence.
|
||||||
E.g. the number of averages or the number of points in a spectrum."""
|
E.g. the Transmit gain or the number of points in a spectrum."""
|
||||||
|
|
||||||
settings_changed = pyqtSignal()
|
settings_changed = pyqtSignal()
|
||||||
|
|
||||||
|
@ -86,6 +86,9 @@ class FloatSetting(Setting):
|
||||||
else:
|
else:
|
||||||
# Create a regex validator that only allows floats
|
# Create a regex validator that only allows floats
|
||||||
regex = "[-+]?[0-9]*\.?[0-9]+"
|
regex = "[-+]?[0-9]*\.?[0-9]+"
|
||||||
|
# Optional scientific notation
|
||||||
|
regex += "([eE][-+]?[0-9]+)?"
|
||||||
|
|
||||||
self.validator = QRegularExpressionValidator(QRegularExpression(regex))
|
self.validator = QRegularExpressionValidator(QRegularExpression(regex))
|
||||||
|
|
||||||
self.widget = self.get_widget()
|
self.widget = self.get_widget()
|
||||||
|
@ -132,6 +135,9 @@ class IntSetting(Setting):
|
||||||
else:
|
else:
|
||||||
# Create a regex validator that only allows integers
|
# Create a regex validator that only allows integers
|
||||||
regex = "[-+]?[0-9]+"
|
regex = "[-+]?[0-9]+"
|
||||||
|
# Optional scientific notation
|
||||||
|
regex += "([eE][-+]?[0-9]+)?"
|
||||||
|
|
||||||
self.validator = QRegularExpressionValidator(QRegularExpression(regex))
|
self.validator = QRegularExpressionValidator(QRegularExpression(regex))
|
||||||
|
|
||||||
self.widget = self.get_widget()
|
self.widget = self.get_widget()
|
||||||
|
|
Loading…
Reference in a new issue