[GRASS-SVN] r50049 - in grass/branches/develbranch_6/gui/wxpython: core gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 3 07:56:47 EST 2012


Author: martinl
Date: 2012-01-03 04:56:47 -0800 (Tue, 03 Jan 2012)
New Revision: 50049

Modified:
   grass/branches/develbranch_6/gui/wxpython/core/globalvar.py
   grass/branches/develbranch_6/gui/wxpython/gui_core/forms.py
   grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_core/prompt.py
Log:
wxGUI: check GRASS_ADDON_PATH, workaround for bash addons scripts on Windows
       (merge r50048 from relbr64)


Modified: grass/branches/develbranch_6/gui/wxpython/core/globalvar.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/globalvar.py	2012-01-03 12:50:52 UTC (rev 50048)
+++ grass/branches/develbranch_6/gui/wxpython/core/globalvar.py	2012-01-03 12:56:47 UTC (rev 50049)
@@ -143,7 +143,6 @@
         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'))
     
-
     # scan addons (path)
     if os.getenv('GRASS_ADDON_PATH'):
         for path in os.getenv('GRASS_ADDON_PATH').split(os.pathsep):
@@ -151,10 +150,14 @@
                 continue
             for fname in os.listdir(path):
                 name, ext = os.path.splitext(fname)
-                if ext in [EXT_BIN, EXT_SCT]:
-                    cmd.append(name)
-                else:
-                    cmd.append(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)
     
     return set(cmd)
 

Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/forms.py	2012-01-03 12:50:52 UTC (rev 50048)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/forms.py	2012-01-03 12:56:47 UTC (rev 50049)
@@ -1944,6 +1944,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])
         task.set_options(cmd[1:])
         app = GrassGUIApp(task)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py	2012-01-03 12:50:52 UTC (rev 50048)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py	2012-01-03 12:56:47 UTC (rev 50049)
@@ -522,6 +522,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 = GUI(show = None).ParseCommand(command)
                 hasParams = False
                 if task:

Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/prompt.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/prompt.py	2012-01-03 12:50:52 UTC (rev 50048)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/prompt.py	2012-01-03 12:56:47 UTC (rev 50049)
@@ -803,6 +803,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:
@@ -1042,6 +1045,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")
@@ -1118,6 +1125,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