mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Use the all_field_names() API in a few more places
This commit is contained in:
parent
bc6e492596
commit
a04171dfb4
@ -92,7 +92,7 @@ class MetadataWidget(Widget, Ui_Form):
|
|||||||
self.author_sort.setText(mi.author_sort if mi.author_sort else '')
|
self.author_sort.setText(mi.author_sort if mi.author_sort else '')
|
||||||
self.author_sort.home(False)
|
self.author_sort.home(False)
|
||||||
self.tags.setText(', '.join(mi.tags if mi.tags else []))
|
self.tags.setText(', '.join(mi.tags if mi.tags else []))
|
||||||
self.tags.update_items_cache(self.db.all_tags())
|
self.tags.update_items_cache(self.db.new_api.all_field_names('tags'))
|
||||||
self.tags.home(False)
|
self.tags.home(False)
|
||||||
self.comment.html = comments_to_html(mi.comments) if mi.comments else ''
|
self.comment.html = comments_to_html(mi.comments) if mi.comments else ''
|
||||||
self.series.show_initial_value(mi.series if mi.series else '')
|
self.series.show_initial_value(mi.series if mi.series else '')
|
||||||
@ -141,7 +141,7 @@ class MetadataWidget(Widget, Ui_Form):
|
|||||||
self.author.set_separator('&')
|
self.author.set_separator('&')
|
||||||
self.author.set_space_before_sep(True)
|
self.author.set_space_before_sep(True)
|
||||||
self.author.set_add_separator(tweaks['authors_completer_append_separator'])
|
self.author.set_add_separator(tweaks['authors_completer_append_separator'])
|
||||||
self.author.update_items_cache(self.db.all_author_names())
|
self.author.update_items_cache(self.db.new_api.all_field_names('authors'))
|
||||||
|
|
||||||
au = self.db.authors(self.book_id, True)
|
au = self.db.authors(self.book_id, True)
|
||||||
if not au:
|
if not au:
|
||||||
@ -151,16 +151,12 @@ class MetadataWidget(Widget, Ui_Form):
|
|||||||
self.author.home(False)
|
self.author.home(False)
|
||||||
|
|
||||||
def initialize_series(self):
|
def initialize_series(self):
|
||||||
all_series = self.db.all_series()
|
|
||||||
all_series.sort(key=lambda x : sort_key(x[1]))
|
|
||||||
self.series.set_separator(None)
|
self.series.set_separator(None)
|
||||||
self.series.update_items_cache([x[1] for x in all_series])
|
self.series.update_items_cache(self.db.new_api.all_field_names('series'))
|
||||||
|
|
||||||
def initialize_publisher(self):
|
def initialize_publisher(self):
|
||||||
all_publishers = self.db.all_publishers()
|
|
||||||
all_publishers.sort(key=lambda x : sort_key(x[1]))
|
|
||||||
self.publisher.set_separator(None)
|
self.publisher.set_separator(None)
|
||||||
self.publisher.update_items_cache([x[1] for x in all_publishers])
|
self.publisher.update_items_cache(self.db.new_api.all_field_names('publisher'))
|
||||||
|
|
||||||
def get_title_and_authors(self):
|
def get_title_and_authors(self):
|
||||||
title = unicode_type(self.title.text()).strip()
|
title = unicode_type(self.title.text()).strip()
|
||||||
|
@ -491,7 +491,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
self.comments = null
|
self.comments = null
|
||||||
self.comments_button.clicked.connect(self.set_comments)
|
self.comments_button.clicked.connect(self.set_comments)
|
||||||
|
|
||||||
all_tags = self.db.all_tags()
|
all_tags = self.db.new_api.all_field_names('tags')
|
||||||
self.tags.update_items_cache(all_tags)
|
self.tags.update_items_cache(all_tags)
|
||||||
self.remove_tags.update_items_cache(all_tags)
|
self.remove_tags.update_items_cache(all_tags)
|
||||||
|
|
||||||
@ -1094,21 +1094,16 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
self.authors.set_separator('&')
|
self.authors.set_separator('&')
|
||||||
self.authors.set_space_before_sep(True)
|
self.authors.set_space_before_sep(True)
|
||||||
self.authors.set_add_separator(tweaks['authors_completer_append_separator'])
|
self.authors.set_add_separator(tweaks['authors_completer_append_separator'])
|
||||||
self.authors.update_items_cache(self.db.all_author_names())
|
self.authors.update_items_cache(self.db.new_api.all_field_names('authors'))
|
||||||
self.authors.show_initial_value('')
|
self.authors.show_initial_value('')
|
||||||
|
|
||||||
def initialize_series(self):
|
def initialize_series(self):
|
||||||
all_series = self.db.all_series()
|
|
||||||
all_series.sort(key=lambda x : sort_key(x[1]))
|
|
||||||
self.series.set_separator(None)
|
self.series.set_separator(None)
|
||||||
self.series.update_items_cache([x[1] for x in all_series])
|
self.series.update_items_cache(self.db.new_api.all_field_names('series'))
|
||||||
self.series.show_initial_value('')
|
self.series.show_initial_value('')
|
||||||
|
|
||||||
def initialize_publisher(self):
|
def initialize_publisher(self):
|
||||||
all_publishers = self.db.all_publishers()
|
self.publisher.update_items_cache(self.db.new_api.all_field_names('publisher'))
|
||||||
all_publishers.sort(key=lambda x : sort_key(x[1]))
|
|
||||||
self.publisher.set_separator(None)
|
|
||||||
self.publisher.update_items_cache([x[1] for x in all_publishers])
|
|
||||||
self.publisher.show_initial_value('')
|
self.publisher.show_initial_value('')
|
||||||
|
|
||||||
def tag_editor(self, *args):
|
def tag_editor(self, *args):
|
||||||
@ -1117,8 +1112,9 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
if d.result() == QDialog.Accepted:
|
if d.result() == QDialog.Accepted:
|
||||||
tag_string = ', '.join(d.tags)
|
tag_string = ', '.join(d.tags)
|
||||||
self.tags.setText(tag_string)
|
self.tags.setText(tag_string)
|
||||||
self.tags.update_items_cache(self.db.all_tags())
|
all_tags = self.db.new_api.all_field_names('tags')
|
||||||
self.remove_tags.update_items_cache(self.db.all_tags())
|
self.tags.update_items_cache(all_tags)
|
||||||
|
self.remove_tags.update_items_cache(all_tags)
|
||||||
|
|
||||||
def auto_number_changed(self, state):
|
def auto_number_changed(self, state):
|
||||||
self.series_start_number.setEnabled(bool(state))
|
self.series_start_number.setEnabled(bool(state))
|
||||||
|
@ -1377,7 +1377,7 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{
|
|||||||
tags = db.tags(id_, index_is_id=True)
|
tags = db.tags(id_, index_is_id=True)
|
||||||
tags = tags.split(',') if tags else []
|
tags = tags.split(',') if tags else []
|
||||||
self.current_val = tags
|
self.current_val = tags
|
||||||
self.all_items = db.all_tag_names()
|
self.update_items_cache(db.new_api.all_field_names('tags'))
|
||||||
self.original_val = self.current_val
|
self.original_val = self.current_val
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -1401,7 +1401,7 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{
|
|||||||
d = TagEditor(self, db, id_)
|
d = TagEditor(self, db, id_)
|
||||||
if d.exec_() == TagEditor.Accepted:
|
if d.exec_() == TagEditor.Accepted:
|
||||||
self.current_val = d.tags
|
self.current_val = d.tags
|
||||||
self.all_items = db.all_tags()
|
self.update_items_cache(db.new_api.all_field_names('tags'))
|
||||||
|
|
||||||
def commit(self, db, id_):
|
def commit(self, db, id_):
|
||||||
self.books_to_refresh |= db.set_tags(
|
self.books_to_refresh |= db.set_tags(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user