From cfff3734da45fa6b4e90c8c1c6f5fa3db3ef058b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 1 Dec 2014 07:57:25 +0530 Subject: [PATCH] Edit metadata dialog: Add a keyboard shortcut to swap title and author [Alt+Down]. Fixes #1397701 [[Enhancement]](https://bugs.launchpad.net/calibre/+bug/1397701) --- src/calibre/gui2/metadata/single.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/metadata/single.py b/src/calibre/gui2/metadata/single.py index c61612e4f8..d35bddb011 100644 --- a/src/calibre/gui2/metadata/single.py +++ b/src/calibre/gui2/metadata/single.py @@ -63,6 +63,8 @@ class MetadataSingleDialogBase(ResizableDialog): sc = p.keyboard.keys_map.get(kname, None) if sc: self.download_shortcut.setKey(sc[0]) + self.swap_title_author_shortcut = s = QShortcut(self) + s.setKey(QKeySequence('Alt+Down', QKeySequence.PortableText)) self.button_box = bb = QDialogButtonBox(self) self.button_box.accepted.connect(self.accept) @@ -164,8 +166,9 @@ class MetadataSingleDialogBase(ResizableDialog): self.swap_title_author_button = QToolButton(self) self.swap_title_author_button.setIcon(QIcon(I('swap.png'))) self.swap_title_author_button.setToolTip(_( - 'Swap the author and title')) + 'Swap the author and title') + ' [%s]' % self.swap_title_author_shortcut.key().toString(QKeySequence.NativeText)) self.swap_title_author_button.clicked.connect(self.swap_title_author) + self.swap_title_author_shortcut.activated.connect(self.swap_title_author_button.click) self.manage_authors_button = QToolButton(self) self.manage_authors_button.setIcon(QIcon(I('user_profile.png')))