[GRASS-SVN] r42599 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jun 20 10:56:21 EDT 2010


Author: martinl
Date: 2010-06-20 14:56:21 +0000 (Sun, 20 Jun 2010)
New Revision: 42599

Modified:
   grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI/menuform: don't ignore default value for SpinCtrl


Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-06-20 14:52:03 UTC (rev 42598)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-06-20 14:56:21 UTC (rev 42599)
@@ -1222,8 +1222,8 @@
                                      flag=wx.EXPAND | wx.TOP | wx.RIGHT | wx.LEFT, border=5 )
                 elif p.get('gisprompt', False) == False:
                     if len(valuelist) == 1: # -> textctrl
-                        title_txt.SetLabel("%s. %s %s" % (title, _('Valid range'),
-                                                          str(valuelist[0]) + ':'))
+                        title_txt.SetLabel("%s (%s %s):" % (title, _('valid range'),
+                                                          str(valuelist[0])))
                         
                         if p.get('type', '') == 'integer' and \
                                 p.get('multiple','no') == 'no':
@@ -1249,6 +1249,11 @@
                                 txt2.SetValue(int(p['value']))
                             else:
                                 txt2.SetValue(p['value'])
+                        elif p.get('default', '') != '':
+                            if txt2.GetName() == "SpinCtrl":
+                                txt2.SetValue(int(p['default']))
+                            else:
+                                txt2.SetValue(p['default'])
                         
                         which_sizer.Add(item=txt2, proportion=0,
                                         flag=style, border=5)
@@ -1297,6 +1302,8 @@
                         
                         if p.get('value', '') != '':
                             txt3.SetValue(int(p['value'])) # parameter previously set
+                        elif p.get('default', '') != '':
+                            txt3.SetValue(int(p['default']))
                         
                         txt3.Bind(wx.EVT_SPINCTRL, self.OnSetValue)
                     else:



More information about the grass-commit mailing list