forked from M-Labs/artiq
scientific_spinbox: rename precision to sig_figs
This commit is contained in:
parent
8f4c8387f9
commit
4fbff1648c
|
@ -20,21 +20,21 @@ class ScientificSpinBox(QtWidgets.QDoubleSpinBox):
|
||||||
self.setCorrectionMode(self.CorrectToPreviousValue)
|
self.setCorrectionMode(self.CorrectToPreviousValue)
|
||||||
# singleStep: resolution for step, buttons, accelerators
|
# singleStep: resolution for step, buttons, accelerators
|
||||||
# decimals: absolute rounding granularity
|
# decimals: absolute rounding granularity
|
||||||
# precision: number of significant digits shown, %g precision
|
# sigFigs: number of significant digits shown
|
||||||
self.setPrecision()
|
self.setSigFigs()
|
||||||
self.setRelativeStep()
|
self.setRelativeStep()
|
||||||
self.setRange(-inf, inf)
|
self.setRange(-inf, inf)
|
||||||
self.setValue(0)
|
self.setValue(0)
|
||||||
# self.setKeyboardTracking(False)
|
# self.setKeyboardTracking(False)
|
||||||
|
|
||||||
def setPrecision(self, d=None):
|
def setSigFigs(self, d=None):
|
||||||
if d is None:
|
if d is None:
|
||||||
d = self.decimals() + 3
|
d = self.decimals() + 3
|
||||||
self._precision = max(1, int(d))
|
self._sig_figs = max(1, int(d))
|
||||||
self._fmt = "{{:.{}g}}".format(self._precision)
|
self._fmt = "{{:.{}g}}".format(self._sig_figs)
|
||||||
|
|
||||||
def precision(self):
|
def sigFigs(self):
|
||||||
return self._precision
|
return self._sig_figs
|
||||||
|
|
||||||
def setRelativeStep(self, s=None):
|
def setRelativeStep(self, s=None):
|
||||||
if s is None:
|
if s is None:
|
||||||
|
|
Loading…
Reference in New Issue