浏览代码

wxGUI: protect whitespace with quotes when copying a command

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56464 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 12 年之前
父节点
当前提交
3abcc76cbc
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      gui/wxpython/gui_core/forms.py

+ 7 - 1
gui/wxpython/gui_core/forms.py

@@ -717,7 +717,13 @@ class TaskFrame(wx.Frame):
         """!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)