diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1999-12-14 15:45:53 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1999-12-14 15:45:53 (GMT) |
commit | 13681b73b5d951a8f2c453aa20a2f11d75474d31 (patch) | |
tree | ef606261baac04d42cf90911b79d357973105f7e /Mac/Lib | |
parent | 1836dbe22d45ac7066a1fdb3cbf3f041b2c5e727 (diff) | |
download | cpython-13681b73b5d951a8f2c453aa20a2f11d75474d31.zip cpython-13681b73b5d951a8f2c453aa20a2f11d75474d31.tar.gz cpython-13681b73b5d951a8f2c453aa20a2f11d75474d31.tar.bz2 |
If a menu shortcut is a tuple in stead of a char it is a tuple (modifierkeys, char [, glyph]).
Diffstat (limited to 'Mac/Lib')
-rw-r--r-- | Mac/Lib/FrameWork.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Mac/Lib/FrameWork.py b/Mac/Lib/FrameWork.py index 899811a..42ef128 100644 --- a/Mac/Lib/FrameWork.py +++ b/Mac/Lib/FrameWork.py @@ -528,7 +528,13 @@ class Menu: self.items.append(label, shortcut, callback, kind) item = len(self.items) self.menu.SetMenuItemText(item, label) # set the actual text - if shortcut: + if shortcut and type(shortcut) == type(()): + modifiers, char = shortcut[:2] + self.menu.SetItemCmd(item, ord(char)) + self.menu.SetMenuItemModifiers(item, modifiers) + if len(shortcut) > 2: + self.menu.SetMenuItem + elif shortcut: self.menu.SetItemCmd(item, ord(shortcut)) return item @@ -1018,9 +1024,9 @@ class TestApp(Application): self.saveitem = MenuItem(m, "Save", "S", self.save) Separator(m) self.optionsmenu = mm = SubMenu(m, "Options") - self.opt1 = CheckItem(mm, "Arguments") - self.opt2 = CheckItem(mm, "Being hit on the head lessons") - self.opt3 = CheckItem(mm, "Complaints") + self.opt1 = CheckItem(mm, "Arguments", "A") + self.opt2 = CheckItem(mm, "Being hit on the head lessons", (kMenuOptionModifier, "A")) + self.opt3 = CheckItem(mm, "Complaints", (kMenuOptionModifier|kMenuNoCommandModifier, "A")) Separator(m) self.quititem = MenuItem(m, "Quit", "Q", self.quit) |