|
@@ -124,7 +124,7 @@ else:
|
|
|
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 @@ def GetGRASSCmds(bin = True, scripts = True, gui_scripts = True):
|
|
|
"""
|
|
|
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 @@ def GetGRASSCmds(bin = True, scripts = True, gui_scripts = True):
|
|
|
|
|
|
# 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 @@ def GetGRASSCmds(bin = True, scripts = True, gui_scripts = True):
|
|
|
|
|
|
"""@brief Collected GRASS-relared binaries/scripts"""
|
|
|
grassCmd = {}
|
|
|
-grassCmd['all'] = GetGRASSCmds()
|
|
|
+grassCmd['all'] = GetGRASSCmds()
|
|
|
grassCmd['script'] = GetGRASSCmds(bin = False, gui_scripts = False)
|
|
|
|
|
|
"""@Toolbar icon size"""
|