[GRASS-SVN] r39022 - in grass/branches/develbranch_6/gui/wxpython:
. gui_modules xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 5 16:12:27 EDT 2009
Author: martinl
Date: 2009-09-05 16:12:27 -0400 (Sat, 05 Sep 2009)
New Revision: 39022
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/menudata.py
grass/branches/develbranch_6/gui/wxpython/wxgui.py
grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
Log:
implement menu shortcuts (see trac #725)
(merge from trunk, r39019)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menudata.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menudata.py 2009-09-05 20:12:09 UTC (rev 39021)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menudata.py 2009-09-05 20:12:27 UTC (rev 39022)
@@ -41,6 +41,7 @@
handler = mi.find('handler').text
gcmd = mi.find('command') # optional
keywords = mi.find('keywords') # optional
+ shortcut = mi.find('shortcut') # optional
if gcmd != None:
gcmd = gcmd.text
else:
@@ -49,7 +50,11 @@
keywords = keywords.text
else:
keywords = ""
- return (label, help, handler, gcmd, keywords)
+ if shortcut != None:
+ shortcut = shortcut.text
+ else:
+ shortcut = ""
+ return (label, help, handler, gcmd, keywords, shortcut)
elif mi.tag == 'menu':
return self.getMenu(mi)
else:
Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py 2009-09-05 20:12:09 UTC (rev 39021)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py 2009-09-05 20:12:27 UTC (rev 39022)
@@ -231,7 +231,7 @@
self.Bind(wx.EVT_MENU_HIGHLIGHT_ALL, self.OnMenuHighlight)
return menu
- def __createMenuItem(self, menu, label, help, handler, gcmd, keywords, kind = wx.ITEM_NORMAL):
+ def __createMenuItem(self, menu, label, help, handler, gcmd, keywords, shortcut = '', kind = wx.ITEM_NORMAL):
"""!Creates menu items"""
if not label:
@@ -242,7 +242,10 @@
helpString = gcmd + ' -- ' + help
else:
helpString = help
-
+
+ if shortcut:
+ label += '\t' + shortcut
+
menuItem = menu.Append(wx.ID_ANY, label, helpString, kind)
self.menucmd[menuItem.GetId()] = gcmd
Modified: grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2009-09-05 20:12:09 UTC (rev 39021)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2009-09-05 20:12:27 UTC (rev 39022)
@@ -643,6 +643,7 @@
<label>E&xit</label>
<help>Exit GUI</help>
<handler>self.OnCloseWindow</handler>
+ <shortcut>Ctrl+Q</shortcut>
</menuitem>
</items>
</menu>
More information about the grass-commit
mailing list