[GRASS-SVN] r53505 - in grass/trunk/gui/wxpython: core modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 19 08:02:11 PDT 2012


Author: martinl
Date: 2012-10-19 08:02:10 -0700 (Fri, 19 Oct 2012)
New Revision: 53505

Modified:
   grass/trunk/gui/wxpython/core/globalvar.py
   grass/trunk/gui/wxpython/modules/extensions.py
Log:
wxGUI: remove addon also from prompt


Modified: grass/trunk/gui/wxpython/core/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/core/globalvar.py	2012-10-19 14:48:00 UTC (rev 53504)
+++ grass/trunk/gui/wxpython/core/globalvar.py	2012-10-19 15:02:10 UTC (rev 53505)
@@ -150,9 +150,11 @@
     
     return set(cmd), scripts
 
-def UpdateGRASSAddOnCommands():
+def UpdateGRASSAddOnCommands(eList = None):
     """!Update list of available GRASS AddOns commands to use when
     parsing string from the command line
+
+    @param eList list of AddOns commands to remove
     """
     global grassCmd, grassScripts
     
@@ -162,7 +164,14 @@
     if addonBase:
         addonPath += os.pathsep + os.path.join(addonBase, 'bin') + os.pathsep + \
             os.path.join(addonBase, 'scripts')
-    
+        
+    # remove commands first
+    if eList:
+        for ext in eList:
+            if ext in grassCmd:
+                grassCmd.remove(ext)
+        Debug.msg(1, "Number of removed AddOn commands: %d", len(eList))
+
     nCmd = 0
     for path in addonPath.split(os.pathsep):
         if not os.path.exists(path) or not os.path.isdir(path):
@@ -177,6 +186,7 @@
                         continue
                     if name not in grassCmd:
                         grassCmd.add(name)
+                        Debug.msg(3, "AddOn commands: %s", name)
                         nCmd += 1
                 if ext == '.py' and \
                         ext in grassScripts.keys() and \
@@ -185,6 +195,7 @@
             else:
                 if fname not in grassCmd:
                     grassCmd.add(fname)
+                    Debug.msg(3, "AddOn commands: %s", fname)
                     nCmd += 1
                     
     Debug.msg(1, "Number of new AddOn commands: %d", nCmd)

Modified: grass/trunk/gui/wxpython/modules/extensions.py
===================================================================
--- grass/trunk/gui/wxpython/modules/extensions.py	2012-10-19 14:48:00 UTC (rev 53504)
+++ grass/trunk/gui/wxpython/modules/extensions.py	2012-10-19 15:02:10 UTC (rev 53505)
@@ -471,6 +471,11 @@
         
         self.extList.LoadData()
         
+        # update prompt
+        globalvar.UpdateGRASSAddOnCommands(eList)
+        log = self.parent.GetLogWindow()
+        log.GetPrompt().SetFilter(None)
+        
     def OnCmdDialog(self, event):
         """!Shows command dialog"""
         GUI(parent = self).ParseCommand(cmd = ['g.extension'])



More information about the grass-commit mailing list