[GRASS-SVN] r37610 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 30 07:00:03 EDT 2009


Author: martinl
Date: 2009-05-30 07:00:03 -0400 (Sat, 30 May 2009)
New Revision: 37610

Modified:
   grass/trunk/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI: fix multiple keys search


Modified: grass/trunk/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-05-30 10:36:02 UTC (rev 37609)
+++ grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-05-30 11:00:03 UTC (rev 37610)
@@ -123,6 +123,21 @@
         
         return cmdprompt, cmdinput
 
+    def __checkKey(self, text, keywords):
+        """!Check if text is in keywords"""
+        found = 0
+        keys = text.split(',')
+        for k in keys:
+            k = k.strip()
+            for key in keywords: 
+                if k in key:
+                    found += 1
+        
+        if found == len(keys):
+            return True
+        
+        return False
+    
     def GetPanel(self):
         """!Get main widget panel"""
         return self.panel
@@ -174,13 +189,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