Fix #2107683 [Remove Id, Modified, Size etc in Book Details gives error](https://bugs.launchpad.net/calibre/+bug/2107683)

This commit is contained in:
Kovid Goyal 2025-04-20 09:19:01 +05:30
parent 8206dd2966
commit 313367c5b7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -579,11 +579,13 @@ def add_item_specific_entries(menu, data, book_info, copy_menu, search_menu):
v = data.get('original_value') or data.get('value')
copy_menu.addAction(QIcon.ic('edit-copy.png'), _('The text: {}').format(v),
lambda: QApplication.instance().clipboard().setText(v))
if field != 'size':
ac = book_info.remove_item_action
ac.data = (field, remove_value, book_id)
ac.setText(_('Remove %s from this book') % escape_for_menu(remove_name or data.get('original_value') or value))
menu.addAction(ac)
if field not in ('size', 'id', 'last_modified'):
fm = get_gui().current_db.new_api.field_metadata.get(field) or {}
if fm.get('datatype') != 'composite':
ac = book_info.remove_item_action
ac.data = (field, remove_value, book_id)
ac.setText(_('Remove %s from this book') % escape_for_menu(remove_name or data.get('original_value') or value))
menu.addAction(ac)
# See if we need to add a click associated link menu line
link_map = get_gui().current_db.new_api.get_all_link_maps_for_book(data.get('book_id', -1))
link = link_map.get(field, {}).get(value)