[GRASS-SVN] r50514 - in grass/branches/develbranch_6/gui/wxpython: gmodeler gui_core modules psmap wxplot

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 28 05:07:06 EST 2012


Author: martinl
Date: 2012-01-28 02:07:06 -0800 (Sat, 28 Jan 2012)
New Revision: 50514

Modified:
   grass/branches/develbranch_6/gui/wxpython/gmodeler/model.py
   grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py
   grass/branches/develbranch_6/gui/wxpython/modules/colorrules.py
   grass/branches/develbranch_6/gui/wxpython/psmap/dialogs.py
   grass/branches/develbranch_6/gui/wxpython/wxplot/base.py
Log:
wxGUI: fix gettext warning


Modified: grass/branches/develbranch_6/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gmodeler/model.py	2012-01-28 09:50:17 UTC (rev 50513)
+++ grass/branches/develbranch_6/gui/wxpython/gmodeler/model.py	2012-01-28 10:07:06 UTC (rev 50514)
@@ -385,7 +385,7 @@
                                 report = False
                                 break
                         if report:
-                            errList.append(_("%s: undefined variable '%s'") % (cmd[0], var))
+                            errList.append(cmd[0] + ": " + _("undefined variable '%s'") % var)
             ### TODO: check variables in file only optionally
             ### errList += self._substituteFile(action, checkOnly = True)
         
@@ -447,7 +447,7 @@
             if sval:
                 var = sval.group(2).strip()[1:] # ignore '%'
                 cmd = item.GetLog(string = False)[0]
-                errList.append(_("%s: undefined variable '%s'") % (cmd, var))
+                errList.append(cmd + ": " + _("undefined variable '%s'") % var)
             
             if not checkOnly:
                 if write:

Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py	2012-01-28 09:50:17 UTC (rev 50513)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py	2012-01-28 10:07:06 UTC (rev 50514)
@@ -759,35 +759,30 @@
         """!Command done (or aborted)"""
         if self.parent.GetName() == 'Modeler':
             self.parent.OnCmdDone(event)
+            
+        # Process results here
+        try:
+            ctime = time.time() - event.time
+            if ctime < 60:
+                stime = _("%d sec") % int(ctime)
+            else:
+                mtime = int(ctime / 60)
+                stime = _("%(min)d min %(sec)d sec") %  { 'min' : mtime, 
+                                                          'sec' : int(ctime - (mtime * 60)) }
+        except KeyError:
+            # stopped deamon
+            stime = _("unknown")
         
         if event.aborted:
             # Thread aborted (using our convention of None return)
             self.WriteLog(_('Please note that the data are left in inconsistent state '
                             'and may be corrupted'), self.cmdOutput.StyleWarning)
-            self.WriteCmdLog('(%s) %s (%d sec)' % (str(time.ctime()),
-                                                   _('Command aborted'),
-                                                   (time.time() - event.time)))
-            # pid=self.cmdThread.requestId)
-            self.btnCmdAbort.Enable(False)
+            msg = _('Command aborted')
         else:
-            try:
-                # Process results here
-                ctime = time.time() - event.time
-                if ctime < 60:
-                    stime = _("%d sec") % int(ctime)
-                else:
-                    mtime = int(ctime / 60)
-                    stime = _("%d min %d sec") % (mtime, 
-                                                  int(ctime - (mtime * 60)))
-                
-                self.WriteCmdLog('(%s) %s (%s)' % (str(time.ctime()),
-                                                   _('Command finished'),
-                                                   (stime)))
-            except KeyError:
-                # stopped deamon
-                pass
-
-            self.btnCmdAbort.Enable(False)
+            msg = _('Command finished')
+            
+        self.WriteCmdLog('(%s) %s (%s)' % (str(time.ctime()), msg, stime))
+        self.btnCmdAbort.Enable(False)
         
         if event.onDone:
             event.onDone(cmd = event.cmd, returncode = event.returncode)

