mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Show multiple authors correctly in metadata dialogs.
This commit is contained in:
parent
dcdda76dbc
commit
f1806c4aa2
@ -39,8 +39,8 @@ class MetadataWidget(Widget, Ui_Form):
|
|||||||
|
|
||||||
mi = self.db.get_metadata(self.book_id, index_is_id=True)
|
mi = self.db.get_metadata(self.book_id, index_is_id=True)
|
||||||
self.title.setText(mi.title)
|
self.title.setText(mi.title)
|
||||||
if mi.authors:
|
# if mi.authors:
|
||||||
self.author.setCurrentIndex(self.author.findText(authors_to_string(mi.authors)))
|
# self.author.setCurrentIndex(self.author.findText(authors_to_string(mi.authors)))
|
||||||
if mi.publisher:
|
if mi.publisher:
|
||||||
self.publisher.setCurrentIndex(self.publisher.findText(mi.publisher))
|
self.publisher.setCurrentIndex(self.publisher.findText(mi.publisher))
|
||||||
self.author_sort.setText(mi.author_sort if mi.author_sort else '')
|
self.author_sort.setText(mi.author_sort if mi.author_sort else '')
|
||||||
@ -75,7 +75,12 @@ class MetadataWidget(Widget, Ui_Form):
|
|||||||
id, name = i
|
id, name = i
|
||||||
name = authors_to_string([name.strip().replace('|', ',') for n in name.split(',')])
|
name = authors_to_string([name.strip().replace('|', ',') for n in name.split(',')])
|
||||||
self.author.addItem(name)
|
self.author.addItem(name)
|
||||||
self.author.setCurrentIndex(-1)
|
|
||||||
|
au = self.db.authors(self.book_id, True)
|
||||||
|
if not au:
|
||||||
|
au = _('Unknown')
|
||||||
|
au = ' & '.join([a.strip().replace('|', ',') for a in au.split(',')])
|
||||||
|
self.author.setEditText(au)
|
||||||
|
|
||||||
def initialize_series(self):
|
def initialize_series(self):
|
||||||
all_series = self.db.all_series()
|
all_series = self.db.all_series()
|
||||||
|
@ -330,19 +330,16 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
def initalize_authors(self):
|
def initalize_authors(self):
|
||||||
all_authors = self.db.all_authors()
|
all_authors = self.db.all_authors()
|
||||||
all_authors.sort(cmp=lambda x, y : cmp(x[1], y[1]))
|
all_authors.sort(cmp=lambda x, y : cmp(x[1], y[1]))
|
||||||
author_id = self.db.author_id(self.row)
|
|
||||||
idx, c = None, 0
|
|
||||||
for i in all_authors:
|
for i in all_authors:
|
||||||
id, name = i
|
id, name = i
|
||||||
if id == author_id:
|
|
||||||
idx = c
|
|
||||||
name = [name.strip().replace('|', ',') for n in name.split(',')]
|
name = [name.strip().replace('|', ',') for n in name.split(',')]
|
||||||
self.authors.addItem(authors_to_string(name))
|
self.authors.addItem(authors_to_string(name))
|
||||||
c += 1
|
|
||||||
|
|
||||||
self.authors.setEditText('')
|
au = self.db.authors(self.row)
|
||||||
if idx is not None:
|
if not au:
|
||||||
self.authors.setCurrentIndex(idx)
|
au = _('Unknown')
|
||||||
|
au = ' & '.join([a.strip().replace('|', ',') for a in au.split(',')])
|
||||||
|
self.authors.setEditText(au)
|
||||||
|
|
||||||
def initialize_series(self):
|
def initialize_series(self):
|
||||||
self.series.setSizeAdjustPolicy(self.series.AdjustToContentsOnFirstShow)
|
self.series.setSizeAdjustPolicy(self.series.AdjustToContentsOnFirstShow)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user