[GRASS-SVN] r52329 - grass/branches/develbranch_6/gui/wxpython/gmodeler
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 6 11:32:43 PDT 2012
Author: martinl
Date: 2012-07-06 11:32:42 -0700 (Fri, 06 Jul 2012)
New Revision: 52329
Modified:
grass/branches/develbranch_6/gui/wxpython/gmodeler/model.py
Log:
wxGUI/modeler: encode model properties and substitute variables when
exporting to python
(merge r52328 from devbr6)
Modified: grass/branches/develbranch_6/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gmodeler/model.py 2012-07-06 18:19:02 UTC (rev 52328)
+++ grass/branches/develbranch_6/gui/wxpython/gmodeler/model.py 2012-07-06 18:32:42 UTC (rev 52329)
@@ -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