[GRASS-SVN] r43271 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 25 17:37:15 EDT 2010


Author: martinl
Date: 2010-08-25 21:37:15 +0000 (Wed, 25 Aug 2010)
New Revision: 43271

Modified:
   grass/trunk/gui/wxpython/gui_modules/gmodeler.py
   grass/trunk/gui/wxpython/gui_modules/goutput.py
Log:
wxGUI/modeler: fix OnCmdRun/Done


Modified: grass/trunk/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gmodeler.py	2010-08-25 21:05:27 UTC (rev 43270)
+++ grass/trunk/gui/wxpython/gui_modules/gmodeler.py	2010-08-25 21:37:15 UTC (rev 43271)
@@ -630,6 +630,24 @@
         self.GetCanvas().Refresh()
         self.SetStatusText("", 0)
 
+    def OnCmdRun(self, event):
+        """!Run command"""
+        try:
+            action = self.GetModel().GetItems()[event.pid]
+            if hasattr(action, "task"):
+                action.Update(running = True)
+        except IndexError:
+            pass
+        
+    def OnCmdDone(self, event):
+        """!Command done (or aborted)"""
+        try:
+            action = self.GetModel().GetItems()[event.pid]
+            if hasattr(action, "task"):
+                action.Update(running = True)
+        except IndexError:
+            pass
+        
     def OnCloseWindow(self, event):
         """!Close window"""
         if self.modelChanged and \
@@ -936,7 +954,8 @@
                 
                 for action in item.GetItems():
                     for vars()[condVar] in eval(condText):
-                        self._runAction(action, params)
+                        if isinstance(action, ModelAction):
+                            self._runAction(action, params)
         
         if params:
             dlg.Destroy()
@@ -948,7 +967,7 @@
             paramsOrig = item.GetParams(dcopy = True)
             item.MergeParams(params[name])
             
-        self.SetStatusText(_('Running model...'), 0) 
+        self.SetStatusText(_('Running model...'), 0)
         self.goutput.RunCmd(command = item.GetLog(string = False),
                             onDone = self.OnDone)
             

Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-08-25 21:05:27 UTC (rev 43270)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-08-25 21:37:15 UTC (rev 43271)
@@ -665,10 +665,7 @@
     def OnCmdRun(self, event):
         """!Run command"""
         if self.parent.GetName() == 'Modeler':
-            try:
-                self.parent.GetModel().GetActions()[event.pid].Update(running = True)
-            except IndexError:
-                pass
+            self.parent.OnCmdRun(event)
         
         self.WriteCmdLog('(%s)\n%s' % (str(time.ctime()), ' '.join(event.cmd)))
         self.btn_abort.Enable()
@@ -676,10 +673,7 @@
     def OnCmdDone(self, event):
         """!Command done (or aborted)"""
         if self.parent.GetName() == 'Modeler':
-            try:
-                self.parent.GetModel().GetActions()[event.pid].Update(running = False)
-            except IndexError:
-                pass
+            self.parent.OnCmdDone(event)
         
         if event.aborted:
             # Thread aborted (using our convention of None return)



More information about the grass-commit mailing list