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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 12 17:52:54 EDT 2008


Author: martinl
Date: 2008-06-12 17:52:54 -0400 (Thu, 12 Jun 2008)
New Revision: 31691

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI/menuform: check for parameter keydesc, do not use SpinCtrl for multiple key_desc items

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2008-06-12 21:11:05 UTC (rev 31690)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2008-06-12 21:52:54 UTC (rev 31691)
@@ -277,6 +277,8 @@
         self.inGispromptContent = False
         self.inGuisection = False
         self.inKeywordsContent = False
+        self.inKeyDesc = False
+        self.addKeyDesc = False
         self.inFirstParameter = True
         self.task = task_description
 
@@ -298,6 +300,7 @@
             self.param_element = ''
             self.param_prompt = ''
             self.param_guisection = ''
+            self.param_key_desc = []
             # Look for the parameter name, type, requiredness
             self.param_name = attrs.get('name', None)
             self.param_type = attrs.get('type', None)
@@ -343,6 +346,14 @@
             self.inKeywordsContent = True
             self.keyword = ''
 
+        if name == 'keydesc':
+            self.inKeyDesc = True
+            self.key_desc = ''
+            
+        if name == 'item':
+            if self.inKeyDesc:
+                self.addKeyDesc = True
+
     # works with python 2.0, but is not SAX compliant
     def characters(self, ch):
         self.my_characters(ch)
@@ -373,6 +384,8 @@
             self.guisection = self.guisection + ch
         if self.inKeywordsContent:
             self.keyword = self.keyword + ch
+        if self.addKeyDesc:
+            self.key_desc = self.key_desc + ch
 
     def endElement(self, name):
         # If it's not a parameter element, ignore it
@@ -396,7 +409,8 @@
                 "default" : self.param_default,
                 "values" : self.param_values,
                 "values_desc" : self.param_values_description,
-                "value" : ''})
+                "value" : '',
+                "key_desc": self.param_key_desc})
 
             if self.inFirstParameter:
                 self.task.firstParam = self.param_name # store name of first parameter
@@ -444,6 +458,15 @@
                 self.task.keywords.append (normalize_whitespace(keyword))
             self.inKeywordsContent = False
 
+        if name == 'keydesc':
+            self.param_key_desc = self.param_key_desc.split()
+            self.inKeyDesc = False
+
+        if name == 'item':
+            if self.inKeyDesc:
+                self.param_key_desc = normalize_whitespace(self.key_desc)
+                self.addKeyDesc = False
+
 class helpPanel(wx.html.HtmlWindow):
     """
     This panel holds the text from GRASS docs.
@@ -997,6 +1020,7 @@
 
                         if p.get('type','') == 'integer' and \
                                 p.get('multiple','no') == 'no':
+
                             # for multiple integers use textctrl instead of spinsctrl
                             try:
                                 minValue, maxValue = map(int, valuelist[0].split('-'))
@@ -1041,7 +1065,8 @@
                                 flag=wx.RIGHT | wx.LEFT | wx.TOP | wx.EXPAND, border=5)
 
                 if p.get('multiple','yes') == 'yes' or \
-                        p.get('type', 'string') in ('string', 'float'):
+                        p.get('type', 'string') in ('string', 'float') or \
+                        len(p.get('key_desc', [])) > 1:
                     txt3 = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
                                        size=globalvar.DIALOG_TEXTCTRL_SIZE)
                     if p.get('value','') != '':



More information about the grass-commit mailing list