Add keyboard shortcut to clear additional restriction

This commit is contained in:
Kovid Goyal 2013-05-04 14:30:43 +05:30
parent d6a8e92dcd
commit e7268bc39f
3 changed files with 12 additions and 0 deletions

View File

@ -586,6 +586,8 @@ Calibre has several keyboard shortcuts to save you time and mouse movement. Thes
- Focus the book list - Focus the book list
* - :kbd:`Ctrl+Esc` * - :kbd:`Ctrl+Esc`
- Clear the virtual library - Clear the virtual library
* - :kbd:`Alt+Esc`
- Clear the additional restriction
* - :kbd:`N or F3` * - :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) - 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` * - :kbd:`Shift+N or Shift+F3`

View File

@ -549,6 +549,9 @@ class SearchRestrictionMixin(object):
restriction = '' restriction = ''
self._apply_search_restriction(restriction, r) self._apply_search_restriction(restriction, r)
def clear_additional_restriction(self):
self._apply_search_restriction('', '')
def _apply_search_restriction(self, restriction, name): def _apply_search_restriction(self, restriction, name):
self.saved_search.clear() self.saved_search.clear()
# The order below is important. Set the restriction, force a '' search # The order below is important. Set the restriction, force a '' search

View File

@ -279,6 +279,13 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
action=self.ctrl_esc_action) action=self.ctrl_esc_action)
self.ctrl_esc_action.triggered.connect(self.ctrl_esc) self.ctrl_esc_action.triggered.connect(self.ctrl_esc)
self.alt_esc_action = QAction(self)
self.addAction(self.alt_esc_action)
self.keyboard.register_shortcut('clear additional restriction',
_('Clear the additional restriction'), default_keys=('Alt+Esc',),
action=self.alt_esc_action)
self.alt_esc_action.triggered.connect(self.clear_additional_restriction)
####################### Start spare job server ######################## ####################### Start spare job server ########################
QTimer.singleShot(1000, self.add_spare_server) QTimer.singleShot(1000, self.add_spare_server)