mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
e8e4dbc35b
commit
3b0f7a90e4
@ -24,7 +24,7 @@ from calibre.ebooks.conversion.config import GuiRecommendations, \
|
|||||||
load_defaults, load_specifics, save_specifics
|
load_defaults, load_specifics, save_specifics
|
||||||
from calibre.gui2.convert import bulk_defaults_for_input_format
|
from calibre.gui2.convert import bulk_defaults_for_input_format
|
||||||
|
|
||||||
def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{
|
def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{
|
||||||
out_format=None, show_no_format_warning=True):
|
out_format=None, show_no_format_warning=True):
|
||||||
changed = False
|
changed = False
|
||||||
jobs = []
|
jobs = []
|
||||||
@ -47,7 +47,7 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{
|
|||||||
result = d.exec_()
|
result = d.exec_()
|
||||||
|
|
||||||
if result == QDialog.Accepted:
|
if result == QDialog.Accepted:
|
||||||
#if not convert_existing(parent, db, [book_id], d.output_format):
|
# if not convert_existing(parent, db, [book_id], d.output_format):
|
||||||
# continue
|
# continue
|
||||||
|
|
||||||
mi = db.get_metadata(book_id, True)
|
mi = db.get_metadata(book_id, True)
|
||||||
@ -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'
|
||||||
@ -254,7 +253,7 @@ class QueueBulk(QProgressDialog):
|
|||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def fetch_scheduled_recipe(arg): # {{{
|
def fetch_scheduled_recipe(arg): # {{{
|
||||||
fmt = prefs['output_format'].lower()
|
fmt = prefs['output_format'].lower()
|
||||||
# Never use AZW3 for periodicals...
|
# Never use AZW3 for periodicals...
|
||||||
if fmt == 'azw3':
|
if fmt == 'azw3':
|
||||||
@ -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,18 +286,24 @@ 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]
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def generate_catalog(parent, dbspec, ids, device_manager, db): # {{{
|
def generate_catalog(parent, dbspec, ids, device_manager, db): # {{{
|
||||||
from calibre.gui2.dialogs.catalog import Catalog
|
from calibre.gui2.dialogs.catalog import Catalog
|
||||||
|
|
||||||
# Build the Catalog dialog in gui2.dialogs.catalog
|
# Build the Catalog dialog in gui2.dialogs.catalog
|
||||||
@ -354,7 +363,7 @@ def generate_catalog(parent, dbspec, ids, device_manager, db): # {{{
|
|||||||
d.catalog_title
|
d.catalog_title
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def convert_existing(parent, db, book_ids, output_format): # {{{
|
def convert_existing(parent, db, book_ids, output_format): # {{{
|
||||||
already_converted_ids = []
|
already_converted_ids = []
|
||||||
already_converted_titles = []
|
already_converted_titles = []
|
||||||
for book_id in book_ids:
|
for book_id in book_ids:
|
||||||
@ -372,3 +381,4 @@ def convert_existing(parent, db, book_ids, output_format): # {{{
|
|||||||
return book_ids
|
return book_ids
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user