From 9dcd43fb0dd9367ad691d2875461702ae045f5e9 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 11 Jun 2016 16:52:48 -0600 Subject: [PATCH] gui/scanwidget: use -inf/inf to represent absence of boundaries (consistently with QDoubleSpinbox) --- artiq/gui/scanwidget.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/artiq/gui/scanwidget.py b/artiq/gui/scanwidget.py index 234523c21..e8126efa9 100644 --- a/artiq/gui/scanwidget.py +++ b/artiq/gui/scanwidget.py @@ -41,7 +41,7 @@ class ScanWidget(QtWidgets.QWidget): qfm.lineSpacing()) 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._offset, self._drag, self._rubber = None, None, None @@ -73,10 +73,8 @@ class ScanWidget(QtWidgets.QWidget): def _clamp(self, v): if v is None: return None - if self._min is not None: - v = max(self._min, v) - if self._max is not None: - v = min(self._max, v) + v = max(self._min, v) + v = min(self._max, v) return v def setStart(self, val):