From cde05462e49e119dbc67bdfda5fa56812fc6df0c Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Wed, 17 Jun 2020 09:33:26 +0100 Subject: [PATCH] Fix bug \1883768: "Manage Author" from book details panel doesn't jump to author --- src/calibre/gui2/init.py | 3 ++- src/calibre/gui2/tag_browser/ui.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/init.py b/src/calibre/gui2/init.py index 6dd00d92f6..b1fca4dec9 100644 --- a/src/calibre/gui2/init.py +++ b/src/calibre/gui2/init.py @@ -701,7 +701,8 @@ class LayoutMixin(object): # {{{ def manage_category_triggerred(self, field, value): if field and value: if field == 'authors': - self.do_author_sort_edit(self, value, select_sort=False, select_link=False) + self.do_author_sort_edit(self, value, select_sort=False, + select_link=False, lookup_author=True) elif field: self.do_tags_list_edit(value, field) diff --git a/src/calibre/gui2/tag_browser/ui.py b/src/calibre/gui2/tag_browser/ui.py index f358aa5b0f..d1da7709ae 100644 --- a/src/calibre/gui2/tag_browser/ui.py +++ b/src/calibre/gui2/tag_browser/ui.py @@ -386,15 +386,22 @@ class TagBrowserMixin(object): # {{{ # refreshing the tags view happens at the emit()/call() site def do_author_sort_edit(self, parent, id_, select_sort=True, - select_link=False, is_first_letter=False): + select_link=False, is_first_letter=False, + lookup_author=False): ''' Open the manage authors dialog ''' db = self.library_view.model().db + get_authors_func = partial(self.get_book_ids, db=db, category='authors') + if lookup_author: + for t in get_authors_func(use_virtual_library=False): + if t[1] == id_: + id_ = t[0] + select_sort = True + break editor = EditAuthorsDialog(parent, db, id_, select_sort, select_link, - partial(self.get_book_ids, db=db, category='authors'), - is_first_letter) + get_authors_func, is_first_letter) if editor.exec_() == editor.Accepted: # Save and restore the current selections. Note that some changes # will cause sort orders to change, so don't bother with attempting