ensure progress window cleared if error on add-on import

This commit is contained in:
Damien Elmes 2019-02-27 14:08:20 +10:00
parent 444abfff94
commit 66cbc87580

View File

@ -240,21 +240,23 @@ Are you sure you want to continue?"""
log = [] log = []
errs = [] errs = []
self.mw.progress.start(immediate=True) self.mw.progress.start(immediate=True)
for path in paths: try:
base = os.path.basename(path) for path in paths:
ret = self.install(path) base = os.path.basename(path)
if ret[0] is False: ret = self.install(path)
if ret[1] == "conflicts": if ret[0] is False:
continue if ret[1] == "conflicts":
elif ret[1] == "zip": continue
msg = _("Corrupt add-on file.") elif ret[1] == "zip":
elif ret[1] == "manifest": msg = _("Corrupt add-on file.")
msg = _("Invalid add-on manifest.") elif ret[1] == "manifest":
errs.append(_("Error installing <i>%(base)s</i>: %(error)s" msg = _("Invalid add-on manifest.")
% dict(base=base, error=msg))) errs.append(_("Error installing <i>%(base)s</i>: %(error)s"
else: % dict(base=base, error=msg)))
log.append(_("Installed %(name)s" % dict(name=ret[1]))) else:
self.mw.progress.finish() log.append(_("Installed %(name)s" % dict(name=ret[1])))
finally:
self.mw.progress.finish()
return log, errs return log, errs
# Downloading # Downloading