[GRASS-SVN] r39926 - grass/branches/releasebranch_6_4/gui/wxpython

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Dec 6 15:51:29 EST 2009


Author: cmbarton
Date: 2009-12-06 15:51:28 -0500 (Sun, 06 Dec 2009)
New Revision: 39926

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
Log:
Fixed so that commands requiring xterms now run on Mac. The same approach might also work in Linux but I can't test.

Modified: grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py	2009-12-06 20:45:02 UTC (rev 39925)
+++ grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py	2009-12-06 20:51:28 UTC (rev 39926)
@@ -990,21 +990,34 @@
 
         # open available xmon
         xmon = xmonlist[0]
-        cmdlist = ["d.mon","start=%s" % xmon]
-        p = gcmd.Command(cmdlist)
-
+        
         # run the command        
-        runbat = os.path.join(gisbase,'etc','grass-run.bat')
-        xtermwrapper = os.path.join(gisbase,'etc','grass-xterm-wrapper')
-        grassrun = os.path.join(gisbase,'etc','grass-run.sh')
-        command = shlex.split(str(command))
-        
-        if platform.system() == 'Windows':
-            cmdlist = ["cmd.exe", "/c", 'start "%s"' % runbat, command]
-        else:
-            cmdlist = [xtermwrapper, '-e "%s"' % grassrun, command]
-        p = gcmd.Command(cmdlist)
+        command = ' '.join(command)
+                
+        if sys.platform == "darwin":
 
+            cmdlist = ['xterm', '-e', 'd.mon', xmon]
+            p = gcmd.Command(cmdlist, wait=False)
+
+            cmdlist = ['xterm', '-e', command]
+            q = gcmd.Command(cmdlist, wait=False)
+
+        else:        
+            cmdlist = ["d.mon","start=%s" % xmon]
+            p = gcmd.Command(cmdlist)
+
+            # run the command        
+            runbat = os.path.join(gisbase,'etc','grass-run.bat')
+            xtermwrapper = os.path.join(gisbase,'etc','grass-xterm-wrapper')
+            grassrun = os.path.join(gisbase,'etc','grass-run.sh')
+            command = shlex.split(str(command))
+            
+            if platform.system() == 'Windows':
+                cmdlist = ["cmd.exe", "/c", 'start "%s"' % runbat, command]
+            else:
+                cmdlist = [xtermwrapper, '-e "%s"' % grassrun, command]
+            p = gcmd.Command(cmdlist)
+
         # reset display mode
         os.environ['GRASS_RENDER_IMMEDIATE'] = 'TRUE'
 



More information about the grass-commit mailing list