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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 3 07:50:53 EST 2012


Author: martinl
Date: 2012-01-03 04:50:52 -0800 (Tue, 03 Jan 2012)
New Revision: 50048

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/globalvar.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI: check GRASS_ADDON_PATH, workaround for bash addons scripts on Windows

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/globalvar.py	2012-01-03 12:07:05 UTC (rev 50047)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/globalvar.py	2012-01-03 12:50:52 UTC (rev 50048)
@@ -152,12 +152,27 @@
         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 os.getenv('GRASS_ADDON_PATH'):
+        for path in os.getenv('GRASS_ADDON_PATH').split(os.pathsep):
+            if not os.path.exists(path) or not os.path.isdir(path):
+                continue
+            for fname in os.listdir(path):
+                name, ext = os.path.splitext(fname)
+                if bin:
+                    if ext == EXT_BIN:
+                        cmd.append(name)
+                if scripts:
+                    if ext == EXT_SCT:
+                        cmd.append(name)
+                    elif ext == '.py':
+                        cmd.append(fname)
+        
     if sys.platform == 'win32':
         for idx in range(len(cmd)):
             name, ext = os.path.splitext(cmd[idx])
             if ext in (EXT_BIN, EXT_SCT):
                 cmd[idx] = name
-
+    
     return cmd
 
 """@brief Collected GRASS-relared binaries/scripts"""

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2012-01-03 12:07:05 UTC (rev 50047)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2012-01-03 12:50:52 UTC (rev 50048)
@@ -515,6 +515,9 @@
             
             else:
                 # other GRASS commands (r|v|g|...)
+                if sys.platform == 'win32':
+                    if command[0] in globalvar.grassCmd['script']:
+                        command[0] += globalvar.EXT_SCT
                 task = menuform.GUI(show = None).ParseCommand(command)
                 hasParams = False
                 if task:

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py	2012-01-03 12:07:05 UTC (rev 50047)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py	2012-01-03 12:50:52 UTC (rev 50048)
@@ -1940,6 +1940,9 @@
     if sys.argv[1] !=  'test':
         q = wx.LogNull()
         cmd = utils.split(sys.argv[1])
+        if sys.platform == 'win32':
+            if cmd[0] in globalvar.grassCmd['script']:
+                cmd[0] += globalvar.EXT_SCT
         task = gtask.grassTask(cmd[0], blackList = _blackList)
         task.set_options(cmd[1:])
         app = GrassGUIApp(task)

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py	2012-01-03 12:07:05 UTC (rev 50047)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py	2012-01-03 12:50:52 UTC (rev 50048)
@@ -800,6 +800,9 @@
                 self.UpdateCmdHistory([cmd])
                 self.OnCmdErase(None)
             else:
+                if sys.platform == 'win32':
+                    if cmd in globalvar.grassCmd['script']:
+                        cmd += globalvar.EXT_SCT
                 try:
                     self.cmdDesc = gtask.parse_interface(cmd)
                 except IOError:
@@ -1033,6 +1036,10 @@
             if cmd not in globalvar.grassCmd['all']:
                 return
             
+            if sys.platform == 'win32':
+                if cmd in globalvar.grassCmd['script']:
+                    cmd += globalvar.EXT_SCT
+            
             info = gtask.command_info(cmd)
             
             self.CallTipSetBackground("#f4f4d1")
@@ -1109,6 +1116,9 @@
                 if cmd in globalvar.grassCmd['all'] and \
                         cmd != 'r.mapcalc' and \
                         (not self.cmdDesc or cmd != self.cmdDesc.get_name()):
+                    if sys.platform == 'win32':
+                        if cmd in globalvar.grassCmd['script']:
+                            cmd += globalvar.EXT_SCT
                     try:
                         self.cmdDesc = gtask.parse_interface(cmd)
                     except IOError:



More information about the grass-commit mailing list