Cleanup previous PR

This commit is contained in:
Kovid Goyal 2023-04-16 20:15:42 +05:30
parent 88f75bb6e4
commit 1a20d1e005
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -79,8 +79,8 @@ class InterfaceAction(QObject):
#: with no default key binding. #: with no default key binding.
action_spec = ('text', 'icon', None, None) action_spec = ('text', 'icon', None, None)
#: If not none, used for the name displayed to the user when customizing #: If not None, used for the name displayed to the user when customizing
#: the keyboard shortcuts for the above action spec (self.qaction) #: the keyboard shortcuts for the above action spec instead of action_spec[0]
action_shortcut_name = None action_shortcut_name = None
#: If True, a menu is automatically created and added to self.qaction #: If True, a menu is automatically created and added to self.qaction
@ -185,11 +185,11 @@ class InterfaceAction(QObject):
if shortcut is not None: if shortcut is not None:
keys = ((shortcut,) if isinstance(shortcut, string_or_bytes) else keys = ((shortcut,) if isinstance(shortcut, string_or_bytes) else
tuple(shortcut)) tuple(shortcut))
if shortcut_name is None and self.action_shortcut_name is not None: if shortcut_name is None:
shortcut_name = self.action_shortcut_name if self.action_shortcut_name is not None:
if not shortcut_name and spec[0]: shortcut_name = self.action_shortcut_name
shortcut_name = str(spec[0]) elif spec[0]:
shortcut_name = str(spec[0])
if shortcut_name and self.action_spec[0] and not ( if shortcut_name and self.action_spec[0] and not (
attr == 'qaction' and self.popup_type == QToolButton.ToolButtonPopupMode.InstantPopup): attr == 'qaction' and self.popup_type == QToolButton.ToolButtonPopupMode.InstantPopup):
try: try: