Add structure detection UI

This commit is contained in:
Kovid Goyal 2018-07-03 10:39:22 +05:30
parent f97c9982d2
commit 850640fa0e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -108,8 +108,8 @@ def checkbox(name, text, tooltip): # {{{
)
# }}}
def lineedit(name, text, width, tooltip): # {{{
return create_simple_widget(name, text, tooltip, E.input(type='text', size=str(width or 25)),
def lineedit(name, text, width=25, tooltip=None, suffix=None): # {{{
return create_simple_widget(name, text, tooltip, E.input(type='text', size=str(width)),
def getter(w): # noqa: unused-local
ans = w.value
if ans and ans.strip():
@ -117,6 +117,7 @@ def lineedit(name, text, width, tooltip): # {{{
,
def setter(w, val): # noqa: unused-local
w.value = val or ''
, suffix=suffix
)
# }}}
@ -308,14 +309,13 @@ def page_setup(container):
def structure_detection(container):
g = E.div(class_='simple-group')
container.appendChild(g)
g.appendChild(float_spin('margin_left', _('Left page margin'), unit='pt', step=0.1, min=-1, max=200))
g.appendChild(float_spin('margin_top', _('Top page margin'), unit='pt', step=0.1, min=-1, max=200))
g.appendChild(float_spin('margin_right', _('Right page margin'), unit='pt', step=0.1, min=-1, max=200))
g.appendChild(float_spin('margin_bottom', _('Bottom page margin'), unit='pt', step=0.1, min=-1, max=200))
g.appendChild(choices('input_profile', _('&Input profile:'), {name: profiles.input[name].name for name in profiles.input}))
g.appendChild(E.div(data_profile='input'))
g.appendChild(choices('output_profile', _('&Output profile:'), {name: profiles.output[name].name for name in profiles.output}))
g.appendChild(E.div(data_profile='output'))
g.appendChild(lineedit('chapter', _('Detect chapters at'), 50))
g.appendChild(choices('chapter_mark', _('Chap&ter mark:'), ['pagebreak', 'rule', 'both', 'none']))
g.appendChild(checkbox('remove_first_image', _('Remove first &image')))
g.appendChild(checkbox('remove_fake_margins', _('Remove &fake margins')))
g.appendChild(checkbox('insert_metadata', _('Insert metadata at start of book')))
g.appendChild(lineedit('page_breaks_before', _('Insert page breaks before'), 50))
g.appendChild(lineedit('start_reading_at', _('Start reading at'), 50))
# }}}
def create_option_group(group_name, profiles_, container, get_option_value_, get_option_default_value_, is_option_disabled_, get_option_help_, on_close):