[GRASS-SVN] r41851 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 13 14:44:26 EDT 2010


Author: martinl
Date: 2010-04-13 14:44:22 -0400 (Tue, 13 Apr 2010)
New Revision: 41851

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/globalvar.py
Log:
wxGUI: GetGRASSCmds() sync'ed with devbr6


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/globalvar.py	2010-04-13 18:40:54 UTC (rev 41850)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/globalvar.py	2010-04-13 18:44:22 UTC (rev 41851)
@@ -115,29 +115,31 @@
     EXT_SCT = ''
 
 def GetGRASSCmds(bin=True, scripts=True, gui_scripts=True):
-    """
-    Create list of all available GRASS commands to use when
+    """!Create list of all available GRASS commands to use when
     parsing string from the command line
     """
     gisbase = os.environ['GISBASE']
-    list = []
+    cmd = list()
     if bin is True:
-        list = os.listdir(os.path.join(gisbase, 'bin'))
+        for file in os.listdir(os.path.join(gisbase, 'bin')):
+            if not EXT_BIN or file[-4:] == EXT_BIN:
+                cmd.append(file)
+        
         # add special call for setting vector colors
-        list.append('vcolors')
+        cmd.append('vcolors')
     if scripts is True:
-        list = list + os.listdir(os.path.join(gisbase, 'scripts')) 
+        cmd = cmd + os.listdir(os.path.join(gisbase, 'scripts')) 
     if gui_scripts is True:
         os.environ["PATH"] = os.getenv("PATH") + os.pathsep + os.path.join(gisbase, 'etc', 'gui', 'scripts')
-        list = list + os.listdir(os.path.join(gisbase, 'etc', 'gui', 'scripts'))
+        cmd = cmd + 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, '')
+        for idx in range(len(cmd)):
+            cmd[idx] = cmd[idx].replace(EXT_BIN, '')
+            cmd[idx] = cmd[idx].replace(EXT_SCT, '')
+    
+    return cmd
 
-    return list
-
 """@brief Collected GRASS-relared binaries/scripts"""
 grassCmd = {}
 grassCmd['all'] = GetGRASSCmds()



More information about the grass-commit mailing list