mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make case differences between author and author sort show red, while preserving the behavior of automatically correcting the case if the author changes.
This commit is contained in:
parent
01511731e3
commit
4cfa6fdf1f
@ -461,6 +461,7 @@ class AuthorSortEdit(EnLineEdit, ToMetadataMixin):
|
||||
a_to_as.triggered.connect(self.author_to_sort)
|
||||
as_to_a.triggered.connect(self.sort_to_author)
|
||||
self.original_val = ''
|
||||
self.first_time = True
|
||||
self.update_state()
|
||||
|
||||
@dynamic_property
|
||||
@ -480,8 +481,9 @@ class AuthorSortEdit(EnLineEdit, ToMetadataMixin):
|
||||
def update_state_and_val(self):
|
||||
# Handle case change if the authors box changed
|
||||
aus = authors_to_sort_string(self.authors_edit.current_val)
|
||||
if strcmp(aus, self.current_val) == 0:
|
||||
if not self.first_time and strcmp(aus, self.current_val) == 0:
|
||||
self.current_val = aus
|
||||
self.first_time = False
|
||||
self.update_state()
|
||||
|
||||
def update_state(self, *args):
|
||||
@ -489,7 +491,7 @@ class AuthorSortEdit(EnLineEdit, ToMetadataMixin):
|
||||
au = re.sub(r'\s+et al\.$', '', au)
|
||||
au = self.db.author_sort_from_authors(string_to_authors(au))
|
||||
|
||||
normal = strcmp(au, self.current_val) == 0
|
||||
normal = au == self.current_val
|
||||
col = OK_COLOR if normal else ERR_COLOR
|
||||
self.setStyleSheet(INDICATOR_SHEET % col)
|
||||
tt = self.tooltips[0 if normal else 1]
|
||||
@ -536,6 +538,7 @@ class AuthorSortEdit(EnLineEdit, ToMetadataMixin):
|
||||
aus = self.current_val
|
||||
if aus != self.original_val or self.authors_edit.original_val != self.authors_edit.current_val:
|
||||
db.set_author_sort(id_, aus, notify=False, commit=False)
|
||||
self.first_time = True
|
||||
return True
|
||||
|
||||
def break_cycles(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user