From 54614c363c44a0c0a23333f08c9c82420b4ba17d Mon Sep 17 00:00:00 2001
From: Seth Hitefield <sdh11@vt.edu>
Date: Wed, 8 Apr 2015 15:52:38 -0400
Subject: qtgui: Slight modification to the precision of the counter in the qt
 range.

---
 gr-qtgui/python/qtgui/range.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'gr-qtgui/python/qtgui/range.py')

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)
 
-- 
cgit v1.2.3