mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a keyboard shortcut (Ctrl+*) to convert the current search into a temporary virtual library. Fixes #1249773 [[Enhancement] Virtual library for all current searches](https://bugs.launchpad.net/calibre/+bug/1249773)
This commit is contained in:
parent
229232f6cf
commit
5291283265
@ -621,6 +621,8 @@ Calibre has several keyboard shortcuts to save you time and mouse movement. Thes
|
||||
- Clear the virtual library
|
||||
* - :kbd:`Alt+Esc`
|
||||
- Clear the additional restriction
|
||||
* - :kbd:`Ctrl+*`
|
||||
- Create a temporary virtual library based on the current search
|
||||
* - :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`
|
||||
|
@ -10,7 +10,7 @@ from functools import partial
|
||||
|
||||
from PyQt4.Qt import (
|
||||
Qt, QMenu, QPoint, QIcon, QDialog, QGridLayout, QLabel, QLineEdit, QComboBox,
|
||||
QDialogButtonBox, QSize, QVBoxLayout, QListWidget, QStringList, QRadioButton)
|
||||
QDialogButtonBox, QSize, QVBoxLayout, QListWidget, QStringList, QRadioButton, QAction)
|
||||
|
||||
from calibre.gui2 import error_dialog, question_dialog, gprefs
|
||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||
@ -311,6 +311,14 @@ class SearchRestrictionMixin(object):
|
||||
def __init__(self):
|
||||
self.checked = QIcon(I('ok.png'))
|
||||
self.empty = QIcon(I('blank.png'))
|
||||
self.current_search_action = QAction(self.empty, _('*current search'), self)
|
||||
self.current_search_action.triggered.connect(partial(self.apply_virtual_library, library='*'))
|
||||
self.addAction(self.current_search_action)
|
||||
self.keyboard.register_shortcut(
|
||||
'vl-from-current-search', _('Virtual library from current search'), description=_(
|
||||
'Create a temporary Virtual library from the current search'), group=_('Miscellaneous'),
|
||||
default_keys=('Ctrl+*',), action=self.current_search_action)
|
||||
|
||||
self.search_based_vl_name = None
|
||||
self.search_based_vl = None
|
||||
|
||||
@ -387,8 +395,7 @@ class SearchRestrictionMixin(object):
|
||||
a = m.addAction(self.empty, self.no_restriction)
|
||||
a.triggered.connect(partial(self.apply_virtual_library, library=''))
|
||||
|
||||
a = m.addAction(self.empty, _('*current search'))
|
||||
a.triggered.connect(partial(self.apply_virtual_library, library='*'))
|
||||
a = m.addAction(self.current_search_action)
|
||||
|
||||
if self.search_based_vl_name:
|
||||
a = m.addAction(
|
||||
|
Loading…
x
Reference in New Issue
Block a user