summaryrefslogtreecommitdiff
path: root/gr-qtgui/python/qtgui/range.py
diff options
context:
space:
mode:
authorSeth Hitefield <sdh11@vt.edu>2015-04-08 15:52:38 -0400
committerSeth Hitefield <sdh11@vt.edu>2015-04-08 15:52:38 -0400
commit54614c363c44a0c0a23333f08c9c82420b4ba17d (patch)
tree2c47f92e8d2f520f8f2fc8077701c1371dd1b4d6 /gr-qtgui/python/qtgui/range.py
parentd8ffe561153bb0b8d79f028212de7a12c031a067 (diff)
qtgui: Slight modification to the precision of the counter in the qt range.
Diffstat (limited to 'gr-qtgui/python/qtgui/range.py')
-rwxr-xr-xgr-qtgui/python/qtgui/range.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/gr-qtgui/python/qtgui/range.py b/gr-qtgui/python/qtgui/range.py
index e66a660d24..1203d6bc1e 100755
--- a/gr-qtgui/python/qtgui/range.py
+++ b/gr-qtgui/python/qtgui/range.py
@@ -34,11 +34,15 @@ class Range(object):
self.find_nsteps()
def find_precision(self):
- temp = str(float(self.step)-int(self.step))[2:]
- if len(temp) > 13:
- self.precision = 15
+ # Get the decimal part of the step
+ temp = str(float(self.step) - int(self.step))[2:]
+ precision = len(temp) if temp is not '0' else 0
+ precision = min(precision, 13)
+
+ if precision == 0 and self.max < 100:
+ self.precision = 1 # Always have a decimal in this case
else:
- self.precision = len(temp)+2
+ self.precision = (precision + 2) if precision > 0 else 0
def find_nsteps(self):
self.nsteps = (self.max + self.step - self.min)/self.step
@@ -76,8 +80,6 @@ class RangeWidget(QtGui.QWidget):
self.d_widget = self.Slider(self, self.range, self.ds_modified_slot)
elif style == "counter":
self.d_widget = self.Counter(self, self.range, self.c_modified_slot)
- elif style == "counter_slider":
- self.d_widget = self.CounterSlider(self, self.range, self.ds_modified_slot, self.c_modified_slot)
else:
self.d_widget = self.CounterSlider(self, self.range, self.ds_modified_slot, self.c_modified_slot)