mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1904392 [[Enhancement] Add ability to remove author by right clicking in the Book details panel](https://bugs.launchpad.net/calibre/+bug/1904392)
This commit is contained in:
parent
efc6be9f93
commit
56e0fc69fb
@ -884,6 +884,11 @@ class EditMetadataAction(InterfaceAction):
|
||||
identifiers = db.field_for(field, book_id)
|
||||
if identifiers.pop(value, False) is not False:
|
||||
affected_books = db.set_field(field, {book_id:identifiers})
|
||||
elif field == 'authors':
|
||||
authors = db.field_for(field, book_id)
|
||||
new_authors = [x for x in authors if x != value] or [_('Unknown')]
|
||||
if new_authors != authors:
|
||||
affected_books = db.set_field(field, {book_id:new_authors})
|
||||
elif fm['is_multiple']:
|
||||
item_id = db.get_item_id(field, value)
|
||||
if item_id is not None:
|
||||
|
@ -245,6 +245,7 @@ def add_format_entries(menu, data, book_info):
|
||||
|
||||
|
||||
def add_item_specific_entries(menu, data, book_info):
|
||||
from calibre.gui2.ui import get_gui
|
||||
search_internet_added = False
|
||||
find_action = book_info.find_in_tag_browser_action
|
||||
dt = data['type']
|
||||
@ -271,8 +272,12 @@ def add_item_specific_entries(menu, data, book_info):
|
||||
if hasattr(book_info, 'search_requested'):
|
||||
menu.addAction(_('Search calibre for %s') % author,
|
||||
lambda : book_info.search_requested('authors:"={}"'.format(author.replace('"', r'\"'))))
|
||||
ac = book_info.remove_item_action
|
||||
book_id = get_gui().library_view.current_id
|
||||
ac.data = ('authors', author, book_id)
|
||||
ac.setText(_('Remove %s from this book') % escape_for_menu(author))
|
||||
menu.addAction(ac)
|
||||
elif dt in ('path', 'devpath'):
|
||||
from calibre.gui2.ui import get_gui
|
||||
path = data['loc']
|
||||
ac = book_info.copy_link_action
|
||||
if isinstance(path, int):
|
||||
|
Loading…
x
Reference in New Issue
Block a user