mirror of
https://github.com/nqrduck/nqrduck-spectrometer.git
synced 2024-11-08 12:00:02 +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):
|
||||
"""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()
|
||||
|
||||
|
@ -86,6 +86,9 @@ class FloatSetting(Setting):
|
|||
else:
|
||||
# Create a regex validator that only allows floats
|
||||
regex = "[-+]?[0-9]*\.?[0-9]+"
|
||||
# Optional scientific notation
|
||||
regex += "([eE][-+]?[0-9]+)?"
|
||||
|
||||
self.validator = QRegularExpressionValidator(QRegularExpression(regex))
|
||||
|
||||
self.widget = self.get_widget()
|
||||
|
@ -132,6 +135,9 @@ class IntSetting(Setting):
|
|||
else:
|
||||
# Create a regex validator that only allows integers
|
||||
regex = "[-+]?[0-9]+"
|
||||
# Optional scientific notation
|
||||
regex += "([eE][-+]?[0-9]+)?"
|
||||
|
||||
self.validator = QRegularExpressionValidator(QRegularExpression(regex))
|
||||
|
||||
self.widget = self.get_widget()
|
||||
|
|
Loading…
Reference in a new issue