diff --git a/src/calibre/gui2/fts/dialog.py b/src/calibre/gui2/fts/dialog.py index 111baa1312..0b62e63592 100644 --- a/src/calibre/gui2/fts/dialog.py +++ b/src/calibre/gui2/fts/dialog.py @@ -61,6 +61,7 @@ class FTSDialog(Dialog): self.show_appropriate_panel() self.update_indexing_label() self.scan_status.indexing_progress_changed.connect(self.update_indexing_label) + self.addAction(self.results_panel.jump_to_current_book_action) def show_fat_details(self): warning_dialog(self, _('Library on a FAT drive'), _( diff --git a/src/calibre/gui2/fts/search.py b/src/calibre/gui2/fts/search.py index cfe4407480..2c134715f5 100644 --- a/src/calibre/gui2/fts/search.py +++ b/src/calibre/gui2/fts/search.py @@ -10,9 +10,10 @@ from contextlib import suppress from functools import partial from itertools import count from qt.core import ( - QAbstractItemModel, QAbstractItemView, QCheckBox, QDialog, QDialogButtonBox, QFont, - QHBoxLayout, QIcon, QLabel, QMenu, QModelIndex, QPixmap, QPushButton, QRect, QSize, - QSplitter, QStackedWidget, Qt, QTreeView, QVBoxLayout, QWidget, pyqtSignal, + QAbstractItemModel, QAbstractItemView, QAction, QCheckBox, QDialog, + QDialogButtonBox, QFont, QHBoxLayout, QIcon, QKeySequence, QLabel, QMenu, + QModelIndex, QPixmap, QPushButton, QRect, QSize, QSplitter, QStackedWidget, Qt, + QTreeView, QVBoxLayout, QWidget, pyqtSignal, ) from threading import Event, Thread @@ -589,6 +590,9 @@ class ResultDetails(QWidget): def __init__(self, parent=None): super().__init__(parent) + self.jump_action = ac = QAction(self) + ac.triggered.connect(self.jump_to_current_book) + ac.setShortcut(QKeySequence('Ctrl+S', QKeySequence.SequenceFormat.PortableText)) self.key = None self.pixmap_label = pl = QLabel(self) pl.setScaledContents(True) @@ -626,6 +630,10 @@ class ResultDetails(QWidget): ' to see updated results.'), show=True) self.remove_book_from_results.emit(self.current_book_id) + def jump_to_current_book(self): + if self.current_book_id > -1: + jump_to_book(self.current_book_id) + def results_anchor_clicked(self, url): if self.current_book_id > 0 and url.scheme() == 'book': book_id, result_num, fmt = url.path().strip('/').split('/') @@ -686,7 +694,8 @@ class ResultDetails(QWidget): text += '

' + _('{series_index} of {series}').format(series_index=sidx, series=series) + '

' ict = '' text += '

{2}\xa0{0}\xa0\xa0\xa0 '.format( - _('Select'), '

' + _('Scroll to this book in the calibre library book list and select it.'), ict.format('lt.png')) + _('Select'), '

' + _('Scroll to this book in the calibre library book list and select it [{}]').format( + self.jump_action.shortcut().toString(QKeySequence.SequenceFormat.NativeText)), ict.format('lt.png')) text += '{2}\xa0{0}

'.format( _('Mark'), '

' + _( 'Put a pin on this book in the calibre library, for future reference.' @@ -856,6 +865,10 @@ class ResultsPanel(QWidget): if st is not None: s.restoreState(st) + @property + def jump_to_current_book_action(self): + return self.details.result_details.jump_action + def view_current_result(self): return self.results_view.view_current_result()