forked from M-Labs/artiq
gui: fix explicit scan input validation
This commit is contained in:
parent
03eeec55b2
commit
e6a351c5ea
|
@ -212,14 +212,15 @@ class _ExplicitScan(LayoutWidget):
|
|||
self.addWidget(QtWidgets.QLabel("Sequence:"), 0, 0)
|
||||
self.addWidget(self.value, 0, 1)
|
||||
|
||||
float_regexp = "[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
|
||||
float_regexp = r"(([+-]?\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?)"
|
||||
regexp = "(float)?( +float)* *".replace("float", float_regexp)
|
||||
self.value.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(regexp),
|
||||
self.value))
|
||||
|
||||
self.value.setText(" ".join([str(x) for x in state["sequence"]]))
|
||||
def update(text):
|
||||
state["sequence"] = [float(x) for x in text.split()]
|
||||
if self.value.hasAcceptableInput():
|
||||
state["sequence"] = [float(x) for x in text.split()]
|
||||
self.value.textEdited.connect(update)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue