Bulk conversion: Add option to disable using per-book settings from a previous conversion

This commit is contained in:
Kovid Goyal 2009-11-15 20:38:25 -07:00
parent 1d107a2714
commit 15dc2da704
5 changed files with 27 additions and 7 deletions

View File

@ -31,6 +31,13 @@ class BulkConfig(Config):
self.input_label.hide() self.input_label.hide()
self.input_formats.hide() self.input_formats.hide()
self.opt_individual_saved_settings.setVisible(True)
self.opt_individual_saved_settings.setChecked(True)
self.opt_individual_saved_settings.setToolTip(_('For '
'settings that cannot be specified in this dialog, use the '
'values saved in a previous conversion (if they exist) instead '
'of using the defaults specified in the Preferences'))
self.connect(self.output_formats, SIGNAL('currentIndexChanged(QString)'), self.connect(self.output_formats, SIGNAL('currentIndexChanged(QString)'),
self.setup_pipeline) self.setup_pipeline)

View File

@ -116,6 +116,7 @@ class Config(ResizableDialog, Ui_Dialog):
def __init__(self, parent, db, book_id, def __init__(self, parent, db, book_id,
preferred_input_format=None, preferred_output_format=None): preferred_input_format=None, preferred_output_format=None):
ResizableDialog.__init__(self, parent) ResizableDialog.__init__(self, parent)
self.opt_individual_saved_settings.setVisible(False)
self.db, self.book_id = db, book_id self.db, self.book_id = db, book_id
self.setup_input_output_formats(self.db, self.book_id, preferred_input_format, self.setup_input_output_formats(self.db, self.book_id, preferred_input_format,

View File

@ -33,6 +33,13 @@
<item> <item>
<widget class="QComboBox" name="input_formats"/> <widget class="QComboBox" name="input_formats"/>
</item> </item>
<item>
<widget class="QCheckBox" name="opt_individual_saved_settings">
<property name="text">
<string>Use &amp;saved conversion settings for individual books</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -109,7 +116,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>810</width> <width>810</width>
<height>492</height> <height>489</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">

View File

@ -111,17 +111,21 @@ def convert_bulk_ebook(parent, queue, db, book_ids, out_format=None, args=[]):
user_recs = cPickle.loads(d.recommendations) user_recs = cPickle.loads(d.recommendations)
book_ids = convert_existing(parent, db, book_ids, output_format) book_ids = convert_existing(parent, db, book_ids, output_format)
return QueueBulk(parent, book_ids, output_format, queue, db, user_recs, args) use_saved_single_settings = d.opt_individual_saved_settings.isChecked()
return QueueBulk(parent, book_ids, output_format, queue, db, user_recs,
args, use_saved_single_settings=use_saved_single_settings)
class QueueBulk(QProgressDialog): class QueueBulk(QProgressDialog):
def __init__(self, parent, book_ids, output_format, queue, db, user_recs, args): def __init__(self, parent, book_ids, output_format, queue, db, user_recs,
args, use_saved_single_settings=True):
QProgressDialog.__init__(self, '', QProgressDialog.__init__(self, '',
QString(), 0, len(book_ids), parent) QString(), 0, len(book_ids), parent)
self.setWindowTitle(_('Queueing books for bulk conversion')) self.setWindowTitle(_('Queueing books for bulk conversion'))
self.book_ids, self.output_format, self.queue, self.db, self.args, self.user_recs = \ self.book_ids, self.output_format, self.queue, self.db, self.args, self.user_recs = \
book_ids, output_format, queue, db, args, user_recs book_ids, output_format, queue, db, args, user_recs
self.parent = parent self.parent = parent
self.use_saved_single_settings = use_saved_single_settings
self.i, self.bad, self.jobs, self.changed = 0, [], [], False self.i, self.bad, self.jobs, self.changed = 0, [], [], False
self.timer = QTimer(self) self.timer = QTimer(self)
self.connect(self.timer, SIGNAL('timeout()'), self.do_book) self.connect(self.timer, SIGNAL('timeout()'), self.do_book)
@ -149,9 +153,10 @@ class QueueBulk(QProgressDialog):
combined_recs = GuiRecommendations() combined_recs = GuiRecommendations()
default_recs = load_defaults('%s_input' % input_format) default_recs = load_defaults('%s_input' % input_format)
specific_recs = load_specifics(self.db, book_id)
for key in default_recs: for key in default_recs:
combined_recs[key] = default_recs[key] combined_recs[key] = default_recs[key]
if self.use_saved_single_settings:
specific_recs = load_specifics(self.db, book_id)
for key in specific_recs: for key in specific_recs:
combined_recs[key] = specific_recs[key] combined_recs[key] = specific_recs[key]
for item in self.user_recs: for item in self.user_recs:

View File

@ -421,7 +421,7 @@ button in the individual book conversion dialog.
When you Bulk Convert a set of books, settings are taken in the following order: When you Bulk Convert a set of books, settings are taken in the following order:
* From the defaults set in Preferences->Conversion * From the defaults set in Preferences->Conversion
* From the saved conversion settings for each book being converted (if any) * From the saved conversion settings for each book being converted (if any). This can be turned off by the option in the top left corner of the Bulk Conversion dialog.
* From the settings set in the Bulk conversion dialog * From the settings set in the Bulk conversion dialog
Note that the final settings for each book in a Bulk Conversion will be saved and re-used if the book is converted again. Since the Note that the final settings for each book in a Bulk Conversion will be saved and re-used if the book is converted again. Since the