Fix bug \1883768: "Manage Author" from book details panel doesn't jump to author

This commit is contained in:
Charles Haley 2020-06-17 09:33:26 +01:00
parent 32438d1565
commit cde05462e4
2 changed files with 12 additions and 4 deletions

View File

@ -701,7 +701,8 @@ class LayoutMixin(object): # {{{
def manage_category_triggerred(self, field, value): def manage_category_triggerred(self, field, value):
if field and value: if field and value:
if field == 'authors': 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: elif field:
self.do_tags_list_edit(value, field) self.do_tags_list_edit(value, field)

View File

@ -386,15 +386,22 @@ class TagBrowserMixin(object): # {{{
# refreshing the tags view happens at the emit()/call() site # refreshing the tags view happens at the emit()/call() site
def do_author_sort_edit(self, parent, id_, select_sort=True, 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 Open the manage authors dialog
''' '''
db = self.library_view.model().db 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, editor = EditAuthorsDialog(parent, db, id_, select_sort, select_link,
partial(self.get_book_ids, db=db, category='authors'), get_authors_func, is_first_letter)
is_first_letter)
if editor.exec_() == editor.Accepted: if editor.exec_() == editor.Accepted:
# Save and restore the current selections. Note that some changes # Save and restore the current selections. Note that some changes
# will cause sort orders to change, so don't bother with attempting # will cause sort orders to change, so don't bother with attempting