mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Only show th eloading spinner is loading takes more than 200ms
This commit is contained in:
parent
8871de91f3
commit
1a442ec1d1
@ -138,6 +138,7 @@ class View:
|
|||||||
self.current_toc_node = self.current_toc_toplevel_node = None
|
self.current_toc_node = self.current_toc_toplevel_node = None
|
||||||
self.report_cfi_callbacks = {}
|
self.report_cfi_callbacks = {}
|
||||||
self.show_chrome_counter = 0
|
self.show_chrome_counter = 0
|
||||||
|
self.show_loading_callback_timer = None
|
||||||
self.clock_timer_id = 0
|
self.clock_timer_id = 0
|
||||||
sd = get_session_data()
|
sd = get_session_data()
|
||||||
self.keyboard_shortcut_map = create_shortcut_map(sd.get('keyboard_shortcuts'))
|
self.keyboard_shortcut_map = create_shortcut_map(sd.get('keyboard_shortcuts'))
|
||||||
@ -441,11 +442,13 @@ class View:
|
|||||||
self.overlay.show_loading_message(msg)
|
self.overlay.show_loading_message(msg)
|
||||||
|
|
||||||
def show_loading(self):
|
def show_loading(self):
|
||||||
title = self.book.metadata.title
|
msg = _('Loading next section from <i>{title}</i>, please wait…').format(title=self.book.metadata.title)
|
||||||
self.show_loading_message(_(
|
self.show_loading_callback_timer = setTimeout(self.show_loading_message.bind(None, msg), 200)
|
||||||
'Loading next section from <i>{title}</i>, please wait...').format(title=title))
|
|
||||||
|
|
||||||
def hide_loading(self):
|
def hide_loading(self):
|
||||||
|
if self.show_loading_callback_timer is not None:
|
||||||
|
clearTimeout(self.show_loading_callback_timer)
|
||||||
|
self.show_loading_callback_timer = None
|
||||||
self.overlay.hide_loading_message()
|
self.overlay.hide_loading_message()
|
||||||
|
|
||||||
def parse_cfi(self, encoded_cfi, book):
|
def parse_cfi(self, encoded_cfi, book):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user