set status earlier

This commit is contained in:
j 2016-01-21 14:23:35 +05:30
parent 8147230d42
commit 639a0bcd24
2 changed files with 6 additions and 4 deletions

View file

@ -59,7 +59,9 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
class Install(Thread): class Install(Thread):
release_url = "http://downloads.openmedialibrary.com/release.json" release_url = "http://downloads.openmedialibrary.com/release.json"
status = {} status = {
'step': 'Downloading...'
}
def __init__(self, target, httpd): def __init__(self, target, httpd):
target = os.path.normpath(os.path.join(os.path.abspath(target))) target = os.path.normpath(os.path.join(os.path.abspath(target)))
@ -73,9 +75,9 @@ class Install(Thread):
target = self.target target = self.target
makedirs(target) makedirs(target)
os.chdir(target) os.chdir(target)
self.status["step"] = 'Downloading...'
release = self.get_release() release = self.get_release()
self.status["release"] = release self.status["release"] = release
self.status["step"] = 'Downloading...'
self.status["progress"] = 0 self.status["progress"] = 0
for module in sorted(release['modules']): for module in sorted(release['modules']):
package_tar = release['modules'][module]['name'] package_tar = release['modules'][module]['name']
@ -110,7 +112,6 @@ class Install(Thread):
while data: while data:
if size: if size:
available += len(data) available += len(data)
self.status["progress"] = available/size
f.write(data) f.write(data)
data = u.read(4096) data = u.read(4096)

View file

@ -24,6 +24,7 @@
update.status.style.fontFamily = 'Lucida Grande, Segoe UI, DejaVu Sans, Lucida Sans Unicode, Helvetica, Arial, sans-serif'; update.status.style.fontFamily = 'Lucida Grande, Segoe UI, DejaVu Sans, Lucida Sans Unicode, Helvetica, Arial, sans-serif';
update.status.style.fontSize = '11px'; update.status.style.fontSize = '11px';
document.querySelector('#loadingScreen').appendChild(update.status); document.querySelector('#loadingScreen').appendChild(update.status);
update.status.innerHTML = '';
updateStatus(); updateStatus();
} }
@ -135,7 +136,7 @@
}; };
xhr.onerror = function() { xhr.onerror = function() {
var status = update.status.innerHTML; var status = update.status.innerHTML;
if (['Relaunching...'].indexOf(status) == -1) { if (['Relaunching...', ''].indexOf(status) == -1) {
update.status.innerHTML = 'Installation failed'; update.status.innerHTML = 'Installation failed';
} }
load(); load();