mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Have the author sort box in the edit metadata dialog indicate if the author sort string is correct
This commit is contained in:
commit
32381d8030
@ -375,6 +375,10 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
self.remove_unused_series)
|
self.remove_unused_series)
|
||||||
QObject.connect(self.auto_author_sort, SIGNAL('clicked()'),
|
QObject.connect(self.auto_author_sort, SIGNAL('clicked()'),
|
||||||
self.deduce_author_sort)
|
self.deduce_author_sort)
|
||||||
|
self.connect(self.author_sort, SIGNAL('textChanged(const QString&)'),
|
||||||
|
self.author_sort_box_changed)
|
||||||
|
self.connect(self.authors, SIGNAL('editTextChanged(const QString&)'),
|
||||||
|
self.authors_box_changed)
|
||||||
self.connect(self.formats, SIGNAL('itemDoubleClicked(QListWidgetItem*)'),
|
self.connect(self.formats, SIGNAL('itemDoubleClicked(QListWidgetItem*)'),
|
||||||
self.show_format)
|
self.show_format)
|
||||||
self.connect(self.formats, SIGNAL('delete_format()'), self.remove_format)
|
self.connect(self.formats, SIGNAL('delete_format()'), self.remove_format)
|
||||||
@ -467,6 +471,26 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
for c in range(2, len(ans[i].widgets), 2):
|
for c in range(2, len(ans[i].widgets), 2):
|
||||||
w.setTabOrder(ans[i].widgets[c-1], ans[i].widgets[c+1])
|
w.setTabOrder(ans[i].widgets[c-1], ans[i].widgets[c+1])
|
||||||
|
|
||||||
|
def authors_box_changed(self, txt):
|
||||||
|
aus = unicode(txt)
|
||||||
|
aus = re.sub(r'\s+et al\.$', '', aus)
|
||||||
|
aus = self.db.author_sort_from_authors(string_to_authors(aus))
|
||||||
|
self.mark_author_sort(normal=(unicode(self.author_sort.text()) == aus))
|
||||||
|
|
||||||
|
def author_sort_box_changed(self, txt):
|
||||||
|
au = unicode(self.authors.text())
|
||||||
|
au = re.sub(r'\s+et al\.$', '', au)
|
||||||
|
au = self.db.author_sort_from_authors(string_to_authors(au))
|
||||||
|
self.mark_author_sort(normal=(au == txt))
|
||||||
|
|
||||||
|
def mark_author_sort(self, normal=True):
|
||||||
|
if normal:
|
||||||
|
col = 'rgb(0, 255, 0, 20%)'
|
||||||
|
else:
|
||||||
|
col = 'rgb(255, 0, 0, 20%)'
|
||||||
|
self.author_sort.setStyleSheet('QLineEdit { color: black; '
|
||||||
|
'background-color: %s; }'%col)
|
||||||
|
|
||||||
def validate_isbn(self, isbn):
|
def validate_isbn(self, isbn):
|
||||||
isbn = unicode(isbn).strip()
|
isbn = unicode(isbn).strip()
|
||||||
if not isbn:
|
if not isbn:
|
||||||
|
@ -151,14 +151,16 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="EnLineEdit" name="author_sort">
|
<widget class="EnLineEdit" name="author_sort">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles.</string>
|
<string>Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles.
|
||||||
|
If the box is colored green, then text matches the individual author's sort strings. If it is colored red, then the authors and this text do not match.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="auto_author_sort">
|
<widget class="QToolButton" name="auto_author_sort">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Automatically create the author sort entry based on the current author entry</string>
|
<string>Automatically create the author sort entry based on the current author entry.
|
||||||
|
Using this button to create author sort will change author sort from red to green.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user