[GRASS-SVN] r42337 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 24 10:08:58 EDT 2010
Author: martinl
Date: 2010-05-24 10:08:57 -0400 (Mon, 24 May 2010)
New Revision: 42337
Modified:
grass/trunk/gui/wxpython/gui_modules/gmodeler.py
Log:
wxGUI/modeler: implement cleanup()
Modified: grass/trunk/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gmodeler.py 2010-05-24 09:28:15 UTC (rev 42336)
+++ grass/trunk/gui/wxpython/gui_modules/gmodeler.py 2010-05-24 14:08:57 UTC (rev 42337)
@@ -810,14 +810,32 @@
import grass.script as grass
import atexit
""")
-
+
+ # cleanup()
+ rast, vect, rast3d, msg = self.model.GetIntermediateData()
fd.write(
r"""
def cleanup():
- pass
""")
-
+ if rast:
+ fd.write(
+r""" grass.run_command('g.remove',
+ rast=%s)
+""" % ','.join(map(lambda x: "'" + x + "'", rast)))
+ if vect:
+ fd.write(
+r""" grass.run_command('g.remove',
+ vect = %s)
+""" % ','.join(map(lambda x: "'" + x + "'", vect)))
+ if rast3d:
+ fd.write(
+r""" grass.run_command('g.remove',
+ rast3d = %s)
+""" % ','.join(map(lambda x: "'" + x + "'", rast3d)))
+ if not rast and not vect and not rast3d:
+ fd.write(' pass\n')
+
fd.write("\ndef main():\n")
for action in self.model.GetActions():
task = menuform.GUI().ParseCommand(cmd = action.GetLog(string = False),
More information about the grass-commit
mailing list