mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Annotations browser: When showing a book in the calibre library that is not currently visible, display an error. Fixes #1900066 [Annotation browser's "show in Calibre" silently fails if book isn't in current library view](https://bugs.launchpad.net/calibre/+bug/1900066)
This commit is contained in:
parent
ebf3937628
commit
cb31fc219d
@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
|
||||
from PyQt5.Qt import Qt
|
||||
|
||||
from calibre.gui2 import error_dialog
|
||||
from calibre.gui2.actions import InterfaceAction
|
||||
|
||||
|
||||
@ -43,7 +44,13 @@ class BrowseAnnotationsAction(InterfaceAction):
|
||||
self._browser.selection_changed()
|
||||
|
||||
def open_book(self, book_id, fmt):
|
||||
self.gui.library_view.select_rows({book_id})
|
||||
if not self.gui.library_view.select_rows({book_id}):
|
||||
db = self.gui.current_db.new_api
|
||||
title = db.field_for('title', book_id)
|
||||
return error_dialog(self._browser or self.gui, _('Not visible'), _(
|
||||
'The book "{}" is not currently visible in the calibre library.'
|
||||
' If you have a search or a Virtual librry applied, first clear'
|
||||
' it.').format(title), show=True)
|
||||
|
||||
def open_annotation(self, book_id, fmt, cfi):
|
||||
self.gui.iactions['View'].view_format_by_id(book_id, fmt, open_at=cfi)
|
||||
|
@ -1236,6 +1236,7 @@ class BooksView(QTableView): # {{{
|
||||
sel.merge(QItemSelection(m.index(min(group), 0),
|
||||
m.index(max(group), max_col)), sm.Select)
|
||||
sm.select(sel, sm.ClearAndSelect)
|
||||
return rows
|
||||
|
||||
def get_selected_ids(self, as_set=False):
|
||||
ans = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user