mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
1) add force renumber series to custom series bulk editing
2) add clear series to both standard and custom series bulk editing
This commit is contained in:
parent
1453722815
commit
e3781d0f15
@ -452,9 +452,25 @@ class BulkSeries(BulkBase):
|
||||
self.name_widget = w
|
||||
self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent), w]
|
||||
|
||||
self.widgets.append(QLabel(_('Automatically number books in this series'), parent))
|
||||
self.idx_widget=QCheckBox(parent)
|
||||
self.widgets.append(self.idx_widget)
|
||||
self.widgets.append(QLabel('', parent))
|
||||
w = QWidget(parent)
|
||||
layout = QHBoxLayout(w)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.remove_series = QCheckBox(parent)
|
||||
self.remove_series.setText(_('Remove series'))
|
||||
layout.addWidget(self.remove_series)
|
||||
self.idx_widget = QCheckBox(parent)
|
||||
self.idx_widget.setText(_('Automatically number books'))
|
||||
layout.addWidget(self.idx_widget)
|
||||
self.force_number = QCheckBox(parent)
|
||||
self.force_number.setText(_('Force numbers to start with '))
|
||||
layout.addWidget(self.force_number)
|
||||
self.series_start_number = QSpinBox(parent)
|
||||
self.series_start_number.setMinimum(1)
|
||||
self.series_start_number.setProperty("value", 1)
|
||||
layout.addWidget(self.series_start_number)
|
||||
layout.addItem(QSpacerItem(20, 10, QSizePolicy.Expanding, QSizePolicy.Minimum))
|
||||
self.widgets.append(w)
|
||||
|
||||
def initialize(self, book_id):
|
||||
self.idx_widget.setChecked(False)
|
||||
@ -465,17 +481,27 @@ class BulkSeries(BulkBase):
|
||||
def getter(self):
|
||||
n = unicode(self.name_widget.currentText()).strip()
|
||||
i = self.idx_widget.checkState()
|
||||
return n, i
|
||||
f = self.force_number.checkState()
|
||||
s = self.series_start_number.value()
|
||||
r = self.remove_series.checkState()
|
||||
return n, i, f, s, r
|
||||
|
||||
def commit(self, book_ids, notify=False):
|
||||
val, update_indices = self.gui_val
|
||||
val = self.normalize_ui_val(val)
|
||||
if val != '':
|
||||
val, update_indices, force_start, at_value, clear = self.gui_val
|
||||
val = '' if clear else self.normalize_ui_val(val)
|
||||
if clear or val != '':
|
||||
extras = []
|
||||
next_index = self.db.get_next_cc_series_num_for(val, num=self.col_id)
|
||||
print 'cc commit next index', next_index
|
||||
for book_id in book_ids:
|
||||
if clear:
|
||||
extras.append(None)
|
||||
continue
|
||||
if update_indices:
|
||||
if tweaks['series_index_auto_increment'] == 'next':
|
||||
if force_start:
|
||||
s_index = at_value
|
||||
at_value += 1
|
||||
elif tweaks['series_index_auto_increment'] == 'next':
|
||||
s_index = next_index
|
||||
next_index += 1
|
||||
else:
|
||||
@ -483,6 +509,8 @@ class BulkSeries(BulkBase):
|
||||
else:
|
||||
s_index = self.db.get_custom_extra(book_id, num=self.col_id,
|
||||
index_is_id=True)
|
||||
if s_index is None:
|
||||
s_index = 1.0
|
||||
extras.append(s_index)
|
||||
self.db.set_custom_bulk(book_ids, val, extras=extras,
|
||||
num=self.col_id, notify=notify)
|
||||
|
@ -32,7 +32,7 @@ class Worker(Thread):
|
||||
remove, add, au, aus, do_aus, rating, pub, do_series, \
|
||||
do_autonumber, do_remove_format, remove_format, do_swap_ta, \
|
||||
do_remove_conv, do_auto_author, series, do_series_restart, \
|
||||
series_start_value, do_title_case = self.args
|
||||
series_start_value, do_title_case, clear_series = self.args
|
||||
|
||||
# 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
|
||||
@ -75,6 +75,9 @@ class Worker(Thread):
|
||||
if pub:
|
||||
self.db.set_publisher(id, pub, notify=False, commit=False)
|
||||
|
||||
if clear_series:
|
||||
self.db.set_series(id, '', notify=False, commit=False)
|
||||
|
||||
if do_series:
|
||||
if do_series_restart:
|
||||
next = series_start_value
|
||||
@ -592,6 +595,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
||||
rating = self.rating.value()
|
||||
pub = unicode(self.publisher.text())
|
||||
do_series = self.write_series
|
||||
clear_series = self.clear_series.isChecked()
|
||||
series = unicode(self.series.currentText()).strip()
|
||||
do_autonumber = self.autonumber_series.isChecked()
|
||||
do_series_restart = self.series_numbering_restarts.isChecked()
|
||||
@ -606,7 +610,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
||||
args = (remove, add, au, aus, do_aus, rating, pub, do_series,
|
||||
do_autonumber, do_remove_format, remove_format, do_swap_ta,
|
||||
do_remove_conv, do_auto_author, series, do_series_restart,
|
||||
series_start_value, do_title_case)
|
||||
series_start_value, do_title_case, clear_series)
|
||||
|
||||
bb = BlockingBusy(_('Applying changes to %d books. This may take a while.')
|
||||
%len(self.ids), parent=self)
|
||||
|
@ -225,61 +225,50 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="EnComboBox" name="series">
|
||||
<property name="toolTip">
|
||||
<string>List of known series. You can add new series.</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>List of known series. You can add new series.</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAlphabetically</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Remove &format:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>remove_format</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="remove_format"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="EnComboBox" name="authors">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="swap_title_and_author">
|
||||
<property name="text">
|
||||
<string>&Swap title and author</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="change_title_to_title_case">
|
||||
<property name="text">
|
||||
<string>Change title to title case</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Force the title to be in title case. If both this and swap authors are checked,
|
||||
title and author are swapped before the title case is set</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="HLayout_34">
|
||||
<item>
|
||||
<widget class="EnComboBox" name="series">
|
||||
<property name="toolTip">
|
||||
<string>List of known series. You can add new series.</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>List of known series. You can add new series.</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAlphabetically</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="clear_series">
|
||||
<property name="toolTip">
|
||||
<string>If checked, the series will be cleared</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear series</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="HSpacer_344">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>00</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="2">
|
||||
<layout class="QHBoxLayout" name="HLayout_3">
|
||||
@ -339,6 +328,44 @@ from the value in the box</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Remove &format:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>remove_format</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="remove_format"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="EnComboBox" name="authors">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="swap_title_and_author">
|
||||
<property name="text">
|
||||
<string>&Swap title and author</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="change_title_to_title_case">
|
||||
<property name="text">
|
||||
<string>Change title to title case</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Force the title to be in title case. If both this and swap authors are checked,
|
||||
title and author are swapped before the title case is set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="remove_conversion_settings">
|
||||
<property name="toolTip">
|
||||
|
Loading…
x
Reference in New Issue
Block a user