mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
4a316d16c7
@ -7,7 +7,7 @@ from PyQt5.Qt import (Qt, QDialog, QTableWidgetItem, QAbstractItemView, QIcon,
|
|||||||
QDialogButtonBox, QFrame, QLabel, QTimer, QMenu, QApplication,
|
QDialogButtonBox, QFrame, QLabel, QTimer, QMenu, QApplication,
|
||||||
QByteArray)
|
QByteArray)
|
||||||
|
|
||||||
from calibre.ebooks.metadata import author_to_author_sort
|
from calibre.ebooks.metadata import author_to_author_sort, string_to_authors
|
||||||
from calibre.gui2 import error_dialog, gprefs
|
from calibre.gui2 import error_dialog, gprefs
|
||||||
from calibre.gui2.dialogs.edit_authors_dialog_ui import Ui_EditAuthorsDialog
|
from calibre.gui2.dialogs.edit_authors_dialog_ui import Ui_EditAuthorsDialog
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
@ -314,11 +314,11 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
|
|||||||
if col == 0:
|
if col == 0:
|
||||||
item = self.table.item(row, 0)
|
item = self.table.item(row, 0)
|
||||||
aut = unicode(item.text()).strip()
|
aut = unicode(item.text()).strip()
|
||||||
amper = aut.find('&')
|
aut_list = string_to_authors(aut)
|
||||||
if amper >= 0:
|
if len(aut_list) != 1:
|
||||||
error_dialog(self.parent(), _('Invalid author name'),
|
error_dialog(self.parent(), _('Invalid author name'),
|
||||||
_('Author names cannot contain & characters.')).exec_()
|
_('You cannot change an author to multiple authors.')).exec_()
|
||||||
aut = aut.replace('&', '%')
|
aut = ' % '.join(aut_list)
|
||||||
self.table.item(row, 0).setText(aut)
|
self.table.item(row, 0).setText(aut)
|
||||||
c = self.table.item(row, 1)
|
c = self.table.item(row, 1)
|
||||||
c.setText(author_to_author_sort(aut))
|
c.setText(author_to_author_sort(aut))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user