mirror of https://github.com/m-labs/artiq.git
gui: fix explicit scan input validation
This commit is contained in:
parent
03eeec55b2
commit
e6a351c5ea
|
@ -212,13 +212,14 @@ 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):
|
||||
if self.value.hasAcceptableInput():
|
||||
state["sequence"] = [float(x) for x in text.split()]
|
||||
self.value.textEdited.connect(update)
|
||||
|
||||
|
|
Loading…
Reference in New Issue