mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add 'start series renumbering from N' to bulk edit.
This commit is contained in:
parent
ff73865d9e
commit
be2210f928
@ -31,7 +31,8 @@ class Worker(Thread):
|
|||||||
def doit(self):
|
def doit(self):
|
||||||
remove, add, au, aus, do_aus, rating, pub, do_series, \
|
remove, add, au, aus, do_aus, rating, pub, do_series, \
|
||||||
do_autonumber, do_remove_format, remove_format, do_swap_ta, \
|
do_autonumber, do_remove_format, remove_format, do_swap_ta, \
|
||||||
do_remove_conv, do_auto_author, series = self.args
|
do_remove_conv, do_auto_author, series, do_series_restart, \
|
||||||
|
series_start_value = self.args
|
||||||
|
|
||||||
# first loop: do author and title. These will commit at the end of each
|
# first loop: do author and title. These will commit at the end of each
|
||||||
# operation, because each operation modifies the file system. We want to
|
# operation, because each operation modifies the file system. We want to
|
||||||
@ -69,6 +70,10 @@ class Worker(Thread):
|
|||||||
self.db.set_publisher(id, pub, notify=False, commit=False)
|
self.db.set_publisher(id, pub, notify=False, commit=False)
|
||||||
|
|
||||||
if do_series:
|
if do_series:
|
||||||
|
if do_series_restart:
|
||||||
|
next = series_start_value
|
||||||
|
series_start_value += 1
|
||||||
|
else:
|
||||||
next = self.db.get_next_series_num_for(series)
|
next = self.db.get_next_series_num_for(series)
|
||||||
self.db.set_series(id, series, notify=False, commit=False)
|
self.db.set_series(id, series, notify=False, commit=False)
|
||||||
num = next if do_autonumber and series else 1.0
|
num = next if do_autonumber and series else 1.0
|
||||||
@ -163,6 +168,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
self.series.currentIndexChanged[int].connect(self.series_changed)
|
self.series.currentIndexChanged[int].connect(self.series_changed)
|
||||||
self.series.editTextChanged.connect(self.series_changed)
|
self.series.editTextChanged.connect(self.series_changed)
|
||||||
self.tag_editor_button.clicked.connect(self.tag_editor)
|
self.tag_editor_button.clicked.connect(self.tag_editor)
|
||||||
|
self.autonumber_series.stateChanged[int].connect(self.auto_number_changed)
|
||||||
|
|
||||||
if len(db.custom_column_label_map) == 0:
|
if len(db.custom_column_label_map) == 0:
|
||||||
self.central_widget.removeTab(1)
|
self.central_widget.removeTab(1)
|
||||||
@ -538,6 +544,16 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
self.tags.update_tags_cache(self.db.all_tags())
|
self.tags.update_tags_cache(self.db.all_tags())
|
||||||
self.remove_tags.update_tags_cache(self.db.all_tags())
|
self.remove_tags.update_tags_cache(self.db.all_tags())
|
||||||
|
|
||||||
|
def auto_number_changed(self, state):
|
||||||
|
if state:
|
||||||
|
self.series_numbering_restarts.setEnabled(True)
|
||||||
|
self.series_start_number.setEnabled(True)
|
||||||
|
else:
|
||||||
|
self.series_numbering_restarts.setEnabled(False)
|
||||||
|
self.series_numbering_restarts.setChecked(False)
|
||||||
|
self.series_start_number.setEnabled(False)
|
||||||
|
self.series_start_number.setValue(1)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if len(self.ids) < 1:
|
if len(self.ids) < 1:
|
||||||
return QDialog.accept(self)
|
return QDialog.accept(self)
|
||||||
@ -566,6 +582,8 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
do_series = self.write_series
|
do_series = self.write_series
|
||||||
series = unicode(self.series.currentText()).strip()
|
series = unicode(self.series.currentText()).strip()
|
||||||
do_autonumber = self.autonumber_series.isChecked()
|
do_autonumber = self.autonumber_series.isChecked()
|
||||||
|
do_series_restart = self.series_numbering_restarts.isChecked()
|
||||||
|
series_start_value = self.series_start_number.value()
|
||||||
do_remove_format = self.remove_format.currentIndex() > -1
|
do_remove_format = self.remove_format.currentIndex() > -1
|
||||||
remove_format = unicode(self.remove_format.currentText())
|
remove_format = unicode(self.remove_format.currentText())
|
||||||
do_swap_ta = self.swap_title_and_author.isChecked()
|
do_swap_ta = self.swap_title_and_author.isChecked()
|
||||||
@ -574,7 +592,8 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
|
|
||||||
args = (remove, add, au, aus, do_aus, rating, pub, do_series,
|
args = (remove, add, au, aus, do_aus, rating, pub, do_series,
|
||||||
do_autonumber, do_remove_format, remove_format, do_swap_ta,
|
do_autonumber, do_remove_format, remove_format, do_swap_ta,
|
||||||
do_remove_conv, do_auto_author, series)
|
do_remove_conv, do_auto_author, series, do_series_restart,
|
||||||
|
series_start_value)
|
||||||
|
|
||||||
bb = BlockingBusy(_('Applying changes to %d books. This may take a while.')
|
bb = BlockingBusy(_('Applying changes to %d books. This may take a while.')
|
||||||
%len(self.ids), parent=self)
|
%len(self.ids), parent=self)
|
||||||
|
@ -270,12 +270,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="8" column="1" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="HLayout_3">
|
||||||
|
<item>
|
||||||
<widget class="QCheckBox" name="autonumber_series">
|
<widget class="QCheckBox" name="autonumber_series">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Selected books will be automatically numbered,
|
<string>If not checked, the series number for the books will be set to 1.
|
||||||
in the order you selected them.
|
If checked, selected books will be automatically numbered, in the order
|
||||||
So if you selected Book A and then Book B,
|
you selected them. So if you selected Book A and then Book B,
|
||||||
Book A will have series number 1 and Book B series number 2.</string>
|
Book A will have series number 1 and Book B series number 2.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -283,6 +285,49 @@ Book A will have series number 1 and Book B series number 2.</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="series_numbering_restarts">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Series will normally be renumbered from the highest number in the database
|
||||||
|
for that series. Checking this box will tell calibre to start numbering
|
||||||
|
from the value in the box</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Force numbers to start with </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="series_start_number">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="HSpacer_34">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="10" column="0" colspan="2">
|
<item row="10" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="remove_conversion_settings">
|
<widget class="QCheckBox" name="remove_conversion_settings">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -599,7 +644,7 @@ nothing should be put between the original text and the inserted text</string>
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>40</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user