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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 14 05:41:56 EDT 2008


Author: martinl
Date: 2008-03-14 05:41:56 -0400 (Fri, 14 Mar 2008)
New Revision: 30558

Modified:
   grass/trunk/gui/wxpython/gui_modules/globalvar.py
Log:
wxGUI: add to PATH also $GISBASE/etc/gui/scripts


Modified: grass/trunk/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/globalvar.py	2008-03-14 09:36:49 UTC (rev 30557)
+++ grass/trunk/gui/wxpython/gui_modules/globalvar.py	2008-03-14 09:41:56 UTC (rev 30558)
@@ -64,31 +64,28 @@
     EXT_BIN = ''
     EXT_SCT = ''
 
-def __getGRASSCmds(bin=True, scripts=True):
+def __getGRASSCmds(bin=True, scripts=True, gui_scripts=True):
     """
     Create list of all available GRASS commands to use when
     parsing string from the command line
     """
     gisbase = os.environ['GISBASE']
-    binlst = []
+    list = []
     if bin is True:
-        binlst = os.listdir(os.path.join(gisbase, 'bin'))
-        if subprocess.mswindows:
-            for idx in range(len(binlst)):
-                binlst[idx] = binlst[idx].replace(EXT_BIN, '')
-                binlst[idx] = binlst[idx].replace(EXT_SCT, '')
-    sctlst = []
+        list = os.listdir(os.path.join(gisbase, 'bin'))
     if scripts is True:
-        sctlst = sctlst + os.listdir(os.path.join(gisbase, 'scripts'))
-        if subprocess.mswindows:
-            for idx in range(len(binlst)):
-                binlst[idx] = binlst[idx].replace(EXT_BIN, '')
-                binlst[idx] = binlst[idx].replace(EXT_SCT, '')
+        list = list + os.listdir(os.path.join(gisbase, 'scripts')) 
+    if gui_scripts is True:
+        os.environ["PATH"] = os.getenv("PATH") + ':%s' % os.path.join(gisbase, 'etc', 'gui', 'scripts')
+        list = list + os.listdir(os.path.join(gisbase, 'etc', 'gui', 'scripts'))
+       
+    if subprocess.mswindows:
+        for idx in range(len(list)):
+            list[idx] = list[idx].replace(EXT_BIN, '')
+            list[idx] = list[idx].replace(EXT_SCT, '')
 
-    # self.gcmdlst = self.gcmdlst + os.listdir(os.path.join(gisbase,'etc','gm','script'))
+    return list
 
-    return binlst + sctlst
-
 """@brief Collected GRASS-relared binaries/scripts"""
 grassCmd = {}
 grassCmd['all'] = __getGRASSCmds()



More information about the grass-commit mailing list