mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Slow an initial load spinner while book is being rendered
This commit is contained in:
parent
67fcb5345d
commit
55fbc89eb6
@ -74,6 +74,7 @@ class EbookViewer(MainWindow):
|
||||
|
||||
def load_ebook(self, pathtoebook, open_at=None):
|
||||
# TODO: Implement open_at
|
||||
self.web_view.show_preparing_message()
|
||||
if self.save_annotations_debounce_timer.isActive():
|
||||
self.save_annotations()
|
||||
self.current_book_data = {}
|
||||
|
@ -169,6 +169,7 @@ class ViewerBridge(Bridge):
|
||||
set_session_data = from_js(object, object)
|
||||
|
||||
create_view = to_js()
|
||||
show_preparing_message = to_js()
|
||||
start_book_load = to_js()
|
||||
|
||||
|
||||
@ -315,10 +316,17 @@ class WebView(RestartingWebEngineView):
|
||||
|
||||
def start_book_load(self, initial_cfi=None):
|
||||
key = (set_book_path.path,)
|
||||
self.execute_when_ready('start_book_load', key, initial_cfi)
|
||||
|
||||
def execute_when_ready(self, action, *args):
|
||||
if self.bridge.ready:
|
||||
self.bridge.start_book_load(key, initial_cfi)
|
||||
getattr(self.bridge, action)(*args)
|
||||
else:
|
||||
self.pending_bridge_ready_actions['start_book_load'] = key, initial_cfi
|
||||
self.pending_bridge_ready_actions[action] = args
|
||||
|
||||
def show_preparing_message(self):
|
||||
msg = _('Preparing book for reading, please wait…')
|
||||
self.execute_when_ready('show_preparing_message', msg)
|
||||
|
||||
def set_session_data(self, key, val):
|
||||
if key == '*' and val is None:
|
||||
|
@ -180,6 +180,12 @@ def create_view(prefs):
|
||||
create_session_data(prefs)
|
||||
view = View(document.getElementById('view'))
|
||||
|
||||
|
||||
@from_python
|
||||
def show_preparing_message(msg):
|
||||
view.show_loading_message(msg)
|
||||
|
||||
|
||||
@from_python
|
||||
def start_book_load(key, initial_cfi):
|
||||
xhr = ajax('manifest', manifest_received.bind(None, key, initial_cfi), ok_code=0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user