[GRASS-SVN] r56017 - grass/trunk/gui/wxpython/core

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Apr 28 07:28:16 PDT 2013


Author: annakrat
Date: 2013-04-28 07:28:15 -0700 (Sun, 28 Apr 2013)
New Revision: 56017

Modified:
   grass/trunk/gui/wxpython/core/menutree.py
Log:
wxGUI: fix menustrings

Modified: grass/trunk/gui/wxpython/core/menutree.py
===================================================================
--- grass/trunk/gui/wxpython/core/menutree.py	2013-04-28 12:19:05 UTC (rev 56016)
+++ grass/trunk/gui/wxpython/core/menutree.py	2013-04-28 14:28:15 UTC (rev 56017)
@@ -82,7 +82,7 @@
                         command='', keywords='', shortcut='', wxId='')
             self.model.AppendNode(parent=node, label='', data=data)
         elif item.tag == 'menuitem':
-            label    = _(item.find('label').text)
+            origLabel = _(item.find('label').text)
             desc     = _(item.find('help').text)
             handler  = item.find('handler').text
             gcmd     = item.find('command')  # optional
@@ -105,12 +105,13 @@
                 wxId = eval('wx.' + wxId.text)
             else:
                 wxId = wx.ID_ANY
+            label = origLabel
             if gcmd:
                 if self.menustyle == 1:
                     label += '   [' + gcmd + ']'
                 elif self.menustyle == 2:
                     label = '      [' + gcmd + ']'
-            data = dict(label=label, description=desc, handler=handler,
+            data = dict(label=origLabel, description=desc, handler=handler,
                         command=gcmd, keywords=keywords, shortcut=shortcut, wxId=wxId)
             self.model.AppendNode(parent=node, label=label, data=data)
         elif item.tag == 'menu':
@@ -165,9 +166,13 @@
         printTree(node=child, fh=fh, indent=indent + 2)
 
 def printStrings(node, fh):
-    if node.label:
+    # node.label  - with module in brackets
+    # node.data['label'] - without module in brackets
+    if node.label and not node.data:
         fh.write('    _(%r),\n' % str(node.label))
     if node.data:
+        if 'label' in node.data and node.data['label']:
+            fh.write('    _(%r),\n' % str(node.data['label']))
         if 'description' in node.data and node.data['description']:
             fh.write('    _(%r),\n' % str(node.data['description']))
     for child in node.children:



More information about the grass-commit mailing list