소스 검색

wxGUI: fix CmdToTuple()
(merge https://trac.osgeo.org/grass/changeset/39507 & https://trac.osgeo.org/grass/changeset/39508 from devbr6)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39509 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 15 년 전
부모
커밋
76cc7168c6
2개의 변경된 파일18개의 추가작업 그리고 10개의 파일을 삭제
  1. 5 6
      gui/wxpython/gui_modules/render.py
  2. 13 4
      gui/wxpython/gui_modules/utils.py

+ 5 - 6
gui/wxpython/gui_modules/render.py

@@ -1,4 +1,4 @@
-"""
+"""!
 @package render
 
 Rendering map layers and overlays into map composition image
@@ -9,15 +9,14 @@ Classes:
  - Overlay
  - Map
 
-C) 2006-2008 by the GRASS Development Team
+(C) 2006-2009 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Michael Barton, Jachym Cepicky,
-Martin Landa <landa.martin gmail.com>
-
-@date 2006-2008
+@author Michael Barton
+@author Jachym Cepicky,
+@author Martin Landa <landa.martin gmail.com>
 """
 
 import os

+ 13 - 4
gui/wxpython/gui_modules/utils.py

@@ -424,10 +424,15 @@ def GetCmdString(cmd):
     if cmd[1].has_key('flags'):
         for flag in cmd[1]['flags']:
             scmd += ' -' + flag
-    for k, v in cmd[1].iteritems():
-        if k != 'flags':
-            scmd += ' %s=%s' % (k, v)
+    for flag in ('verbose', 'quiet', 'overwrite'):
+        if cmd[1].has_key(flag) and cmd[1][flag] is True:
+            scmd += ' --' + flag
     
+    for k, v in cmd[1].iteritems():
+        if k in ('flags', 'verbose', 'quiet', 'overwrite'):
+            continue
+        scmd += ' %s=%s' % (k, v)
+            
     return scmd
 
 def CmdToTuple(cmd):
@@ -437,9 +442,13 @@ def CmdToTuple(cmd):
         
     dcmd = {}
     for item in cmd[1:]:
-        if '=' in item:
+        if '=' in item: # params
             key, value = item.split('=', 1)
             dcmd[str(key)] = str(value)
+        elif item[:2] == '--': # long flags
+            flag = item[2:]
+            if flag in ('verbose', 'quiet', 'overwrite'):
+                dcmd[str(flag)] = True
         else: # -> flags
             if not dcmd.has_key('flags'):
                 dcmd['flags'] = ''