News download: Respect more default conversion settings

News download: Apply the default page margin conversion settings. Also,
when converting to PDF, apply the pdf conversion defaults. Fixes #1193763 [Private bug](https://bugs.launchpad.net/calibre/+bug/1193763)
This commit is contained in:
Kovid Goyal 2013-06-24 10:18:24 +05:30
parent e8e4dbc35b
commit 3b0f7a90e4

View File

@ -116,7 +116,6 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{
msg = _('This book has no actual ebook files') msg = _('This book has no actual ebook files')
res.append('%s - %s'%(title, msg)) res.append('%s - %s'%(title, msg))
msg = '%s' % '\n'.join(res) msg = '%s' % '\n'.join(res)
warning_dialog(parent, _('Could not convert some books'), warning_dialog(parent, _('Could not convert some books'),
_('Could not convert %(num)d of %(tot)d books, because no supported source' _('Could not convert %(num)d of %(tot)d books, because no supported source'
@ -266,6 +265,10 @@ def fetch_scheduled_recipe(arg): # {{{
if 'output_profile' in ps: if 'output_profile' in ps:
recs.append(('output_profile', ps['output_profile'], recs.append(('output_profile', ps['output_profile'],
OptionRecommendation.HIGH)) OptionRecommendation.HIGH))
for edge in ('left', 'top', 'bottom', 'right'):
edge = 'margin_' + edge
if edge in ps:
recs.append((edge, ps[edge], OptionRecommendation.HIGH))
lf = load_defaults('look_and_feel') lf = load_defaults('look_and_feel')
if lf.get('base_font_size', 0.0) != 0.0: if lf.get('base_font_size', 0.0) != 0.0:
@ -283,13 +286,19 @@ def fetch_scheduled_recipe(arg): # {{{
if epub.get('epub_flatten', False): if epub.get('epub_flatten', False):
recs.append(('epub_flatten', True, OptionRecommendation.HIGH)) recs.append(('epub_flatten', True, OptionRecommendation.HIGH))
if fmt == 'pdf':
pdf = load_defaults('pdf_output')
from calibre.customize.ui import plugin_for_output_format
p = plugin_for_output_format('pdf')
for opt in p.options:
recs.append(opt.name, pdf.get(opt.name, opt.recommended_value), OptionRecommendation.HIGH)
args = [arg['recipe'], pt.name, recs] args = [arg['recipe'], pt.name, recs]
if arg['username'] is not None: if arg['username'] is not None:
recs.append(('username', arg['username'], OptionRecommendation.HIGH)) recs.append(('username', arg['username'], OptionRecommendation.HIGH))
if arg['password'] is not None: if arg['password'] is not None:
recs.append(('password', arg['password'], OptionRecommendation.HIGH)) recs.append(('password', arg['password'], OptionRecommendation.HIGH))
return 'gui_convert', args, _('Fetch news from ')+arg['title'], fmt.upper(), [pt] return 'gui_convert', args, _('Fetch news from ')+arg['title'], fmt.upper(), [pt]
# }}} # }}}
@ -372,3 +381,4 @@ def convert_existing(parent, db, book_ids, output_format): # {{{
return book_ids return book_ids
# }}} # }}}