[GRASS-SVN] r52348 - grass/branches/releasebranch_6_4/gui/wxpython/gmodeler
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 8 03:10:47 PDT 2012
Author: martinl
Date: 2012-07-08 03:10:47 -0700 (Sun, 08 Jul 2012)
New Revision: 52348
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gmodeler/model.py
Log:
wxGUI/modeler: encode model properties and substitute variables when
exporting to python
(merge r52329 from devbr6)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gmodeler/model.py 2012-07-08 09:07:51 UTC (rev 52347)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gmodeler/model.py 2012-07-08 10:10:47 UTC (rev 52348)
@@ -1990,7 +1990,7 @@
self.fd.write(
r"""#!/usr/bin/env python
#
-############################################################################
+#%s
#
# MODULE: %s
#
@@ -2000,11 +2000,13 @@
#
# DATE: %s
#
-#############################################################################
-""" % (properties['name'],
- properties['author'],
- properties['description'],
- time.asctime()))
+#%s
+""" % ('#' * 79,
+ properties['name'],
+ EncodeString(properties['author']),
+ EncodeString('\n# '.join(properties['description'].splitlines())),
+ time.asctime(),
+ '#' * 79))
self.fd.write(
r"""
@@ -2100,7 +2102,7 @@
def _writePythonAction(self, item, variables = []):
"""!Write model action to Python file"""
- task = GUI(show = None).ParseCommand(cmd = item.GetLog(string = False))
+ task = GUI(show = None).ParseCommand(cmd = item.GetLog(string = False, substitute = self.model.GetVariables()))
strcmd = "%sgrass.run_command(" % (' ' * self.indent)
self.fd.write(strcmd + self._getPythonActionCmd(task, len(strcmd), variables) + '\n')
@@ -2118,7 +2120,7 @@
params.append('%s = True' % name)
else:
flags += name
-
+
for p in opts['params']:
name = p.get('name', None)
value = p.get('value', None)
More information about the grass-commit
mailing list