Book details panel: Allow right clicking on author names to search for them in calibre. Allow clicking on language names to search for them in calibre. Fixes #1692084 [Choice to show author in library](https://bugs.launchpad.net/calibre/+bug/1692084)

This commit is contained in:
Kovid Goyal 2017-05-20 12:26:31 +05:30
parent 012810cc62
commit 9d55e3aa9e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 0 deletions

View File

@ -227,6 +227,8 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=
if not mi.languages:
continue
names = filter(None, map(calibre_langcode_to_name, mi.languages))
names = ['<a href="%s" title="%s">%s</a>' % (search_href('languages', n), _(
'Search calibre for books with the language: {}').format(n), n) for n in names]
ans.append((field, row % (name, u', '.join(names))))
elif field == 'publisher':
if not mi.publisher:

View File

@ -237,6 +237,9 @@ def details_context_menu_event(view, ev, book_info): # {{{
menu.sia = sia = create_search_internet_menu(book_info.search_internet, author)
menu.addMenu(sia)
search_internet_added = True
if hasattr(book_info, 'search_requested'):
menu.addAction(_('Search calibre for %s') % author,
lambda : book_info.search_requested('authors:"={}"'.format(author.replace('"', r'\"'))))
if data:
try:
field, value, book_id = cPickle.loads(unhexlify(data))
@ -757,6 +760,7 @@ class BookDetails(QWidget): # {{{
self._layout.addWidget(self.cover_view)
self.book_info = BookInfo(vertical, self)
self.book_info.search_internet = self.search_internet
self.book_info.search_requested = self.search_requested.emit
self._layout.addWidget(self.book_info)
self.book_info.link_clicked.connect(self.handle_click)
self.book_info.remove_format.connect(self.remove_specific_format)