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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 4 10:11:23 EDT 2011


Author: martinl
Date: 2011-08-04 07:11:23 -0700 (Thu, 04 Aug 2011)
New Revision: 47434

Modified:
   grass/trunk/gui/wxpython/gui_modules/psmap.py
   grass/trunk/gui/wxpython/gui_modules/psmap_dialogs.py
   grass/trunk/gui/wxpython/gui_modules/render.py
   grass/trunk/gui/wxpython/gui_modules/utils.py
Log:
wxGUI: fix gettext warnings


Modified: grass/trunk/gui/wxpython/gui_modules/psmap.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/psmap.py	2011-08-04 13:45:23 UTC (rev 47433)
+++ grass/trunk/gui/wxpython/gui_modules/psmap.py	2011-08-04 14:11:23 UTC (rev 47434)
@@ -1098,7 +1098,7 @@
                     self.SetCursor(self.cursors["sizenwse"])
                     self.parent.SetStatusText(_('Click and drag to resize object'), 0)
                 else:
-                    self.parent.SetStatusText(_(''), 0)
+                    self.parent.SetStatusText('', 0)
                     self.SetCursor(self.cursors["default"])
                     
         elif event.LeftDown():

Modified: grass/trunk/gui/wxpython/gui_modules/psmap_dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/psmap_dialogs.py	2011-08-04 13:45:23 UTC (rev 47433)
+++ grass/trunk/gui/wxpython/gui_modules/psmap_dialogs.py	2011-08-04 14:11:23 UTC (rev 47434)
@@ -738,7 +738,8 @@
 
                 scale = 1/float(scaleText)
                 if abs(scale - self.instruction['scale']) > (0.01 * scale):
-                    GWarning(_("Scale has changed, old value: %s\nnew value: %s") % (scale, self.instruction['scale']))
+                    GWarning(_("Scale has changed, old value: %(old)s\nnew value: %(new)s") % \
+                                 { 'old' : scale, 'new' : self.instruction['scale'] })
             except (ValueError, IndexError):
                 GError(_("Failed to read instruction %s.\nUse 1:25000 notation.") % instruction)
                 return False
@@ -748,15 +749,17 @@
             if len(maploc) >= 2:
                 if  abs(self.instruction['rect'].Get()[0] - float(maploc[0])) > 0.5 or \
                         abs(self.instruction['rect'].Get()[1] - float(maploc[1])) > 0.5:
-                    GWarning(_("Map frame position changed, old value: %s %s\nnew value: %s %s") % \
-                                 (maploc[0], maploc[1], self.instruction['rect'].Get()[0], self.instruction['rect'].Get()[1]))
+                    GWarning(_("Map frame position changed, old value: %(old1)s %(old2)s\nnew value: %(new1)s %(new2)s") % \
+                                 { 'old1' : maploc[0], 'old2' : maploc[1],
+                                   'new1' : self.instruction['rect'].Get()[0], 'new2' : self.instruction['rect'].Get()[1] })
                     
                 #instr['rect'] = wx.Rect2D(float(maploc[0]), float(maploc[1]), self.instruction['rect'][2], self.instruction['rect'][3])
             if len(maploc) == 4:
                 if  abs(self.instruction['rect'].Get()[2] - float(maploc[2])) > 0.5 or \
                         abs(self.instruction['rect'].Get()[3] - float(maploc[3])) > 0.5:
-                    GWarning(_("Map frame size changed, old value: %s %s\nnew value: %s %s") %(
-                            maploc[2], maploc[3], self.instruction['rect'].Get()[2], self.instruction['rect'].Get()[3]))
+                    GWarning(_("Map frame size changed, old value: %(old1)s %(old2)s\nnew value: %(new1)s %(new2)s") % \
+                                 { 'old1' : maploc[2], 'old2' : maploc[3],
+                                   'new1' : self.instruction['rect'].Get()[2], 'new2' : self.instruction['rect'].Get()[3] })
                 #instr['rect'] = wx.Rect2D(*map(float, maploc))
         self.instruction.update(instr)   
         return True 
@@ -801,7 +804,8 @@
                                 instr[key] = float(value)
                             break
                         except KeyError:
