gui/entries/_RangeScan: set range before setting value. Fixes clamping to 99.99

This commit is contained in:
Sebastien Bourdeauducq 2016-06-11 16:50:16 -06:00
parent 60d8e30ecd
commit 765e3f0b5d
2 changed files with 6 additions and 4 deletions

View File

@ -23,7 +23,8 @@ class SubComponent2(HasEnvironment):
def build(self): def build(self):
self.setattr_argument("sc2_boolean", BooleanValue(False), self.setattr_argument("sc2_boolean", BooleanValue(False),
"Transporter") "Transporter")
self.setattr_argument("sc2_scan", Scannable(default=NoScan(325)), self.setattr_argument("sc2_scan", Scannable(
default=LinearScan(200, 300, 49)),
"Transporter") "Transporter")
self.setattr_argument("sc2_enum", EnumerationValue(["3", "4", "5"]), self.setattr_argument("sc2_enum", EnumerationValue(["3", "4", "5"]),
"Transporter") "Transporter")

View File

@ -178,6 +178,10 @@ class _RangeScan(LayoutWidget):
disable_scroll_wheel(stop) disable_scroll_wheel(stop)
self.addWidget(stop, 2, 1) self.addWidget(stop, 2, 1)
apply_properties(start)
apply_properties(stop)
apply_properties(scanner)
def update_start(value): def update_start(value):
state["start"] = value*scale state["start"] = value*scale
scanner.setStart(value) scanner.setStart(value)
@ -199,9 +203,6 @@ class _RangeScan(LayoutWidget):
scanner.setStart(state["start"]/scale) scanner.setStart(state["start"]/scale)
scanner.setNum(state["npoints"]) scanner.setNum(state["npoints"])
scanner.setStop(state["stop"]/scale) scanner.setStop(state["stop"]/scale)
apply_properties(start)
apply_properties(stop)
apply_properties(scanner)
class _ExplicitScan(LayoutWidget): class _ExplicitScan(LayoutWidget):