Modified: grass/branches/develbranch_6/gui/wxpython/modules/colorrules.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/modules/colorrules.py	2012-01-28 09:50:17 UTC (rev 50513)
+++ grass/branches/develbranch_6/gui/wxpython/modules/colorrules.py	2012-01-28 10:07:06 UTC (rev 50514)
@@ -1168,13 +1168,15 @@
         if self.inmap and not self.CheckMapset():
             # currently v.colors need the map to be in current mapset
             if self.version7 and self.attributeType == 'color':
-                message = _("Selected map <%s> is not in current mapset <%s>. "
+                message = _("Selected map <%(map)s> is not in current mapset <%(mapset)s>. "
                             "Color rules cannot be edited.") % \
-                            (self.inmap, grass.gisenv()['MAPSET'])
+                            { 'map' : self.inmap,
+                              'mapset' : grass.gisenv()['MAPSET'] }
             else:
-                message = _("Selected map <%s> is not in current mapset <%s>. "
+                message = _("Selected map <%(map)s> is not in current mapset <%(mapset)s>. "
                             "Attribute table cannot be edited.") % \
-                            (self.inmap, grass.gisenv()['MAPSET'])
+                            { 'map' : self.inmap,
+                              'mapset' : grass.gisenv()['MAPSET'] }
             wx.CallAfter(GMessage, parent = self, message = message)
             self.DisableClearAll()
             return
@@ -1445,9 +1447,11 @@
         range = ''
         if self.properties['min'] or self.properties['max']:
             if ctype == float:
-                range = _("(range: %.1f to %.1f)") % (self.properties['min'], self.properties['max'])
+                range = "%s: %.1f - %.1f)" % (_("range"),
+                                              self.properties['min'], self.properties['max'])
             elif ctype == int:
-                range = _("(range: %d to %d)") % (self.properties['min'], self.properties['max'])
+                range = "%s: %d - %d)" % (_("range"),
+                                          self.properties['min'], self.properties['max'])
         if range:
             if self.colorTable:
                 self.cr_label.SetLabel(_("Enter vector attribute values or percents %s:") % range)

Modified: grass/branches/develbranch_6/gui/wxpython/psmap/dialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/psmap/dialogs.py	2012-01-28 09:50:17 UTC (rev 50513)
+++ grass/branches/develbranch_6/gui/wxpython/psmap/dialogs.py	2012-01-28 10:07:06 UTC (rev 50514)
@@ -1106,7 +1106,9 @@
                 GError(_("Failed to read instruction %s") % instruction)
                 return False
         if not os.path.exists(instr['epsfile']):
-            GError(_("Failed to read instruction %s: file %s not found.") % instruction, instr['epsfile'])
+            GError(_("Failed to read instruction %(inst)s: "
+                     "file %(file)s not found.") % { 'inst' : instruction,
+                                                     'file' : instr['epsfile'] })
             return False
         
         instr['epsfile'] = os.path.abspath(instr['epsfile'])
@@ -6013,7 +6015,9 @@
             
     def SetSizeInfoLabel(self, image):
         """!Update image size label"""
-        self.imagePanel.image['sizeInfo'].SetLabel(_("size: %s x %s pts") % (image.GetWidth(), image.GetHeight()))
+        self.imagePanel.image['sizeInfo'].SetLabel(_("size: %(width)s x %(height)s pts") % \
+                                                       { 'width'  : image.GetWidth(),
+                                                         'height' : image.GetHeight() })
         self.imagePanel.image['sizeInfo'].GetContainingSizer().Layout()
         
     def ClearPreview(self):

Modified: grass/branches/develbranch_6/gui/wxpython/wxplot/base.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxplot/base.py	2012-01-28 09:50:17 UTC (rev 50513)
+++ grass/branches/develbranch_6/gui/wxpython/wxplot/base.py	2012-01-28 10:07:06 UTC (rev 50514)
@@ -396,8 +396,8 @@
         self.client.SaveFile()
 
     def OnMouseLeftDown(self,event):
-        self.SetStatusText(_("Left Mouse Down at Point: (%.4f, %.4f)") % \
-                               self.client._getXY(event))
+        self.SetStatusText(_("Left Mouse Down at Point:") + \
+                               " (%.4f, %.4f)" % self.client._getXY(event))
         event.Skip() # allows plotCanvas OnMouseLeftDown to be called
 
     def OnMotion(self, event):



More information about the grass-commit mailing list