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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 15 16:07:43 EDT 2009


Author: martinl
Date: 2009-06-15 16:07:40 -0400 (Mon, 15 Jun 2009)
New Revision: 37896

Modified:
   grass/trunk/gui/wxpython/gui_modules/goutput.py
Log:
wxGUI: abort running command button


Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2009-06-15 19:31:54 UTC (rev 37895)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2009-06-15 20:07:40 UTC (rev 37896)
@@ -140,6 +140,11 @@
                                             range=100, pos=(110, 50), size=(-1, 25),
                                             style=wx.GA_HORIZONTAL)
         self.console_progressbar.Bind(EVT_CMD_PROGRESS, self.OnCmdProgress)
+        # abort
+        self.btn_abort = wx.Button(parent=self, id=wx.ID_STOP)
+        self.btn_abort.SetToolTipString(_("Abort the running command"))
+        self.btn_abort.Bind(wx.EVT_BUTTON, self.OnCmdAbort)
+        self.btn_abort.Enable(False)
         
         #
         # text control for command output
@@ -190,9 +195,16 @@
         boxsizer1.Add(item=gridsizer1, proportion=0,
                       flag=wx.EXPAND | wx.ALIGN_CENTRE_VERTICAL | wx.TOP | wx.BOTTOM,
                       border=5)
-        boxsizer1.Add(item=self.console_progressbar, proportion=0,
-                      flag=wx.EXPAND | wx.ADJUST_MINSIZE | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
-
+        boxsizer2 = wx.BoxSizer(wx.HORIZONTAL)
+        boxsizer2.Add(item=self.console_progressbar, proportion=1,
+                      flag=wx.EXPAND | wx.ALIGN_CENTRE_VERTICAL)
+        boxsizer2.Add(item=self.btn_abort, proportion=0,
+                      flag=wx.ALIGN_CENTRE_VERTICAL | wx.LEFT,
+                      border = 5)
+        boxsizer1.Add(item=boxsizer2, proportion=0,
+                      flag=wx.EXPAND | wx.ALIGN_CENTRE_VERTICAL | wx.ALL,
+                      border=5)
+        
         boxsizer1.Fit(self)
         boxsizer1.SetSizeHints(self)
 
@@ -357,7 +369,7 @@
                                           onDone,
                                           cmdlist,
                                           self.cmd_stdout, self.cmd_stderr)                                          
-                    
+                    self.btn_abort.Enable()
                     self.cmd_output_timer.Start(50)
 
                     return None
@@ -489,7 +501,7 @@
     def OnCmdRun(self, event):
         """!Run command"""
         self.WriteCmdLog('(%s)\n%s' % (str(time.ctime()), ' '.join(event.cmd)))
-
+        
     def OnCmdDone(self, event):
         """!Command done (or aborted)"""
         if event.aborted:
@@ -521,6 +533,7 @@
         # set focus on prompt
         if self.parent.GetName() == "LayerManager":
             self.parent.cmdinput.SetFocus()
+            self.btn_abort.Enable(False)
         else:
             # updated command dialog
             dialog = self.parent.parent



More information about the grass-commit mailing list