[GRASS-SVN] r42338 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 24 10:12:57 EDT 2010


Author: martinl
Date: 2010-05-24 10:12:57 -0400 (Mon, 24 May 2010)
New Revision: 42338

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
Log:
wxGUI/modeler: implement cleanup()
(merge r42337 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-05-24 14:08:57 UTC (rev 42337)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-05-24 14:12:57 UTC (rev 42338)
@@ -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