mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add checkbox to bulk metadata edit dialog to automatically set author sort
This commit is contained in:
parent
9858e4569c
commit
d623511502
@ -9,9 +9,10 @@ from PyQt4.QtGui import QDialog
|
||||
from calibre.gui2 import qstring_to_unicode
|
||||
from calibre.gui2.dialogs.metadata_bulk_ui import Ui_MetadataBulkDialog
|
||||
from calibre.gui2.dialogs.tag_editor import TagEditor
|
||||
from calibre.ebooks.metadata import string_to_authors
|
||||
from calibre.ebooks.metadata import string_to_authors, authors_to_sort_string
|
||||
|
||||
class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
||||
|
||||
def __init__(self, window, rows, db):
|
||||
QDialog.__init__(self, window)
|
||||
Ui_MetadataBulkDialog.__init__(self)
|
||||
@ -54,8 +55,15 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
||||
if au:
|
||||
au = string_to_authors(au)
|
||||
self.db.set_authors(id, au, notify=False)
|
||||
if self.auto_author_sort.isChecked():
|
||||
aut = self.db.authors(id, index_is_id=True)
|
||||
aut = aut if aut else ''
|
||||
aut = [a.strip().replace('|', ',') for a in aut.strip().split(',')]
|
||||
x = authors_to_sort_string(aut)
|
||||
if x:
|
||||
self.db.set_author_sort(id, x, notify=False)
|
||||
aus = qstring_to_unicode(self.author_sort.text())
|
||||
if aus:
|
||||
if aus and self.author_sort.isEnabled():
|
||||
self.db.set_author_sort(id, aus, notify=False)
|
||||
if self.write_rating:
|
||||
self.db.set_rating(id, 2*self.rating.value(), notify=False)
|
||||
|
@ -56,7 +56,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>Author S&ort: </string>
|
||||
@ -69,14 +69,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2" >
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<widget class="QLineEdit" name="author_sort" >
|
||||
<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>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_6" >
|
||||
<property name="text" >
|
||||
<string>&Rating:</string>
|
||||
@ -89,7 +89,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<item row="3" column="1" colspan="2" >
|
||||
<widget class="QSpinBox" name="rating" >
|
||||
<property name="toolTip" >
|
||||
<string>Rating of this book. 0-5 stars</string>
|
||||
@ -108,7 +108,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>&Publisher: </string>
|
||||
@ -121,14 +121,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2" >
|
||||
<item row="4" column="1" colspan="2" >
|
||||
<widget class="QLineEdit" name="publisher" >
|
||||
<property name="toolTip" >
|
||||
<string>Change the publisher of this book</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<item row="5" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Add Ta&gs: </string>
|
||||
@ -141,14 +141,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<item row="5" column="1" >
|
||||
<widget class="QLineEdit" name="tags" >
|
||||
<property name="toolTip" >
|
||||
<string>Tags categorize the book. This is particularly useful while searching. <br><br>They can be any words or phrases, separated by commas.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" >
|
||||
<item row="5" column="2" >
|
||||
<widget class="QToolButton" name="tag_editor_button" >
|
||||
<property name="toolTip" >
|
||||
<string>Open Tag Editor</string>
|
||||
@ -162,7 +162,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<item row="6" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>&Remove tags:</string>
|
||||
@ -172,14 +172,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2" >
|
||||
<item row="6" column="1" colspan="2" >
|
||||
<widget class="QLineEdit" name="remove_tags" >
|
||||
<property name="toolTip" >
|
||||
<string>Comma separated list of tags to remove from the books. </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" >
|
||||
<item row="7" column="0" >
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="text" >
|
||||
<string>&Series:</string>
|
||||
@ -195,7 +195,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" >
|
||||
<item row="7" column="1" >
|
||||
<widget class="QComboBox" name="series" >
|
||||
<property name="toolTip" >
|
||||
<string>List of known series. You can add new series.</string>
|
||||
@ -214,10 +214,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" >
|
||||
<item row="8" column="1" >
|
||||
<widget class="QComboBox" name="remove_format" />
|
||||
</item>
|
||||
<item row="7" column="0" >
|
||||
<item row="8" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>Remove &format:</string>
|
||||
@ -227,6 +227,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QCheckBox" name="auto_author_sort" >
|
||||
<property name="text" >
|
||||
<string>A&utomatically set author sort</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -257,8 +264,8 @@
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
<x>252</x>
|
||||
<y>382</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
@ -273,8 +280,8 @@
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
<x>320</x>
|
||||
<y>382</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
@ -282,5 +289,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>auto_author_sort</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>author_sort</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>240</x>
|
||||
<y>95</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>240</x>
|
||||
<y>113</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user