Add keyboard shortcuts to focus the book list and clear the virtual library

This commit is contained in:
Kovid Goyal 2013-05-03 17:33:12 +05:30
parent 6b99cd01c2
commit 2f7a442c63
2 changed files with 25 additions and 0 deletions

View File

@ -582,6 +582,10 @@ Calibre has several keyboard shortcuts to save you time and mouse movement. Thes
- Open the advanced search dialog
* - :kbd:`Esc`
- Clear the current search
* - :kbd:`Shift+Esc`
- Focus the book list
* - :kbd:`Ctrl+Esc`
- Clear the virtual library
* - :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`

View File

@ -265,6 +265,20 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
action=self.esc_action)
self.esc_action.triggered.connect(self.esc)
self.shift_esc_action = QAction(self)
self.addAction(self.shift_esc_action)
self.keyboard.register_shortcut('focus book list',
_('Focus the book list'), default_keys=('Shift+Esc',),
action=self.shift_esc_action)
self.shift_esc_action.triggered.connect(self.shift_esc)
self.ctrl_esc_action = QAction(self)
self.addAction(self.ctrl_esc_action)
self.keyboard.register_shortcut('clear virtual library',
_('Clear the virtual library'), default_keys=('Ctrl+Esc',),
action=self.ctrl_esc_action)
self.ctrl_esc_action.triggered.connect(self.ctrl_esc)
####################### Start spare job server ########################
QTimer.singleShot(1000, self.add_spare_server)
@ -377,6 +391,13 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
def esc(self, *args):
self.clear_button.click()
def shift_esc(self):
self.current_view().setFocus(Qt.OtherFocusReason)
def ctrl_esc(self):
self.apply_virtual_library()
self.current_view().setFocus(Qt.OtherFocusReason)
def start_smartdevice(self):
message = None
if self.device_manager.get_option('smartdevice', 'autostart'):