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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 18 08:19:14 EDT 2010


Author: martinl
Date: 2010-05-18 08:19:14 -0400 (Tue, 18 May 2010)
New Revision: 42293

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
Log:
wxGUI: abort all commands in the queue
(merge r42292 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-05-18 12:16:21 UTC (rev 42292)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-05-18 12:19:14 UTC (rev 42293)
@@ -62,6 +62,7 @@
         self.setDaemon(True)
 
         self.parent = parent # GMConsole
+        self._want_abort_all = False
         
         self.requestQ = requestQ
         self.resultQ = resultQ
@@ -89,11 +90,15 @@
             event = wxCmdRun(cmd=args[0],
                              pid=requestId)
             wx.PostEvent(self.parent, event)
-
+            
             time.sleep(.1)
             
             self.requestCmd = callable(*args, **kwds)
-
+            if self._want_abort_all:
+                self.requestCmd.abort()
+                if self.requestQ.empty():
+                    self._want_abort_all = False
+            
             self.resultQ.put((requestId, self.requestCmd.run()))
 
             try:
@@ -130,10 +135,15 @@
             
             # send event
             wx.PostEvent(self.parent, event)
-            
-    def abort(self):
+                
+    def abort(self, abortall = True):
+        """!Abort command(s)"""
+        if abortall:
+            self._want_abort_all = True
         self.requestCmd.abort()
-    
+        if self.requestQ.empty():
+            self._want_abort_all = False
+        
 class GMConsole(wx.SplitterWindow):
     """!Create and manage output console for commands run by GUI.
     """
@@ -513,7 +523,6 @@
                                           onDone,
                                           cmdlist,
                                           self.cmd_stdout, self.cmd_stderr)                                          
-                    self.btn_abort.Enable()
                     self.cmd_output_timer.Start(50)
                     
                     return None
@@ -528,7 +537,6 @@
                                   onDone,
                                   cmdlist,
                                   self.cmd_stdout, self.cmd_stderr)                                         
-            self.btn_abort.Enable()
             self.cmd_output_timer.Start(50)
         
         return None
@@ -661,7 +669,8 @@
                 pass
         
         self.WriteCmdLog('(%s)\n%s' % (str(time.ctime()), ' '.join(event.cmd)))
-        
+        self.btn_abort.Enable()
+
     def OnCmdDone(self, event):
         """!Command done (or aborted)"""
         if self.parent.GetName() == 'Modeler':



More information about the grass-commit mailing list