diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index 0fb9f193a8..2a8203827a 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -874,6 +874,11 @@ def get_field_list(db, use_defaults=False, pref_data_override=None): return [(k,v) for k,v in result.items()] +def get_custom_columns_to_display_in_editor(db): + return list([k[0] for k in + get_field_list(db, use_defaults=db.prefs['edit_metadata_ignore_display_order']) if k[1]]) + + def populate_metadata_page(layout, db, book_id, bulk=False, two_column=False, parent=None): def widget_factory(typ, key): if bulk: @@ -886,7 +891,7 @@ def populate_metadata_page(layout, db, book_id, bulk=False, two_column=False, pa fm = db.field_metadata # Get list of all non-composite custom fields. We must make widgets for these - cols = [k[0] for k in get_field_list(db, use_defaults=db.prefs['edit_metadata_ignore_display_order']) if k[1]] + cols = get_custom_columns_to_display_in_editor(db) # This deals with the historical behavior where comments fields go to the # bottom, starting on the left hand side. If a comment field is moved to # somewhere else then it isn't moved to either side. diff --git a/src/calibre/gui2/metadata/single.py b/src/calibre/gui2/metadata/single.py index 2e05348c13..ceaa5efbdb 100644 --- a/src/calibre/gui2/metadata/single.py +++ b/src/calibre/gui2/metadata/single.py @@ -19,7 +19,8 @@ from calibre.constants import ismacos from calibre.ebooks.metadata import authors_to_string, string_to_authors from calibre.ebooks.metadata.book.base import Metadata from calibre.gui2 import error_dialog, gprefs, pixmap_to_data -from calibre.gui2.custom_column_widgets import Comments, populate_metadata_page +from calibre.gui2.custom_column_widgets import ( + Comments, populate_metadata_page, get_custom_columns_to_display_in_editor) from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2.metadata.basic_widgets import ( AuthorsEdit, AuthorSortEdit, BuddyLabel, CommentsEdit, Cover, DateEdit, @@ -121,7 +122,7 @@ class MetadataSingleDialogBase(QDialog): self.create_basic_metadata_widgets() - if len(self.db.custom_column_label_map): + if len(get_custom_columns_to_display_in_editor(self.db)): self.create_custom_metadata_widgets() self.comments_edit_state_at_apply = {self.comments:None}