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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 25 15:25:56 EST 2009


Author: martinl
Date: 2009-12-25 15:25:56 -0500 (Fri, 25 Dec 2009)
New Revision: 40139

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI/prompt: fix 'ctrl+space'
	      (merge r40137 & r40138 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2009-12-25 20:24:02 UTC (rev 40138)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2009-12-25 20:25:56 UTC (rev 40139)
@@ -717,12 +717,6 @@
         @todo event.ControlDown() for manual autocomplete
         """
         # keycodes used: "." = 46, "=" = 61, "," = 44 
-        line = ''
-        entry = ''
-        usage = ''
-        cmdtype = ''
-        cmdname = ''
-        cmd = ''
         
         if event.GetKeyCode() == 46 and not event.ShiftDown():
             # GRASS command autocomplete when '.' is pressed after 'r', 'v', 'i', 'g', 'db', or 'd'
@@ -802,16 +796,16 @@
             elif event.GetKeyCode() == wx.WXK_SPACE and event.ControlDown():
                 # manual autocompletion
                 # map entries without arguments (as in r.info [mapname]) use ctrl-shift
+                if not self.cmdDesc:
+                    return
                 
-                maplist = []
-                if cmdtype=='r' or cmdtype=='i':
-                    self.maptype = 'rast'
-                elif cmdtype=='v':
-                    self.maptype = 'vect'
-                elif cmdtype=='r3':
-                    self.maptype = 'rast3d'
-                    
-            if self.promptType and self.promptType in ('raster', 'vector'):
+                try:
+                    param = self.cmdDesc.get_list_params()[0]
+                    self.promptType = self.cmdDesc.get_param(param)['prompt']
+                except IndexError:
+                    return
+            
+            if self.promptType and self.promptType in ('raster', 'raster3d', 'vector'):
                 self.autoCompList = self.mapList[self.promptType]
                 self.AutoCompShow(lenEntered = 0, itemList = ' '.join(self.autoCompList))
             
@@ -886,10 +880,9 @@
         
     def GetTextLeft(self):
         """!Returns all text left of the caret"""
-        entry = ''
         pos = self.GetCurrentPos()
         self.HomeExtend()
-        entry = self.GetSelectedText().strip()
+        entry = self.GetSelectedText()
         self.SetCurrentPos(pos)
         
         return entry



More information about the grass-commit mailing list