mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Line up the checkboxes
This commit is contained in:
parent
c7de5cb504
commit
bba033c4f9
@ -48,28 +48,21 @@ def sanitize_accelerator(text):
|
|||||||
return text.replace('&', '')
|
return text.replace('&', '')
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def create_simple_widget(name, text, tooltip, input_widget_, getter, setter, reverse=False, suffix=None): # {{{
|
def create_simple_widget(name, text, tooltip, input_widget_, getter, setter, suffix): # {{{
|
||||||
if get_option_default_value(name) is undefined:
|
if get_option_default_value(name) is undefined:
|
||||||
raise KeyError(f'{name} is not a known option')
|
raise KeyError(f'{name} is not a known option')
|
||||||
if not reverse and not text.endswith(':'):
|
if not text.endswith(':'):
|
||||||
text = text + ':'
|
text = text + ':'
|
||||||
if reverse:
|
label = E.label(E.span(sanitize_accelerator(text)), E.span(input_widget_))
|
||||||
label = E.label(input_widget_, E.span(sanitize_accelerator(text)))
|
if suffix:
|
||||||
else:
|
label.lastChild.appendChild(document.createTextNode('\xa0' + suffix))
|
||||||
if suffix:
|
|
||||||
label = E.label(E.span(sanitize_accelerator(text)), E.span(input_widget_, '\xa0' + suffix))
|
|
||||||
else:
|
|
||||||
label = E.label(E.span(sanitize_accelerator(text)), E.span(input_widget_))
|
|
||||||
label.dataset.optionName = name
|
label.dataset.optionName = name
|
||||||
label.setAttribute('title', tooltip or get_option_help(name))
|
label.setAttribute('title', tooltip or get_option_help(name))
|
||||||
|
|
||||||
def straight_input_widget(container):
|
def straight_input_widget(container):
|
||||||
return container.lastChild.firstChild
|
return container.lastChild.firstChild
|
||||||
|
|
||||||
def reverse_input_widget(container):
|
input_widget = straight_input_widget
|
||||||
return container.firstChild
|
|
||||||
|
|
||||||
input_widget = reverse_input_widget if reverse else straight_input_widget
|
|
||||||
input_widget(label).addEventListener('change', on_change.bind(None, name))
|
input_widget(label).addEventListener('change', on_change.bind(None, name))
|
||||||
|
|
||||||
ops = {
|
ops = {
|
||||||
@ -103,7 +96,6 @@ def checkbox(name, text, tooltip): # {{{
|
|||||||
def setter(w, val): # noqa: unused-local
|
def setter(w, val): # noqa: unused-local
|
||||||
w.checked = bool(val)
|
w.checked = bool(val)
|
||||||
,
|
,
|
||||||
True
|
|
||||||
)
|
)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
@ -183,17 +175,17 @@ def look_and_feel(container):
|
|||||||
for dname in 'font_size_mapping', 'base_font_size':
|
for dname in 'font_size_mapping', 'base_font_size':
|
||||||
set_disabled(dname, disabled)
|
set_disabled(dname, disabled)
|
||||||
)
|
)
|
||||||
container.appendChild(checkbox('disable_font_rescaling', _('&Disable font size rescaling')))
|
|
||||||
g = E.div(class_='simple-group')
|
g = E.div(class_='simple-group')
|
||||||
container.appendChild(g)
|
container.appendChild(g)
|
||||||
|
g.appendChild(checkbox('disable_font_rescaling', _('&Disable font size rescaling')))
|
||||||
g.appendChild(float_spin('base_font_size', _('Base font si&ze:'), max=50, unit='pt'))
|
g.appendChild(float_spin('base_font_size', _('Base font si&ze:'), max=50, unit='pt'))
|
||||||
g.appendChild(lineedit('font_size_mapping', _('Font size &key:')))
|
g.appendChild(lineedit('font_size_mapping', _('Font size &key:')))
|
||||||
g.appendChild(float_spin('minimum_line_height', _('Minim&um line height:'), max=900, unit='%'))
|
g.appendChild(float_spin('minimum_line_height', _('Minim&um line height:'), max=900, unit='%'))
|
||||||
g.appendChild(float_spin('line_height', _('Line hei&ght:'), unit='%'))
|
g.appendChild(float_spin('line_height', _('Line hei&ght:'), unit='%'))
|
||||||
g.appendChild(lineedit('embed_font_family', _('Embed font fami&ly:')))
|
g.appendChild(lineedit('embed_font_family', _('Embed font fami&ly:')))
|
||||||
container.appendChild(checkbox('embed_all_fonts', _('&Embed all fonts in document')))
|
g.appendChild(checkbox('embed_all_fonts', _('&Embed all fonts in document')))
|
||||||
container.appendChild(checkbox('subset_embedded_fonts', _('&Subset all embedded fonts')))
|
g.appendChild(checkbox('subset_embedded_fonts', _('&Subset all embedded fonts')))
|
||||||
container.appendChild(checkbox('keep_ligatures', _('Keep &ligatures')))
|
g.appendChild(checkbox('keep_ligatures', _('Keep &ligatures')))
|
||||||
|
|
||||||
subhead(_('Te&xt'))
|
subhead(_('Te&xt'))
|
||||||
g = E.div(class_='simple-group')
|
g = E.div(class_='simple-group')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user