mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Use the book text colors for the loading screen
Makes it less obtrusive
This commit is contained in:
parent
7198248ce9
commit
fe0cfc3bea
@ -25,12 +25,14 @@ from widgets import create_button, create_spinner
|
|||||||
|
|
||||||
class LoadingMessage: # {{{
|
class LoadingMessage: # {{{
|
||||||
|
|
||||||
def __init__(self, msg):
|
def __init__(self, msg, current_color_scheme):
|
||||||
self.msg = msg or ''
|
self.msg = msg or ''
|
||||||
|
self.current_color_scheme = current_color_scheme
|
||||||
|
|
||||||
def show(self, container):
|
def show(self, container):
|
||||||
self.container_id = container.getAttribute('id')
|
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(
|
container.appendChild(
|
||||||
E.div(
|
E.div(
|
||||||
style='text-align:center',
|
style='text-align:center',
|
||||||
@ -500,7 +502,7 @@ class Overlay:
|
|||||||
self.hide_current_panel()
|
self.hide_current_panel()
|
||||||
|
|
||||||
def show_loading_message(self, msg):
|
def show_loading_message(self, msg):
|
||||||
lm = LoadingMessage(msg)
|
lm = LoadingMessage(msg, self.view.current_color_scheme)
|
||||||
self.panels.push(lm)
|
self.panels.push(lm)
|
||||||
self.show_current_panel()
|
self.show_current_panel()
|
||||||
|
|
||||||
|
@ -191,6 +191,7 @@ class View:
|
|||||||
entry_point = None if runtime.is_standalone_viewer else 'read_book.iframe'
|
entry_point = None if runtime.is_standalone_viewer else 'read_book.iframe'
|
||||||
if runtime.is_standalone_viewer:
|
if runtime.is_standalone_viewer:
|
||||||
document.documentElement.addEventListener('keydown', self.handle_keypress, {'passive': False})
|
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.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.search_overlay = SearchOverlay(self)
|
||||||
self.content_popup_overlay = ContentPopupOverlay(self)
|
self.content_popup_overlay = ContentPopupOverlay(self)
|
||||||
@ -418,6 +419,7 @@ class View:
|
|||||||
|
|
||||||
def get_color_scheme(self, apply_to_margins):
|
def get_color_scheme(self, apply_to_margins):
|
||||||
ans = resolve_color_scheme()
|
ans = resolve_color_scheme()
|
||||||
|
self.current_color_scheme = ans
|
||||||
if apply_to_margins:
|
if apply_to_margins:
|
||||||
for which in 'left top right bottom'.split(' '):
|
for which in 'left top right bottom'.split(' '):
|
||||||
m = document.getElementById('book-{}-margin'.format(which))
|
m = document.getElementById('book-{}-margin'.format(which))
|
||||||
@ -442,7 +444,7 @@ class View:
|
|||||||
title = self.book.metadata.title
|
title = self.book.metadata.title
|
||||||
name = self.currently_showing.name
|
name = self.currently_showing.name
|
||||||
self.show_loading_message(_(
|
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):
|
def hide_loading(self):
|
||||||
self.overlay.hide_loading_message()
|
self.overlay.hide_loading_message()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user