Start work on UI for font size

This commit is contained in:
Kovid Goyal 2016-09-26 18:13:37 +05:30
parent a09f70ea22
commit c2e11c6ce5
2 changed files with 27 additions and 1 deletions

View File

@ -10,6 +10,7 @@ from widgets import create_spinner, create_button
from gettext import gettext as _
from read_book.toc import create_toc_panel
from read_book.prefs.main import create_prefs_panel
from read_book.prefs.font_size import create_font_size_panel
class LoadingMessage: # {{{
@ -170,7 +171,7 @@ class MainOverlay:
),
E.ul(
ac(_('Font size'), _('Change text size'), None, 'Aa', True),
ac(_('Font size'), _('Change text size'), self.overlay.show_font_size_chooser, 'Aa', True),
ac(_('Preferences'), _('Configure the book reader'), self.overlay.show_prefs, 'cogs'),
),
class_=MAIN_OVERLAY_ACTIONS_CLASS
@ -252,6 +253,14 @@ class PrefsOverlay: # {{{
# }}}
class FontSizeOverlay:
def __init__(self, overlay):
self.overlay = overlay
def show(self, container):
create_font_size_panel(container)
class Overlay:
def __init__(self, view):
@ -328,3 +337,7 @@ class Overlay:
def show_prefs(self):
self.panels = [PrefsOverlay(self)]
self.show_current_panel()
def show_font_size_chooser(self):
self.panels = [FontSizeOverlay(self)]
self.show_current_panel()

View File

@ -0,0 +1,13 @@
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals, bound_methods
from elementmaker import E
def create_font_size_panel(container):
container.appendChild(E.div(
style='margin:15vh auto; max-width: 500px; border-radius: 8px; border: solid 1px currentColor',
onclick=def(ev): ev.preventDefault(), ev.stopPropagation
))
develop = create_font_size_panel