mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add the ability to name the shortcut for qactions in InterfaceActionPlugin.
This commit is contained in:
parent
8c8e6fda0b
commit
c3a83fd891
@ -79,6 +79,10 @@ 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
|
||||||
|
#: the keyboard shortcuts for the above action spec (self.qaction)
|
||||||
|
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
|
||||||
action_add_menu = False
|
action_add_menu = False
|
||||||
|
|
||||||
@ -181,7 +185,9 @@ 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 spec[0]:
|
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])
|
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 (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user