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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 18 08:16:23 EDT 2010


Author: martinl
Date: 2010-05-18 08:16:21 -0400 (Tue, 18 May 2010)
New Revision: 42292

Modified:
   grass/trunk/gui/wxpython/gui_modules/goutput.py
Log:
wxGUI: abort all commands in the queue


Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-05-18 11:02:40 UTC (rev 42291)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-05-18 12:16:21 UTC (rev 42292)
@@ -62,6 +62,7 @@
         self.setDaemon(True)
 
         self.parent = parent # GMConsole
+        self._want_abort_all = False
         
         self.requestQ = requestQ
         self.resultQ = resultQ
@@ -90,11 +91,15 @@
                              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:
@@ -131,10 +136,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.
     """
@@ -514,7 +524,6 @@
                                           onDone,
                                           cmdlist,
                                           self.cmd_stdout, self.cmd_stderr)                                          
-                    self.btn_abort.Enable()
                     self.cmd_output_timer.Start(50)
                     
                     return None
@@ -529,7 +538,6 @@
                                   onDone,
                                   cmdlist,
                                   self.cmd_stdout, self.cmd_stderr)                                         
-            self.btn_abort.Enable()
             self.cmd_output_timer.Start(50)
                 
         return None
@@ -662,7 +670,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