[GRASS-SVN] r40021 - grass/branches/develbranch_6/gui/wxpython

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 15 08:52:15 EST 2009


Author: hamish
Date: 2009-12-15 08:52:14 -0500 (Tue, 15 Dec 2009)
New Revision: 40021

Modified:
   grass/branches/develbranch_6/gui/wxpython/wxgui.py
Log:
more xterm cleaning, add xmon true/false switch for g.setproj

Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py	2009-12-15 13:10:55 UTC (rev 40020)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py	2009-12-15 13:52:14 UTC (rev 40021)
@@ -948,58 +948,55 @@
     
                 self.goutput.RunCmd(cmdlist)
 
-    def OnXTerm(self, event):
+    def OnXTerm(self, event, need_xmon = True):
         """
         Run commands that need interactive xmon
         """
-        command = self.GetMenuCmd(event)
-
         # unset display mode
         del os.environ['GRASS_RENDER_IMMEDIATE']
 
-        # open next available xmon
-        xmonlist = []
-        gisbase = os.environ['GISBASE']
+        if(need_xmon):
+            # open next available xmon
+            xmonlist = []
 
-        # make list of xmons that are not running
-        ret = gcmd.RunCommand('d.mon',
-                              flags = 'L',
-                              read = True)
+            # make list of xmons that are not running
+            ret = gcmd.RunCommand('d.mon',
+                                  flags = 'L',
+                                  read = True)
 
-        for line in ret.split('\n'):               
-            line = line.strip()
-            if line.startswith('x') and 'not running' in line:
-                xmonlist.append(line[0:2])
+            for line in ret.split('\n'):               
+                line = line.strip()
+                if line.startswith('x') and 'not running' in line:
+                    xmonlist.append(line[0:2])
 
-        # find available xmon
-        xmon = xmonlist[0]
-        
+            # find available xmon
+            xmon = xmonlist[0]
+
+            # bring up the xmon
+            cmdlist = ['d.mon', xmon]
+            p = gcmd.Command(cmdlist, wait=False)
+
+
         # run the command        
+        command = self.GetMenuCmd(event)
         command = ' '.join(command)
 
-        # bring up the xmon
-        cmdlist = ['d.mon', xmon]
-        p = gcmd.Command(cmdlist, wait=False)
+        gisbase = os.environ['GISBASE']
 
-        if sys.platform == "darwin":
-            try:
-                cmdlist = ['xterm', '-e', command]
-                q = gcmd.Command(cmdlist, wait=False)
-            except:
-                wx.MessageBox(_('Requires an xterm and could not find an xterm to launch'),
-                              _('Command %s could not be run') % cmdlist[0])
-
+        if 'OS' in os.environ and os.environ['OS'] == "Windows_NT":
+            runbat = os.path.join(gisbase,'etc','grass-run.bat')
+            cmdlist = ["cmd.exe", "/c", 'start "%s"' % runbat, command]
         else:
-            if 'OS' in os.environ and os.environ['OS'] == "Windows_NT":
-                runbat = os.path.join(gisbase,'etc','grass-run.bat')
-                cmdlist = ["cmd.exe", "/c", 'start "%s"' % runbat, command]
+            if sys.platform == "darwin":
+                xtermwrapper = os.path.join(gisbase,'etc','grass-xterm-mac')
             else:
                 xtermwrapper = os.path.join(gisbase,'etc','grass-xterm-wrapper')
-                grassrun = os.path.join(gisbase,'etc','grass-run.sh')
-                cmdlist = [xtermwrapper, '-e', grassrun, command]
 
-            p = gcmd.Command(cmdlist, wait=False)
+            grassrun = os.path.join(gisbase,'etc','grass-run.sh')
+            cmdlist = [xtermwrapper, '-e', grassrun, command]
 
+        p = gcmd.Command(cmdlist, wait=False)
+
         # reset display mode
         os.environ['GRASS_RENDER_IMMEDIATE'] = 'TRUE'
         



More information about the grass-commit mailing list