mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Bulk convert dialog: Disable the Use saved conversion settings checkbox when none of the books being converted has saved conversion settings
This commit is contained in:
parent
6a61953e73
commit
21b7488508
@ -25,7 +25,8 @@ from calibre.utils.logging import Log
|
||||
|
||||
class BulkConfig(Config):
|
||||
|
||||
def __init__(self, parent, db, preferred_output_format=None):
|
||||
def __init__(self, parent, db, preferred_output_format=None,
|
||||
has_saved_settings=True):
|
||||
ResizableDialog.__init__(self, parent)
|
||||
|
||||
self.setup_output_formats(db, preferred_output_format)
|
||||
@ -54,6 +55,12 @@ class BulkConfig(Config):
|
||||
rb = self.buttonBox.button(self.buttonBox.RestoreDefaults)
|
||||
rb.setVisible(False)
|
||||
self.groups.setMouseTracking(True)
|
||||
if not has_saved_settings:
|
||||
o = self.opt_individual_saved_settings
|
||||
o.setEnabled(False)
|
||||
o.setToolTip(_('None of the selected books have saved conversion '
|
||||
'settings.'))
|
||||
o.setChecked(False)
|
||||
|
||||
|
||||
def setup_pipeline(self, *args):
|
||||
|
@ -112,7 +112,10 @@ def convert_bulk_ebook(parent, queue, db, book_ids, out_format=None, args=[]):
|
||||
if total == 0:
|
||||
return None, None, None
|
||||
|
||||
d = BulkConfig(parent, db, out_format)
|
||||
has_saved_settings = db.has_conversion_options(book_ids)
|
||||
|
||||
d = BulkConfig(parent, db, out_format,
|
||||
has_saved_settings=has_saved_settings)
|
||||
if d.exec_() != QDialog.Accepted:
|
||||
return None
|
||||
|
||||
|
@ -1085,6 +1085,11 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
|
||||
return cPickle.loads(str(data))
|
||||
return None
|
||||
|
||||
def has_conversion_options(self, ids, format='PIPE'):
|
||||
return self.conn.get('''
|
||||
SELECT data FROM conversion_options WHERE book IN %r AND
|
||||
format=? LIMIT 1'''%(tuple(ids),), (format,), all=False) is not None
|
||||
|
||||
def delete_conversion_options(self, id, format, commit=True):
|
||||
self.conn.execute('DELETE FROM conversion_options WHERE book=? AND format=?',
|
||||
(id, format.upper()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user