mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Don't display an empty custom column group box when all custom columns are deselected in Look & feel / Edit metadata
This commit is contained in:
parent
cfc14e774f
commit
d674a8e456
@ -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.
|
||||
|
@ -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}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user