[GRASS-SVN] r47123 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 15 04:15:19 EDT 2011


Author: annakrat
Date: 2011-07-15 01:15:19 -0700 (Fri, 15 Jul 2011)
New Revision: 47123

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI: fix #1404: GUI command line completion (merge from trunk, r47121)

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py	2011-07-15 08:10:39 UTC (rev 47122)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py	2011-07-15 08:15:19 UTC (rev 47123)
@@ -832,7 +832,7 @@
                         if paramName:
                             try:
                                 param = self.cmdDesc.get_param(paramName)
-                            except ValueError:
+                            except (ValueError, AttributeError):
                                 return
                         else:
                             return
@@ -901,11 +901,11 @@
             self.InsertText(pos, '.')
             self.CharRight()
             self.toComplete = self.EntityToComplete()
-            if self.toComplete['entity'] == 'command': 
-                try:
+            try:
+                if self.toComplete['entity'] == 'command': 
                     self.autoCompList = self.moduleList[entry.strip()]
-                except KeyError:
-                    return
+            except (KeyError, TypeError):
+                return
             self.ShowList()
 
         # complete flags after pressing '-'       
@@ -960,7 +960,7 @@
             # complete flags in such situations (| is cursor):
             # r.colors -| ...w, q, l
             # r.colors -w| ...w, q, l  
-            elif self.toComplete['entity'] == 'flags':
+            elif self.toComplete['entity'] == 'flags' and self.cmdDesc:
                 for flag in self.cmdDesc.get_options()['flags']:
                     if len(flag['name']) == 1:
                         self.autoCompList.append(flag['name'])
@@ -968,7 +968,7 @@
             # complete parameters in such situations (| is cursor):
             # r.colors -w | ...color, map, rast, rules
             # r.colors col| ...color
-            elif self.toComplete['entity'] == 'params':
+            elif self.toComplete['entity'] == 'params' and self.cmdDesc:
                 for param in self.cmdDesc.get_options()['params']:
                     if param['name'].find(self.GetWordLeft(withDelimiter=False)) == 0:
                         self.autoCompList.append(param['name'])           
@@ -976,7 +976,7 @@
             # complete flags or parameters in such situations (| is cursor):
             # r.colors | ...-w, -q, -l, color, map, rast, rules
             # r.colors color=grey | ...-w, -q, -l, color, map, rast, rules
-            elif self.toComplete['entity'] == 'params+flags':
+            elif self.toComplete['entity'] == 'params+flags' and self.cmdDesc:
                 self.autoCompList = list()
                 
                 for param in self.cmdDesc.get_options()['params']:



More information about the grass-commit mailing list