[GRASS-SVN] r56464 - grass/trunk/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 29 04:57:03 PDT 2013


Author: mmetz
Date: 2013-05-29 04:57:03 -0700 (Wed, 29 May 2013)
New Revision: 56464

Modified:
   grass/trunk/gui/wxpython/gui_core/forms.py
Log:
wxGUI: protect whitespace with quotes when copying a command

Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2013-05-29 11:57:01 UTC (rev 56463)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2013-05-29 11:57:03 UTC (rev 56464)
@@ -717,7 +717,13 @@
         """!Copy the command"""
         cmddata = wx.TextDataObject()
         # list -> string
-        cmdstring = ' '.join(self.createCmd(ignoreErrors = True))
+	cmdlist = self.createCmd(ignoreErrors = True)
+	# TODO: better protect whitespace with quotes
+	for i in range(1, len(cmdlist)):
+	    if ' ' in cmdlist[i]:
+		optname, val =  cmdlist[i].split("=")
+		cmdlist[i] = '%s="%s"' % (optname, val)
+        cmdstring = ' '.join(cmdlist)
         cmddata.SetText(cmdstring)
         if wx.TheClipboard.Open():
 #            wx.TheClipboard.UsePrimarySelection(True)



More information about the grass-commit mailing list