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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 25 17:38:35 EDT 2010


Author: martinl
Date: 2010-08-25 21:38:35 +0000 (Wed, 25 Aug 2010)
New Revision: 43272

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
Log:
wxGUI/modeler: fix OnCmdRun/Done
(merge r43271 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-08-25 21:37:15 UTC (rev 43271)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-08-25 21:38:35 UTC (rev 43272)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-08-25 21:37:15 UTC (rev 43271)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-08-25 21:38:35 UTC (rev 43272)
@@ -664,10 +664,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()
@@ -675,10 +672,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