[GRASS-SVN] r42336 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 24 05:28:16 EDT 2010


Author: martinl
Date: 2010-05-24 05:28:15 -0400 (Mon, 24 May 2010)
New Revision: 42336

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: FloatValidator - skip empty strings
(merge r42335 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2010-05-24 09:23:11 UTC (rev 42335)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2010-05-24 09:28:15 UTC (rev 42336)
@@ -1929,16 +1929,19 @@
         """Validate input"""
         textCtrl = self.GetWindow()
         text = textCtrl.GetValue()
-        try:
-            float(text)
-        except ValueError:
-            textCtrl.SetBackgroundColour("grey")
-            textCtrl.SetFocus()
-            textCtrl.Refresh()
-            return False
+
+        if text:
+            try:
+                float(text)
+            except ValueError:
+                textCtrl.SetBackgroundColour("grey")
+                textCtrl.SetFocus()
+                textCtrl.Refresh()
+                return False
         
-        textCtrl.SetBackgroundColour(
-            wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
+        sysColor = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
+        textCtrl.SetBackgroundColour(sysColor)
+        
         textCtrl.Refresh()
         
         return True



More information about the grass-commit mailing list