Fix a regression in the previous release that broke the copy and recalculate author sort buttons. Fixes #1880395 [version 4.17 Manage Authors no longer copies from author sort to author](https://bugs.launchpad.net/calibre/+bug/1880395)

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2020-05-25 14:45:39 +05:30
commit d01ebe91a2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -410,22 +410,29 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
def do_recalc_author_sort(self):
self.table.cellChanged.disconnect()
for row in range(0,self.table.rowCount()):
item = self.table.item(row, 0)
aut = unicode_type(item.text()).strip()
c = self.table.item(row, 1)
item_aut = self.table.item(row, 0)
id_ = int(item_aut.data(Qt.UserRole))
aut = unicode_type(item_aut.text()).strip()
item_aus = self.table.item(row, 1)
# Sometimes trailing commas are left by changing between copy algs
c.setText(author_to_author_sort(aut).rstrip(','))
aus = unicode_type(author_to_author_sort(aut)).rstrip(',')
if aus != self.original_authors[id_]['sort']:
item_aus.setIcon(self.edited_icon)
item_aus.setText(aus)
self.authors[id_]['sort'] = aus
self.table.setFocus(Qt.OtherFocusReason)
self.table.cellChanged.connect(self.cell_changed)
def do_auth_sort_to_author(self):
self.table.cellChanged.disconnect()
for row in range(0,self.table.rowCount()):
item = self.table.item(row, 1)
aus = unicode_type(item.text()).strip()
c = self.table.item(row, 0)
# Sometimes trailing commas are left by changing between copy algs
c.setText(aus)
aus = unicode_type(self.table.item(row, 1).text()).strip()
item_aut = self.table.item(row, 0)
id_ = int(item_aut.data(Qt.UserRole))
if aus != self.original_authors[id_]['name']:
item_aut.setIcon(self.edited_icon)
item_aut.setText(aus)
self.authors[id_]['name'] = aus
self.table.setFocus(Qt.OtherFocusReason)
self.table.cellChanged.connect(self.cell_changed)