[GRASS-SVN] r48546 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 28 16:03:47 EDT 2011
Author: martinl
Date: 2011-09-28 13:03:46 -0700 (Wed, 28 Sep 2011)
New Revision: 48546
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
Log:
wxGUI: add addons module to the path
(merge r48545 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py 2011-09-28 19:53:55 UTC (rev 48545)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py 2011-09-28 20:03:46 UTC (rev 48546)
@@ -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,13 +144,25 @@
# add special call for setting vector colors
cmd.append('vcolors')
+
+
if scripts and sys.platform != "win32":
- 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')
os.environ["PATH"] = os.getenv("PATH") + os.pathsep + os.path.join(gisbase, 'etc', 'wxpython', '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])
@@ -160,7 +173,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