From fe0cfc3bea03f0f95448c229032f0631eb1cf18f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 9 Sep 2019 15:41:22 +0530 Subject: [PATCH] Use the book text colors for the loading screen Makes it less obtrusive --- src/pyj/read_book/overlay.pyj | 8 +++++--- src/pyj/read_book/view.pyj | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pyj/read_book/overlay.pyj b/src/pyj/read_book/overlay.pyj index d22798b89b..118dd1bd16 100644 --- a/src/pyj/read_book/overlay.pyj +++ b/src/pyj/read_book/overlay.pyj @@ -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() diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 61621c6cc1..413f2669b0 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -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 {name} from {title}, please wait...').format(name=name, title=title)) + 'Loading next section from {title}, please wait...').format(name=name, title=title)) def hide_loading(self): self.overlay.hide_loading_message()