diff --git a/src/pyj/read_book/prefs/layout.pyj b/src/pyj/read_book/prefs/layout.pyj index 818bca0b3a..e30b7e99eb 100644 --- a/src/pyj/read_book/prefs/layout.pyj +++ b/src/pyj/read_book/prefs/layout.pyj @@ -10,6 +10,7 @@ from elementmaker import E CONTAINER = unique_id('reader-page-layout') MARGINS = unique_id('reader-page-margins') READ_MODE = unique_id('read-mode') +COLS = unique_id('cols-per-screen') add_extra_css(def(): sel = '#' + MARGINS @@ -22,7 +23,7 @@ def create_layout_panel(container): container.appendChild(E.div(id=CONTAINER)) container = container.lastChild sd = get_session_data() - container.appendChild(E.p(_('Change the page margins below'), style='margin:1ex 1rem; padding: 1ex 0')) + container.appendChild(E.p(_('Change the page margins (in pixels) below'), style='margin:1ex 1rem; padding: 1ex 0')) container.appendChild(E.table(id=MARGINS)) labels = {'top':_('Top:'), 'bottom':_('Bottom:'), 'left':_('Left:'), 'right':_('Right:')} for which in 'top bottom left right'.split(' '): @@ -43,6 +44,16 @@ def create_layout_panel(container): rb('paged', _('Paged mode')) rb('flow', _('Flow mode')) + container.appendChild(E.div( + _('In paged mode, control the number of pages per screen. A setting of zero means the number of pages is' + ' set based on the screen size.'), + style='margin: 1ex 1rem; padding-top:1ex; border-top: solid 1px')) + cps = sd.get('columns_per_screen') + container.appendChild(E.table(style='margin: 1ex 1rem', id=COLS, + E.tr(E.td(_('In portrait orientation:')), E.td(E.input(type='number', name='portrait', min='0', step='1', max='20', value=str(cps.portrait)))), + E.tr(E.td(_('In landscape orientation:')), E.td(E.input(type='number', name='landscape', min='0', step='1', max='20', value=str(cps.landscape)))), + )) + develop = create_layout_panel @@ -64,6 +75,17 @@ def commit_layout(onchange, container): if rm is not crm: was_changed = True sd.set('read_mode', crm) + cps = sd.get('columns_per_screen') + for which in ('portrait', 'landscape'): + inp = element(COLS, 'input[name={}]'.format(which)) + try: + val = int(inp.value) + except: + continue + if cps[which] is not val: + cps[which] = val + sd.set('columns_per_screen', cps) + was_changed = True if was_changed: onchange()