From 1a20d1e0056880acaf47268b6d4cc1d70d68d63d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 16 Apr 2023 20:15:42 +0530 Subject: [PATCH] Cleanup previous PR --- src/calibre/gui2/actions/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/calibre/gui2/actions/__init__.py b/src/calibre/gui2/actions/__init__.py index be6fb2eadb..7543e679e0 100644 --- a/src/calibre/gui2/actions/__init__.py +++ b/src/calibre/gui2/actions/__init__.py @@ -79,8 +79,8 @@ class InterfaceAction(QObject): #: with no default key binding. action_spec = ('text', 'icon', None, None) - #: If not none, used for the name displayed to the user when customizing - #: the keyboard shortcuts for the above action spec (self.qaction) + #: If not None, used for the name displayed to the user when customizing + #: the keyboard shortcuts for the above action spec instead of action_spec[0] action_shortcut_name = None #: If True, a menu is automatically created and added to self.qaction @@ -185,11 +185,11 @@ class InterfaceAction(QObject): if shortcut is not None: keys = ((shortcut,) if isinstance(shortcut, string_or_bytes) else tuple(shortcut)) - if shortcut_name is None and self.action_shortcut_name is not None: - shortcut_name = self.action_shortcut_name - if not shortcut_name and spec[0]: - shortcut_name = str(spec[0]) - + if shortcut_name is None: + if self.action_shortcut_name is not None: + shortcut_name = self.action_shortcut_name + elif spec[0]: + shortcut_name = str(spec[0]) if shortcut_name and self.action_spec[0] and not ( attr == 'qaction' and self.popup_type == QToolButton.ToolButtonPopupMode.InstantPopup): try: