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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 6 08:56:42 EST 2010


Author: martinl
Date: 2010-01-06 08:56:41 -0500 (Wed, 06 Jan 2010)
New Revision: 40285

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI: fix search by keywords
       (merge r40284 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-01-06 13:54:54 UTC (rev 40284)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-01-06 13:56:41 UTC (rev 40285)
@@ -564,7 +564,7 @@
                 if text in data['desc']:
                     found = True
             else: # -> keywords
-                if self.__checkKey(text, data['keywords']):
+                if self.cmd_prompt.CheckKey(text, data['keywords']):
                     found = True
 
             if found:

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2010-01-06 13:54:54 UTC (rev 40284)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2010-01-06 13:56:41 UTC (rev 40285)
@@ -494,7 +494,34 @@
         self.cmdDesc = None
         self.cmdbuffer = self._readHistory()
         self.cmdindex = len(self.cmdbuffer)
+
+    def CheckKey(self, text, keywords):
+        """!Check if text is in keywords (unused)"""
+        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 _readHistory(self):
         """!Get list of commands from history file"""
         hist = list()
@@ -610,33 +637,6 @@
         self.Bind(wx.EVT_TEXT_ENTER, self.OnRunCmd)
         self.Bind(wx.EVT_TEXT,       self.OnUpdateStatusBar)
         
-    def __checkKey(self, text, keywords):
-        """!Check if text is in keywords (unused)"""
-        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 OnCmdErase(self, event):
         """!Erase command prompt"""
         self.input.SetValue('')



More information about the grass-commit mailing list