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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 30 07:09:17 EDT 2009


Author: martinl
Date: 2009-05-30 07:09:17 -0400 (Sat, 30 May 2009)
New Revision: 37611

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


Modified: grass/trunk/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-05-30 11:00:03 UTC (rev 37610)
+++ grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-05-30 11:09:17 UTC (rev 37611)
@@ -127,11 +127,23 @@
         """!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 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



More information about the grass-commit mailing list