-                            GError(_("Failed to read instruction %s.\nUnknown format %s") % (instruction, format))
+                            GError(_("Failed to read instruction %(file)s.\nUnknown format %(for)s") % \
+                                       { 'file' : instruction, 'for' : format })
                             return False
                         
                     else:
@@ -2208,8 +2212,8 @@
                 stype = 'region'
                 self.select.SetElementList(type = stype)
                 self.mapText.SetLabel(self.mapOrRegionText[1])
-                self.select.SetToolTipString(_(""))
-                
+                self.select.SetToolTipString("")
+
             for each in self.mapSizer.GetChildren():
                 each.GetWindow().Enable()
             for each in self.centerSizer.GetChildren():
@@ -3815,7 +3819,8 @@
         rasterType = getRasterType(map = self.currRaster)
 
         self.rasterCurrent = wx.StaticText(panel, id = wx.ID_ANY,
-                                label = _("%s: type %s" % (self.currRaster, rasterType)))
+                                label = _("%(rast)s: type %(type)s") % { 'rast' : self.currRaster,
+                                                                         'type' : rasterType })
         self.rasterSelect = Select(panel, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE,
                                     type = 'raster', multiple = False,
                                     updateOnPopup = True, onPopup = None)
@@ -4523,9 +4528,10 @@
             currRaster = raster['raster'] 
         else:
             currRaster = None
-
+            
         rasterType = getRasterType(map = currRaster)
-        self.rasterCurrent.SetLabel(_("%s: type %s") % (currRaster, str(rasterType)))
+        self.rasterCurrent.SetLabel(_("%(rast)s: type %(type)s") % \
+                                        { 'rast' : currRaster, 'type' : str(rasterType) })
         
         # vector legend
         

Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py	2011-08-04 13:45:23 UTC (rev 47433)
+++ grass/trunk/gui/wxpython/gui_modules/render.py	2011-08-04 14:11:23 UTC (rev 47434)
@@ -154,8 +154,9 @@
                                            **self.cmd[1])
                 
             if ret != 0:
-                raise gcmd.GException(value = _("'%s' failed. Details: %s") % (self.cmd[0], msg))
-            
+                raise gcmd.GException(value = _("'%(cmd)s' failed. Details: %(det)s") % \
+                                          { 'cmd' : self.cmd[0], 'det' : msg })
+        
         except gcmd.GException, e:
             print >> sys.stderr, e.value
             # clean up after problems
@@ -563,8 +564,8 @@
             for k, v in data.iteritems():
                 fd.write('%s=%s\n' % (k.strip(), str(v).strip()))
         except IOError, e:
-            grass.warning(_("Unable to open file '%s' for writting. Details: %s") % \
-                              (self.envfile, e))
+            grass.warning(_("Unable to open file '%(file)s' for writting. Details: %(det)s") % \
+                              { 'cmd' : self.envfile, 'det' : e })
             return
         
         fd.close()
@@ -877,8 +878,8 @@
             gcmd.RunCommand('g.gisenv',
                             set = 'MONITOR_%s_CMDFILE=%s' % (self.monitor, self.cmdfile))
         except IOError, e:
-            grass.warning(_("Unable to read cmdfile '%s'. Details: %s") % \
-                              (self.cmdfile, e))
+            grass.warning(_("Unable to read cmdfile '%(cmd)s'. Details: %(det)s") % \
+                              { 'cmd' : self.cmdfile, 'det' : e })
             return
         
         fd.close()

Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py	2011-08-04 13:45:23 UTC (rev 47433)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py	2011-08-04 14:11:23 UTC (rev 47434)
@@ -298,7 +298,7 @@
                                     map = fullname,
                                     fs = ';')
     if ret != 0:
-        sys.stderr.write(_("Vector map <%s>: %s\n") % (fullname, msg))
+        sys.stderr.write(_("Vector map <%(map)s>: %(msg)s\n") % { 'map' : fullname, 'msg' : msg })
         return layers
     else:
         Debug.msg(1, "GetVectorNumberOfLayers(): ret %s" % ret)



More information about the grass-commit mailing list