From c8891928cb021eab74b4796f6f9a673eed7d4002 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 2 May 2016 20:39:24 +0530 Subject: [PATCH] Better progress messages --- src/pyj/read_book/resources.pyj | 3 +-- src/pyj/read_book/ui.pyj | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pyj/read_book/resources.pyj b/src/pyj/read_book/resources.pyj index c60a20e05e..d1266615a6 100644 --- a/src/pyj/read_book/resources.pyj +++ b/src/pyj/read_book/resources.pyj @@ -28,8 +28,7 @@ def load_resources(db, book, root_name, previous_resources, proceed): v'delete previous_resources[k]' if book.manifest.files[root_name].has_maths: return load_mathjax(db, book, ans, proceed) - proceed(ans) - return + return proceed(ans) name = pending_resources.shift() if ans[name]: return setTimeout(do_one, 0) diff --git a/src/pyj/read_book/ui.pyj b/src/pyj/read_book/ui.pyj index b21b26f12a..e7c992d290 100644 --- a/src/pyj/read_book/ui.pyj +++ b/src/pyj/read_book/ui.pyj @@ -199,7 +199,11 @@ class ReadUI: for name in progress_track: x += progress_track[name] pbar.setAttribute('value', x + '') - progress.lastChild.textContent = _('Downloaded {0}, {1} left').format(human_readable(x), human_readable(total - x)) + if x is total: + msg = _('Downloaded {}, saving to disk, this may take a few seconds...').format(human_readable(total)) + else: + msg = _('Downloaded {0}, {1} left').format(human_readable(x), human_readable(total - x)) + progress.lastChild.textContent = msg def show_failure(): det = ['

{}

{}

'.format(fname, err_html) for fname, err_html in failed_files].join('') @@ -312,7 +316,11 @@ class ReadUI: for name in progress_track: x += progress_track[name] pbar.setAttribute('value', x + '') - progress.lastChild.textContent = _('Downloaded {0}, {1} left').format(human_readable(x), human_readable(total - x)) + if x is total: + msg = _('Downloaded {}, saving to disk, this may take a few seconds...').format(human_readable(total)) + else: + msg = _('Downloaded {0}, {1} left').format(human_readable(x), human_readable(total - x)) + progress.lastChild.textContent = msg def on_progress(loaded, ftotal): progress_track[this] = loaded