Use the book text colors for the loading screen

Makes it less obtrusive
This commit is contained in:
Kovid Goyal 2019-09-09 15:41:22 +05:30
parent 7198248ce9
commit fe0cfc3bea
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 4 deletions

View File

@ -25,12 +25,14 @@ from widgets import create_button, create_spinner
class LoadingMessage: # {{{
def __init__(self, msg):
def __init__(self, msg, current_color_scheme):
self.msg = msg or ''
self.current_color_scheme = current_color_scheme
def show(self, container):
self.container_id = container.getAttribute('id')
container.style.backgroundColor = get_color('window-background')
container.style.backgroundColor = self.current_color_scheme.background
container.style.color = self.current_color_scheme.foreground
container.appendChild(
E.div(
style='text-align:center',
@ -500,7 +502,7 @@ class Overlay:
self.hide_current_panel()
def show_loading_message(self, msg):
lm = LoadingMessage(msg)
lm = LoadingMessage(msg, self.view.current_color_scheme)
self.panels.push(lm)
self.show_current_panel()

View File

@ -191,6 +191,7 @@ class View:
entry_point = None if runtime.is_standalone_viewer else 'read_book.iframe'
if runtime.is_standalone_viewer:
document.documentElement.addEventListener('keydown', self.handle_keypress, {'passive': False})
self.current_color_scheme = resolve_color_scheme()
self.iframe_wrapper = IframeWrapper(handlers, document.getElementById(iframe_id), entry_point, _('Bootstrapping book reader...'), runtime.FAKE_PROTOCOL, runtime.FAKE_HOST)
self.search_overlay = SearchOverlay(self)
self.content_popup_overlay = ContentPopupOverlay(self)
@ -418,6 +419,7 @@ class View:
def get_color_scheme(self, apply_to_margins):
ans = resolve_color_scheme()
self.current_color_scheme = ans
if apply_to_margins:
for which in 'left top right bottom'.split(' '):
m = document.getElementById('book-{}-margin'.format(which))
@ -442,7 +444,7 @@ class View:
title = self.book.metadata.title
name = self.currently_showing.name
self.show_loading_message(_(
'Loading <i>{name}</i> from <i>{title}</i>, please wait...').format(name=name, title=title))
'Loading next section from <i>{title}</i>, please wait...').format(name=name, title=title))
def hide_loading(self):
self.overlay.hide_loading_message()