瀏覽代碼

wxGUI: modeler problems with variable (https://trac.osgeo.org/grass/ticket/2782)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67470 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 年之前
父節點
當前提交
4c3dda3736
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      gui/wxpython/gmodeler/model.py

+ 6 - 4
gui/wxpython/gmodeler/model.py

@@ -2515,15 +2515,15 @@ if __name__ == "__main__":
         """
         """
         result = ''
         result = ''
         ss = re.split("\w*(%"+variable+")w*", string)
         ss = re.split("\w*(%"+variable+")w*", string)
-
-        if not ss[0]:
+        
+        if not ss[0] and not ss[-1]:
             if data:
             if data:
                 return "options['%s']" % variable
                 return "options['%s']" % variable
             else:
             else:
                 return variable
                 return variable
         
         
         for s in ss:
         for s in ss:
-            if s == '"':
+            if not s or s == '"':
                 continue
                 continue
             
             
             if s == '%' + variable:
             if s == '%' + variable:
@@ -2532,7 +2532,9 @@ if __name__ == "__main__":
                 else:
                 else:
                     result += '+%s+' % variable
                     result += '+%s+' % variable
             else:
             else:
-                result += '"' + s + '"'
+                result += '"' + s
+                if not s.endswith(']'): # options
+                    result += '"'
         
         
         return result.strip('+')
         return result.strip('+')