From 639a0bcd2443d4db3f06b09ad00e223d1e2bf86e Mon Sep 17 00:00:00 2001 From: j Date: Thu, 21 Jan 2016 14:23:35 +0530 Subject: [PATCH] set status earlier --- Open Media Library/Resources/install.py | 7 ++++--- Open Media Library/Resources/js/install.js | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Open Media Library/Resources/install.py b/Open Media Library/Resources/install.py index 02122d1..1d5b7cc 100755 --- a/Open Media Library/Resources/install.py +++ b/Open Media Library/Resources/install.py @@ -59,7 +59,9 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler): class Install(Thread): release_url = "http://downloads.openmedialibrary.com/release.json" - status = {} + status = { + 'step': 'Downloading...' + } def __init__(self, target, httpd): target = os.path.normpath(os.path.join(os.path.abspath(target))) @@ -73,9 +75,9 @@ class Install(Thread): target = self.target makedirs(target) os.chdir(target) + self.status["step"] = 'Downloading...' release = self.get_release() self.status["release"] = release - self.status["step"] = 'Downloading...' self.status["progress"] = 0 for module in sorted(release['modules']): package_tar = release['modules'][module]['name'] @@ -110,7 +112,6 @@ class Install(Thread): while data: if size: available += len(data) - self.status["progress"] = available/size f.write(data) data = u.read(4096) diff --git a/Open Media Library/Resources/js/install.js b/Open Media Library/Resources/js/install.js index 08d6a50..1a5f7e6 100644 --- a/Open Media Library/Resources/js/install.js +++ b/Open Media Library/Resources/js/install.js @@ -24,6 +24,7 @@ update.status.style.fontFamily = 'Lucida Grande, Segoe UI, DejaVu Sans, Lucida Sans Unicode, Helvetica, Arial, sans-serif'; update.status.style.fontSize = '11px'; document.querySelector('#loadingScreen').appendChild(update.status); + update.status.innerHTML = ''; updateStatus(); } @@ -135,7 +136,7 @@ }; xhr.onerror = function() { var status = update.status.innerHTML; - if (['Relaunching...'].indexOf(status) == -1) { + if (['Relaunching...', ''].indexOf(status) == -1) { update.status.innerHTML = 'Installation failed'; } load();