From e07df7d583a1ae259236757a68f0508b6b5df8f2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 27 Aug 2011 11:46:30 -0600 Subject: [PATCH] Add shortcut_name parameter to create_action() as well --- src/calibre/gui2/actions/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/actions/__init__.py b/src/calibre/gui2/actions/__init__.py index 49e5ecff43..ba8eafb5ca 100644 --- a/src/calibre/gui2/actions/__init__.py +++ b/src/calibre/gui2/actions/__init__.py @@ -120,7 +120,7 @@ class InterfaceAction(QObject): bn = self.interface_action_base_plugin.name return u'Interface Action: %s (%s)'%(bn, self.name) - def create_action(self, spec=None, attr='qaction'): + def create_action(self, spec=None, attr='qaction', shortcut_name=None): if spec is None: spec = self.action_spec text, icon, tooltip, shortcut = spec @@ -146,8 +146,10 @@ class InterfaceAction(QObject): if shortcut is not None: keys = ((shortcut,) if isinstance(shortcut, basestring) else tuple(shortcut)) + if shortcut_name is None and spec[0]: + shortcut_name = unicode(spec[0]) - if spec[0] and not (attr=='qaction' and self.popup_type == + if shortcut_name and not (attr=='qaction' and self.popup_type == QToolButton.InstantPopup): try: self.gui.keyboard.register_shortcut(self.unique_name + ' - ' + attr,