Prechádzať zdrojové kódy

wxGUI/mcalc: minor clean up -- OnRun()

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48677 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 rokov pred
rodič
commit
ee0625880d
1 zmenil súbory, kde vykonal 10 pridanie a 9 odobranie
  1. 10 9
      gui/wxpython/gui_modules/mcalc_builder.py

+ 10 - 9
gui/wxpython/gui_modules/mcalc_builder.py

@@ -416,8 +416,9 @@ class MapCalcFrame(wx.Frame):
 
     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 @@ class MapCalcFrame(wx.Frame):
         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 @@ class MapCalcFrame(wx.Frame):
             else:
                 overwrite = False
             gcmd.RunCommand(self.cmd,
-                            expression = "%s=%s" % (name, mctxt),
+                            expression = "%s=%s" % (name, expr),
                             overwrite = overwrite)
         
     def OnDone(self, cmd, returncode):