commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/06: qtgui: Slight modification to the pr


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/06: qtgui: Slight modification to the precision of the counter in the qt range.
Date: Wed, 8 Apr 2015 23:27:17 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 54614c363c44a0c0a23333f08c9c82420b4ba17d
Author: Seth Hitefield <address@hidden>
Date:   Wed Apr 8 15:52:38 2015 -0400

    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(-)

diff --git a/gr-qtgui/python/qtgui/range.py b/gr-qtgui/python/qtgui/range.py
index e66a660..1203d6b 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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]