mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 00:03:37 +02: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
2 changed files with 9 additions and 1 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
from PyQt5.Qt import Qt
|
||||
|
||||
from calibre.gui2 import error_dialog
|
||||
from calibre.gui2.actions import InterfaceAction
|
||||
|
||||
|
||||
|
|
@ -43,7 +44,13 @@ def selection_changed(self):
|
|||
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 @@ def select_rows(self, identifiers, using_ids=True, change_current=True,
|
|||
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…
Reference in a new issue