forked from M-Labs/artiq
1
0
Fork 0

gui: use ScientificSpinBox for NoScan and NumberValue (#460)

This commit is contained in:
Robert Jördens 2016-08-11 17:02:21 +02:00
parent 941f6fc859
commit 9775faa322
1 changed files with 7 additions and 3 deletions

View File

@ -69,14 +69,16 @@ class EnumerationEntry(QtWidgets.QComboBox):
return procdesc["choices"][0]
class NumberEntry(QtWidgets.QDoubleSpinBox):
class NumberEntry(ScientificSpinBox):
def __init__(self, argument):
QtWidgets.QDoubleSpinBox.__init__(self)
ScientificSpinBox.__init__(self)
disable_scroll_wheel(self)
procdesc = argument["desc"]
scale = procdesc["scale"]
self.setDecimals(procdesc["ndecimals"])
self.setPrecision()
self.setSingleStep(procdesc["step"]/scale)
self.setRelativeStep()
if procdesc["min"] is not None:
self.setMinimum(procdesc["min"]/scale)
else:
@ -110,9 +112,10 @@ class _NoScan(LayoutWidget):
LayoutWidget.__init__(self)
scale = procdesc["scale"]
self.value = QtWidgets.QDoubleSpinBox()
self.value = ScientificSpinBox()
disable_scroll_wheel(self.value)
self.value.setDecimals(procdesc["ndecimals"])
self.value.setPrecision()
if procdesc["global_min"] is not None:
self.value.setMinimum(procdesc["global_min"]/scale)
else:
@ -122,6 +125,7 @@ class _NoScan(LayoutWidget):
else:
self.value.setMaximum(float("inf"))
self.value.setSingleStep(procdesc["global_step"]/scale)
self.value.setRelativeStep()
if procdesc["unit"]:
self.value.setSuffix(" " + procdesc["unit"])
self.addWidget(QtWidgets.QLabel("Value:"), 0, 0)