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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 23 07:47:28 EDT 2009


Author: martinl
Date: 2009-05-23 07:47:27 -0400 (Sat, 23 May 2009)
New Revision: 37397

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
Log:
wxGUI: attempt to fix trac #528 (wxGUI cmd: r.mapcalc fails (quoting + args with spaces)
based on ticket patch


Modified: grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py	2009-05-23 09:44:24 UTC (rev 37396)
+++ grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py	2009-05-23 11:47:27 UTC (rev 37397)
@@ -27,6 +27,8 @@
 import re
 import string
 import getopt
+import platform
+import shlex
 
 ### XML 
 import xml.sax
@@ -450,12 +452,13 @@
 
     def OnRunCmd(self, event):
         """Run command"""
-        cmd = event.GetString()
+        cmdString = event.GetString()
 
-        if cmd[:2] == 'd.' and not self.curr_page:
+        if cmdString[:2] == 'd.' and not self.curr_page:
             self.NewDisplay(show=True)
         
-        if len(cmd.split(' ')) > 1:
+        cmd = shlex.split(str(cmdString))
+        if len(cmd) > 1:
             self.goutput.RunCmd(cmd, switchPage=True)
         else:
             self.goutput.RunCmd(cmd, switchPage=False)
@@ -1019,9 +1022,9 @@
         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 = ' '.join(command)
+        command = shlex.split(str(command))
         
-        if 'OS' in os.environ and os.environ['OS'] == "Windows_NT":
+        if platform.system() == 'Windows':
             cmdlist = ["cmd.exe", "/c", 'start "%s"' % runbat, command]
         else:
             cmdlist = [xtermwrapper, '-e "%s"' % grassrun, command]



More information about the grass-commit mailing list