[GRASS-SVN] r37612 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 30 07:11:35 EDT 2009
Author: martinl
Date: 2009-05-30 07:11:35 -0400 (Sat, 30 May 2009)
New Revision: 37612
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI: fix multiple keys search
(merge from trunk, r37610, r37611)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py 2009-05-30 11:09:17 UTC (rev 37611)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py 2009-05-30 11:11:35 UTC (rev 37612)
@@ -123,6 +123,33 @@
return cmdprompt, cmdinput
+ def __checkKey(self, text, keywords):
+ """!Check if text is in keywords"""
+ found = 0
+ keys = text.split(',')
+ if len(keys) > 1: # -> multiple keys
+ for k in keys[:-1]:
+ k = k.strip()
+ for key in keywords:
+ if k == key: # full match
+ found += 1
+ break
+ k = keys[-1].strip()
+ for key in keywords:
+ if k in key: # partial match
+ found +=1
+ break
+ else:
+ for key in keywords:
+ if text in key: # partial match
+ found +=1
+ break
+
+ if found == len(keys):
+ return True
+
+ return False
+
def GetPanel(self):
"""!Get main widget panel"""
return self.panel
@@ -174,13 +201,12 @@
modules = []
for module, data in self.modules.iteritems():
if self.searchBy.GetSelection() == 0: # -> description
- ref = data['desc']
+ if text in data['desc']:
+ modules.append(module)
else: # -> keywords
- ref = ','.join(data['keywords'])
-
- if text in ref:
- modules.append(module)
-
+ if self.__checkKey(text, data['keywords']):
+ modules.append(module)
+
self.parent.statusbar.SetStatusText(_("%d modules found") % len(modules))
self.input.SetChoices(modules)
More information about the grass-commit
mailing list