[GRASS-SVN] r53506 - in grass/branches/develbranch_6/gui/wxpython: core modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 19 08:05:16 PDT 2012


Author: martinl
Date: 2012-10-19 08:05:15 -0700 (Fri, 19 Oct 2012)
New Revision: 53506

Modified:
   grass/branches/develbranch_6/gui/wxpython/core/globalvar.py
   grass/branches/develbranch_6/gui/wxpython/modules/extensions.py
Log:
wxGUI: remove addon also from prompt
       (merge r53505 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/core/globalvar.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/globalvar.py	2012-10-19 15:02:10 UTC (rev 53505)
+++ grass/branches/develbranch_6/gui/wxpython/core/globalvar.py	2012-10-19 15:05:15 UTC (rev 53506)
@@ -149,16 +149,25 @@
     
     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
     
     # scan addons (path)
     if not os.getenv('GRASS_ADDON_PATH'):
         return
-    
+        
+    # 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 os.getenv('GRASS_ADDON_PATH').split(os.pathsep):
         if not os.path.exists(path) or not os.path.isdir(path):
@@ -172,6 +181,7 @@
                     continue
                 if name not in grassCmd:
                     grassCmd.add(name)
+                    Debug.msg(3, "AddOn commands: %s", name)
                     nCmd += 1
                 if ext == '.bat' and \
                         ext in grassScripts.keys() and \
@@ -180,6 +190,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/branches/develbranch_6/gui/wxpython/modules/extensions.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/modules/extensions.py	2012-10-19 15:02:10 UTC (rev 53505)
+++ grass/branches/develbranch_6/gui/wxpython/modules/extensions.py	2012-10-19 15:05:15 UTC (rev 53506)
@@ -467,6 +467,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.py'])



More information about the grass-commit mailing list