UI for EPUB output options

This commit is contained in:
Kovid Goyal 2018-07-04 14:00:44 +05:30
parent feb784272a
commit a0ac5119ba
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 19 additions and 1 deletions

View File

@ -49,6 +49,7 @@ class EPUBOutput(OutputFormatPlugin):
author = 'Kovid Goyal'
file_type = 'epub'
commit_name = 'epub_output'
ui_data = {'versions': ('2', '3')}
options = set([
OptionRecommendation(name='extract_to',
@ -118,7 +119,7 @@ class EPUBOutput(OutputFormatPlugin):
help=_('Title for any generated in-line table of contents.')
),
OptionRecommendation(name='epub_version', recommended_value='2', choices=('2', '3'),
OptionRecommendation(name='epub_version', recommended_value='2', choices=ui_data['versions'],
help=_('The version of the EPUB file to generate. EPUB 2 is the'
' most widely compatible, only use EPUB 3 if you know you'
' actually need it.')

View File

@ -526,6 +526,23 @@ def txt_input(container):
))
# }}}
# EPUB Output {{{
@ep
def epub_output(container):
g = E.div(class_='simple-group')
container.appendChild(g)
g.appendChild(checkbox('dont_split_on_page_breaks', _('Do not &split on page breaks')))
g.appendChild(checkbox('no_default_epub_cover', _('No default &cover')))
g.appendChild(checkbox('epub_flatten', _('&Flatten EPUB file structure')))
g.appendChild(checkbox('no_svg_cover', _('No &SVG cover')))
g.appendChild(checkbox('preserve_cover_aspect_ratio', _('Preserve cover &aspect ratio')))
g.appendChild(checkbox('epub_inline_toc', _('Insert inline &Table of Contents')))
g.appendChild(checkbox('epub_toc_at_end', _('Put inserted Table of Contents at the &end of the book')))
g.appendChild(lineedit('toc_title', _('&Title for inserted ToC:')))
g.appendChild(int_spin('flow_size', _('Split files &larger than:'), unit='KB', max=1000000, step=20))
g.appendChild(choices('epub_version', _('EP&UB version:'), ui_data.versions))
# }}}
def restore_defaults():
for setting in registry:
set(setting, get_option_default_value(setting))