forked from M-Labs/artiq
1
0
Fork 0

gui/scanwidget: use -inf/inf to represent absence of boundaries (consistently with QDoubleSpinbox)

This commit is contained in:
Sebastien Bourdeauducq 2016-06-11 16:52:48 -06:00
parent 765e3f0b5d
commit 3b63c39d2f
1 changed files with 3 additions and 5 deletions

View File

@ -41,7 +41,7 @@ class ScanWidget(QtWidgets.QWidget):
qfm.lineSpacing()) qfm.lineSpacing())
self._start, self._stop, self._num = None, None, None self._start, self._stop, self._num = None, None, None
self._min, self._max = None, None self._min, self._max = float("-inf"), float("inf")
self._axisView = None self._axisView = None
self._offset, self._drag, self._rubber = None, None, None self._offset, self._drag, self._rubber = None, None, None
@ -73,9 +73,7 @@ class ScanWidget(QtWidgets.QWidget):
def _clamp(self, v): def _clamp(self, v):
if v is None: if v is None:
return None return None
if self._min is not None:
v = max(self._min, v) v = max(self._min, v)
if self._max is not None:
v = min(self._max, v) v = min(self._max, v)
return v return v