GUI: Convert, check for NoSupportedInputFormats.

This commit is contained in:
John Schember 2009-05-05 08:41:17 -04:00
parent 3c045737da
commit eda53229a4

View File

@ -11,11 +11,13 @@ from PyQt4.Qt import QDialog
from calibre.ptempfile import PersistentTemporaryFile
from calibre.gui2.convert import load_specifics
from calibre.gui2.convert.single import NoSupportedInputFormats
from calibre.gui2.convert.single import Config as SingleConfig
def convert_single_ebook(parent, db, row_ids, auto_conversion=False):
changed = False
jobs = []
bad = []
total = len(row_ids)
if total == 0:
@ -25,6 +27,7 @@ def convert_single_ebook(parent, db, row_ids, auto_conversion=False):
for i, row_id in enumerate(row_ids):
temp_files = []
try:
d = SingleConfig(parent, db, row_id)
if auto_conversion:
@ -52,6 +55,17 @@ def convert_single_ebook(parent, db, row_ids, auto_conversion=False):
jobs.append(('ebook-convert', args, desc, d.output_format.upper(), row_id, temp_files))
changed = True
except NoSupportedInputFormats:
bad.append(row_id)
if bad != []:
res = []
for id in bad:
title = db.title(id, True)
res.append('<li>%s</li>'%title)
msg = _('<p>Could not convert %d of %d books, because no suitable source format was found.<ul>%s</ul>')%(len(res), total, '\n'.join(res))
warning_dialog(parent, _('Could not convert some books'), msg).exec_()
return jobs, changed