mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1901794 [[Enhancement] Add ability to undo set author sort from author and set title sort from title](https://bugs.launchpad.net/calibre/+bug/1901794)
This commit is contained in:
parent
a5db80bb55
commit
c78081c26e
@ -307,8 +307,8 @@ class TitleSortEdit(TitleEdit, ToMetadataMixin):
|
|||||||
self.setWhatsThis(tt)
|
self.setWhatsThis(tt)
|
||||||
|
|
||||||
def auto_generate(self, *args):
|
def auto_generate(self, *args):
|
||||||
self.current_val = title_sort(self.title_edit.current_val,
|
self.set_value(title_sort(self.title_edit.current_val,
|
||||||
lang=self.book_lang)
|
lang=self.book_lang))
|
||||||
|
|
||||||
def break_cycles(self):
|
def break_cycles(self):
|
||||||
try:
|
try:
|
||||||
@ -361,7 +361,7 @@ class AuthorsEdit(EditWithComplete, ToMetadataMixin):
|
|||||||
from calibre.gui2.dialogs.authors_edit import AuthorsEdit
|
from calibre.gui2.dialogs.authors_edit import AuthorsEdit
|
||||||
d = AuthorsEdit(all_authors, current_authors, self)
|
d = AuthorsEdit(all_authors, current_authors, self)
|
||||||
if d.exec_() == d.Accepted:
|
if d.exec_() == d.Accepted:
|
||||||
self.current_val = d.authors
|
self.set_value(d.authors)
|
||||||
|
|
||||||
def manage_authors(self):
|
def manage_authors(self):
|
||||||
if self.original_val != self.current_val:
|
if self.original_val != self.current_val:
|
||||||
@ -529,24 +529,24 @@ class AuthorSortEdit(EnLineEdit, ToMetadataMixin):
|
|||||||
if meth in ('invert', 'nocomma', 'comma'):
|
if meth in ('invert', 'nocomma', 'comma'):
|
||||||
one = rest.strip() + ' ' + ln.strip()
|
one = rest.strip() + ' ' + ln.strip()
|
||||||
ans.append(one)
|
ans.append(one)
|
||||||
self.authors_edit.current_val = ans
|
self.authors_edit.set_value(ans)
|
||||||
|
|
||||||
def auto_generate(self, *args):
|
def auto_generate(self, *args):
|
||||||
au = unicode_type(self.authors_edit.text())
|
au = unicode_type(self.authors_edit.text())
|
||||||
au = re.sub(r'\s+et al\.$', '', au).strip()
|
au = re.sub(r'\s+et al\.$', '', au).strip()
|
||||||
authors = string_to_authors(au)
|
authors = string_to_authors(au)
|
||||||
self.current_val = self.author_sort_from_authors(authors)
|
self.set_value(self.author_sort_from_authors(authors))
|
||||||
|
|
||||||
def author_to_sort(self, *args):
|
def author_to_sort(self, *args):
|
||||||
au = unicode_type(self.authors_edit.text())
|
au = unicode_type(self.authors_edit.text())
|
||||||
au = re.sub(r'\s+et al\.$', '', au).strip()
|
au = re.sub(r'\s+et al\.$', '', au).strip()
|
||||||
if au:
|
if au:
|
||||||
self.current_val = au
|
self.set_value(au)
|
||||||
|
|
||||||
def sort_to_author(self, *args):
|
def sort_to_author(self, *args):
|
||||||
aus = self.current_val
|
aus = self.current_val
|
||||||
if aus:
|
if aus:
|
||||||
self.authors_edit.current_val = [aus]
|
self.authors_edit.set_value([aus])
|
||||||
|
|
||||||
def initialize(self, db, id_):
|
def initialize(self, db, id_):
|
||||||
self.current_val = db.author_sort(id_, index_is_id=True)
|
self.current_val = db.author_sort(id_, index_is_id=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user