[GRASS-SVN] r44102 - in grass/branches/develbranch_6: gui/wxpython/gui_modules lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 30 11:44:02 EDT 2010


Author: martinl
Date: 2010-10-30 08:44:02 -0700 (Sat, 30 Oct 2010)
New Revision: 44102

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/lib/python/core.py
Log:
grass.find_program(): Windows-related fix

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-10-30 12:44:23 UTC (rev 44101)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-10-30 15:44:02 UTC (rev 44102)
@@ -700,7 +700,8 @@
         self.cmd_output_timer.Stop()
 
         # set focus on prompt
-        if self.parent.GetName() == "LayerManager":
+        if self.parent.GetName() == "LayerManager" and \
+                event.cmd[0] in globalvar.grassCmd['all']:
             self.btn_abort.Enable(False)
             display = self.parent.GetLayerTree().GetMapDisplay()
             if display and display.IsAutoRendered():

Modified: grass/branches/develbranch_6/lib/python/core.py
===================================================================
--- grass/branches/develbranch_6/lib/python/core.py	2010-10-30 12:44:23 UTC (rev 44101)
+++ grass/branches/develbranch_6/lib/python/core.py	2010-10-30 15:44:02 UTC (rev 44102)
@@ -767,19 +767,25 @@
 # find a program (replacement for "which")
 
 def find_program(pgm, args = []):
-    """!Attempt to run a program, with optional arguments. Return False
-    if the attempt failed due to a missing executable, True otherwise
+    """!Attempt to run a program, with optional arguments. 
 
     @param pgm program name
     @param args list of arguments
+
+    @return False if the attempt failed due to a missing executable
+    @return True otherwise
     """
     nuldev = file(os.devnull, 'w+')
     try:
-	call([pgm] + args, stdin = nuldev, stdout = nuldev, stderr = nuldev)
-	found = True
+	ret = call([pgm] + args, stdin = nuldev, stdout = nuldev, stderr = nuldev)
+        if ret == 0:
+            found = True
+        else:
+            found = False
     except:
 	found = False
     nuldev.close()
+    
     return found
 
 # try to remove a file, without complaints



More information about the grass-commit mailing list