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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 28 15:53:56 EDT 2011


Author: martinl
Date: 2011-09-28 12:53:55 -0700 (Wed, 28 Sep 2011)
New Revision: 48545

Modified:
   grass/trunk/gui/wxpython/gui_modules/globalvar.py
Log:
wxGUI: add addons module to the path


Modified: grass/trunk/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/globalvar.py	2011-09-28 17:20:17 UTC (rev 48544)
+++ grass/trunk/gui/wxpython/gui_modules/globalvar.py	2011-09-28 19:53:55 UTC (rev 48545)
@@ -124,7 +124,7 @@
     EXT_BIN = ''
     EXT_SCT = ''
 
-def GetGRASSCmds(bin = True, scripts = True, gui_scripts = True):
+def GetGRASSCmds(bin = True, scripts = True, gui_scripts = True, addons = True):
     """!Create list of available GRASS commands to use when parsing
     string from the command line
 
@@ -134,6 +134,7 @@
     """
     gisbase = os.environ['GISBASE']
     cmd = list()
+    
     if bin:
         for executable in os.listdir(os.path.join(gisbase, 'bin')):
             ext = os.path.splitext(executable)[1]
@@ -143,12 +144,23 @@
         
         # add special call for setting vector colors
         cmd.append('vcolors')
+    
     if scripts:
-        cmd = cmd + os.listdir(os.path.join(gisbase, 'scripts')) 
+        cmd += os.listdir(os.path.join(gisbase, 'scripts'))
+    
     if gui_scripts:
         os.environ["PATH"] = os.getenv("PATH") + os.pathsep + os.path.join(gisbase, 'etc', 'gui', 'scripts')
         cmd = cmd + os.listdir(os.path.join(gisbase, 'etc', 'gui', 'scripts'))
     
+    if addons and os.getenv('GRASS_ADDON_PATH'):
+        path = os.getenv('GRASS_ADDON_PATH')
+        for executable in os.listdir(os.path.join(path, 'bin')):
+            ext = os.path.splitext(executable)[1]
+            if not EXT_BIN or \
+                    ext in (EXT_BIN, EXT_SCT):
+                cmd.append(executable)
+        cmd += os.listdir(os.path.join(path, 'scripts'))
+    
     if sys.platform == 'win32':
         for idx in range(len(cmd)):
             name, ext = os.path.splitext(cmd[idx])
@@ -159,7 +171,7 @@
 
 """@brief Collected GRASS-relared binaries/scripts"""
 grassCmd = {}
-grassCmd['all'] = GetGRASSCmds()
+grassCmd['all']    = GetGRASSCmds()
 grassCmd['script'] = GetGRASSCmds(bin = False, gui_scripts = False)
 
 """@Toolbar icon size"""



More information about the grass-commit mailing list