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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 8 15:17:43 EDT 2011


Author: martinl
Date: 2011-10-08 12:17:43 -0700 (Sat, 08 Oct 2011)
New Revision: 48677

Modified:
   grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
Log:
wxGUI/mcalc: minor clean up -- OnRun()


Modified: grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py	2011-10-08 00:07:47 UTC (rev 48676)
+++ grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py	2011-10-08 19:17:43 UTC (rev 48677)
@@ -416,8 +416,9 @@
 
     def OnUpdateStatusBar(self, event):
         """!Update statusbar text"""
+        expr = self.text_mcalc.GetValue().strip().replace("\n", " ")
         self.SetStatusText("r.mapcalc '%s = %s'" % (self.newmaptxt.GetValue(),
-                                                    self.text_mcalc.GetValue()))
+                                                    expr))
         event.Skip()
         
     def _addSomething(self, what):
@@ -453,19 +454,19 @@
         name = self.newmaptxt.GetValue().strip()
         if not name:
             gcmd.GError(parent = self,
-                        message = _("You must enter the name of a new map to create"))
+                        message = _("You must enter the name of "
+                                    "a new raster map to create."))
             return
         
-        if not self.text_mcalc.GetValue().strip():
+        expr = self.text_mcalc.GetValue().strip().replace("\n", " ")
+        if not expr:
             gcmd.GError(parent = self,
-                        message = _("You must enter a mapcalc statement to create a new map"))
+                        message = _("You must enter an expression "
+                                    "to create a new raster map."))
             return
         
-        mctxt = self.text_mcalc.GetValue().strip().replace("\n"," ")
-        mctxt = mctxt.replace(" " , "")
-        
         if self.log:
-            cmd = [self.cmd, str('expression=%s = %s' % (name, mctxt))]
+            cmd = [self.cmd, str('expression=%s = %s' % (name, expr))]
             if self.overwrite.IsChecked():
                 cmd.append('--overwrite')
             self.log.RunCmd(cmd, onDone = self.OnDone)
@@ -476,7 +477,7 @@
             else:
                 overwrite = False
             gcmd.RunCommand(self.cmd,
-                            expression = "%s=%s" % (name, mctxt),
+                            expression = "%s=%s" % (name, expr),
                             overwrite = overwrite)
         
     def OnDone(self, cmd, returncode):



More information about the grass-commit mailing list