Add menu title hotkeys to the GUI.
authorW. Trevor King <wking@drexel.edu>
Sun, 22 Aug 2010 18:10:02 +0000 (14:10 -0400)
committerW. Trevor King <wking@drexel.edu>
Sun, 22 Aug 2010 18:10:02 +0000 (14:10 -0400)
From
  http://wiki.wxwidgets.org/Beech:Using_controls#Adding_a_Menu_Bar
we have
  "Note how the ampersand ("&") is used in strings like "E&xit" and
  "&File". This indicates which character in a menubar or menu will be
  the menu hotkey."

hooke/ui/gui/menu.py

index d918a94988a54847523c0eb5d21b858b31b1d96e..7ee0b2e9452b1a0916da50301b86bed1c6e4cd78 100644 (file)
@@ -187,9 +187,10 @@ class HookeMenuBar (MenuBar):
         # Attach *Menu() instances
         for key in ['file', 'view', 'perspective', 'help']:
             cap_key = key.capitalize()
         # Attach *Menu() instances
         for key in ['file', 'view', 'perspective', 'help']:
             cap_key = key.capitalize()
+            hot_key = '&' + cap_key
             _class = globals()['%sMenu' % cap_key]
             kwargs = {}
             if key == 'view':
                 kwargs['panels'] = panels
             self._c[key] = _class(parent=self, callbacks=callbacks, **kwargs)
             _class = globals()['%sMenu' % cap_key]
             kwargs = {}
             if key == 'view':
                 kwargs['panels'] = panels
             self._c[key] = _class(parent=self, callbacks=callbacks, **kwargs)
-            self.Append(self._c[key], cap_key)
+            self.Append(self._c[key], hot_key)