gimp r27726 - in trunk: . plug-ins/pygimp



Author: neo
Date: Thu Nov 27 10:25:10 2008
New Revision: 27726
URL: http://svn.gnome.org/viewvc/gimp?rev=27726&view=rev

Log:
2008-11-27  Sven Neumann  <sven gimp org>

	Bug 562386 â PF_SLIDER and PF_SPINNER 'Step' values do not 
change
	consistently...

	* plug-ins/pygimp/gimpfu.py (SpinnerEntry): initialize the
	spin-button the way that gtk_spin_button_new_with_range() is
	implemented.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/pygimp/gimpfu.py

Modified: trunk/plug-ins/pygimp/gimpfu.py
==============================================================================
--- trunk/plug-ins/pygimp/gimpfu.py	(original)
+++ trunk/plug-ins/pygimp/gimpfu.py	Thu Nov 27 10:25:10 2008
@@ -71,6 +71,7 @@
 '''
 
 import string as _string
+import math
 import gimp
 import gimpcolor
 from gimpenums import *
@@ -493,10 +494,17 @@
     class SpinnerEntry(gtk.SpinButton):
         # bounds is (upper, lower, step)
         def __init__(self, default=0, bounds=(0, 100, 5)):
-            self.adj = gtk.Adjustment(default, bounds[0],
-                                        bounds[1], bounds[2],
-                                        bounds[2], 0)
-            gtk.SpinButton.__init__(self, self.adj, 1, 0)
+            step = bounds[2]
+            self.adj = gtk.Adjustment(default, bounds[0], bounds[1],
+                                      step, 10 * step, 0)
+            step = bounds[2]
+            if math.fabs(step) >= 1.0 or step == 0.0:
+                digits = 0
+            else:
+                digits = abs(math.floor(math.log10(math.fabs(step))));
+            if digits > 20:
+                digits = 20
+            gtk.SpinButton.__init__(self, self.adj, step, int(digits))
 
         def get_value(self):
             try:



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