[GRASS-SVN] r48982 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Oct 29 12:09:07 EDT 2011
Author: martinl
Date: 2011-10-29 09:09:07 -0700 (Sat, 29 Oct 2011)
New Revision: 48982
Modified:
grass/trunk/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI/prompt: auto-complete mapsets
Modified: grass/trunk/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/prompt.py 2011-10-29 15:52:14 UTC (rev 48981)
+++ grass/trunk/gui/wxpython/gui_modules/prompt.py 2011-10-29 16:09:07 UTC (rev 48982)
@@ -489,6 +489,7 @@
self.moduleDesc = parent.parent.menubar.GetData().GetModules()
self.moduleList = self._getListOfModules()
self.mapList = self._getListOfMaps()
+ self.mapsetList = utils.ListOfMapsets()
else:
self.moduleDesc = self.moduleList = self.mapList = None
@@ -829,22 +830,22 @@
except IndexError:
return None
- if len(entry.split(' ')) > 1:
+ if len(utils.split(str(entry))) > 1:
if cmd in globalvar.grassCmd['all']:
toComplete['cmd'] = cmd
if entry[-1] == ' ':
words = entry.split(' ')
if any(word.startswith('-') for word in words):
toComplete['entity'] = 'params'
- return toComplete
else:
toComplete['entity'] = 'params+flags'
- return toComplete
-
else:
- #get word left from current position
+ # get word left from current position
word = self.GetWordLeft(withDelimiter = True)
- if word[0] == '=':
+
+ if word[0] == '=' and word[-1] == '@':
+ toComplete['entity'] = 'mapsets'
+ elif word[0] == '=':
# get name of parameter
paramName = self.GetWordLeft(withDelimiter = False, ignoredDelimiter = '=').strip('=')
if paramName:
@@ -854,29 +855,24 @@
return
else:
return
-
+
if param['values']:
toComplete['entity'] = 'param values'
- return toComplete
elif param['prompt'] == 'raster' and param['element'] == 'cell':
toComplete['entity'] = 'raster map'
- return toComplete
elif param['prompt'] == 'vector' and param['element'] == 'vector':
toComplete['entity'] = 'vector map'
- return toComplete
elif word[0] == '-':
toComplete['entity'] = 'flags'
- return toComplete
elif word[0] == ' ':
toComplete['entity'] = 'params'
- return toComplete
-
else:
return None
else:
toComplete['entity'] = 'command'
toComplete['cmd'] = cmd
- return toComplete
+
+ return toComplete
def GetWordLeft(self, withDelimiter = False, ignoredDelimiter = None):
"""!Get word left from current cursor position. The beginning
@@ -959,7 +955,18 @@
param = self.GetWordLeft(withDelimiter = False, ignoredDelimiter='=').strip(' =')
self.autoCompList = self.cmdDesc.get_param(param)['values']
self.ShowList()
+
+ # complete mapset ('@')
+ elif event.GetKeyCode() == 50 and event.ShiftDown():
+ self.autoCompList = list()
+ self.InsertText(pos, '@')
+ self.CharRight()
+ self.toComplete = self.EntityToComplete()
+ if self.toComplete and self.toComplete['entity'] == 'mapsets':
+ self.autoCompList = self.mapsetList
+ self.ShowList()
+
# complete after pressing CTRL + Space
elif event.GetKeyCode() == wx.WXK_SPACE and event.ControlDown():
self.autoCompList = list()
More information about the grass-commit
mailing list