[GRASS-SVN] r49488 - grass/trunk/gui/wxpython/modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 2 07:33:57 EST 2011


Author: martinl
Date: 2011-12-02 04:33:57 -0800 (Fri, 02 Dec 2011)
New Revision: 49488

Modified:
   grass/trunk/gui/wxpython/modules/vclean.py
Log:
wxGUI/v.clean: check input parameters, define OnDone handler


Modified: grass/trunk/gui/wxpython/modules/vclean.py
===================================================================
--- grass/trunk/gui/wxpython/modules/vclean.py	2011-12-02 12:05:18 UTC (rev 49487)
+++ grass/trunk/gui/wxpython/modules/vclean.py	2011-12-02 12:33:57 UTC (rev 49488)
@@ -21,7 +21,7 @@
 
 from grass.script import core as grass
 
-from core.gcmd        import RunCommand
+from core.gcmd        import RunCommand, GError
 from core             import globalvar
 from gui_core.gselect import Select
 from core.debug       import Debug
@@ -444,13 +444,31 @@
 	else:
 	    self.selected = -1
 
+    def OnDone(self, cmd, returncode):
+        """!Command done"""
+        self.SetStatusText('')
+        
     def OnCleaningRun(self, event):
         """!Builds options and runs v.clean
         """
+        self.GetCmdStrings()
+        
+        err = list()
+        for p, name in ((self.inmap, _('Name of input vector map')),
+                        (self.outmap, _('Name for output vector map')),
+                        (self.tools_string, _('Tools')),
+                        (self.thresh_string, _('Threshold'))):
+            if not p:
+                err.append(_("'%s' not defined") % name)
+        if err:
+            GError(_("Some parameters not defined. Operation "
+                     "cancelled.\n\n%s") % '\n'.join(err),
+                   parent = self)
+            return
+        
 	self.SetStatusText(_("Executing selected cleaning operations..."))
         snum = len(self.toolslines.keys())
-	self.GetCmdStrings()
-
+        
         if self.log:
 	    cmd = [ self.cmd,
                     'input=%s' % self.inmap,
@@ -462,7 +480,7 @@
 	    if self.overwrite.IsChecked():
 		cmd.append('--overwrite')
             
-            self.log.RunCmd(cmd)
+            self.log.RunCmd(cmd, onDone = self.OnDone)
             self.parent.Raise()
         else:
 	    if self.overwrite.IsChecked():



More information about the grass-commit mailing list