Преглед изворни кода

wxGUI: modeler problems with variable (https://trac.osgeo.org/grass/ticket/2782)
(merge https://trac.osgeo.org/grass/changeset/67470 from trunk)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@67835 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa пре 9 година
родитељ
комит
01ad05349f
1 измењених фајлова са 6 додато и 4 уклоњено
  1. 6 4
      gui/wxpython/gmodeler/model.py

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

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