mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add keyboard shortcuts (Ctrl+Right, Ctrl+Left) to switch between virtual library tabs. Fixes #1453497 [[Enhancement] Shortcuts for cycling through virtual libraries](https://bugs.launchpad.net/calibre/+bug/1453497)
This commit is contained in:
parent
383643a9d1
commit
3c1d2bd560
@ -704,6 +704,10 @@ Calibre has several keyboard shortcuts to save you time and mouse movement. Thes
|
||||
- Clear the additional restriction
|
||||
* - :kbd:`Ctrl+*`
|
||||
- Create a temporary virtual library based on the current search
|
||||
* - :kbd:`Ctrl+Right`
|
||||
- Select the next virtual library tab
|
||||
* - :kbd:`Ctrl+Left`
|
||||
- Select the previous virtua library tab
|
||||
* - :kbd:`N or F3`
|
||||
- Find the next book that matches the current search (only works if the highlight checkbox next to the search bar is checked)
|
||||
* - :kbd:`Shift+N or Shift+F3`
|
||||
|
@ -325,6 +325,25 @@ class VLTabs(QTabBar): # {{{
|
||||
self.tabCloseRequested.connect(self.tab_close)
|
||||
self.setStyleSheet('QTabBar::tab:selected { font-weight: bold } QTabBar::tab { text-align: center }')
|
||||
self.setVisible(gprefs['show_vl_tabs'])
|
||||
self.next_action = a = QAction(self)
|
||||
a.triggered.connect(partial(self.next_tab, delta=1)), self.gui.addAction(a)
|
||||
self.previous_action = a = QAction(self)
|
||||
a.triggered.connect(partial(self.next_tab, delta=-1)), self.gui.addAction(a)
|
||||
self.gui.keyboard.register_shortcut(
|
||||
'virtual-library-tab-bar-next', _('Next virtual library'), action=self.next_action,
|
||||
default_keys=('Ctrl+Right',),
|
||||
description=_('Switch to the next Virtual Library in the Virtual Library tab bar')
|
||||
)
|
||||
self.gui.keyboard.register_shortcut(
|
||||
'virtual-library-tab-bar-previous', _('Previous virtual library'), action=self.previous_action,
|
||||
default_keys=('Ctrl+Left',),
|
||||
description=_('Switch to the previous Virtual Library in the Virtual Library tab bar')
|
||||
)
|
||||
|
||||
def next_tab(self, delta=1):
|
||||
if self.count() > 1 and self.isVisible():
|
||||
idx = (self.currentIndex() + delta) % self.count()
|
||||
self.setCurrentIndex(idx)
|
||||
|
||||
def enable_bar(self):
|
||||
gprefs['show_vl_tabs'] = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user