From 66cbc875801e67927d5f6e6f065ca841efe3f3f7 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 27 Feb 2019 14:08:20 +1000 Subject: [PATCH] ensure progress window cleared if error on add-on import --- aqt/addons.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/aqt/addons.py b/aqt/addons.py index 209b71105..78307b518 100644 --- a/aqt/addons.py +++ b/aqt/addons.py @@ -240,21 +240,23 @@ Are you sure you want to continue?""" log = [] errs = [] self.mw.progress.start(immediate=True) - for path in paths: - base = os.path.basename(path) - ret = self.install(path) - if ret[0] is False: - if ret[1] == "conflicts": - continue - elif ret[1] == "zip": - msg = _("Corrupt add-on file.") - elif ret[1] == "manifest": - msg = _("Invalid add-on manifest.") - errs.append(_("Error installing %(base)s: %(error)s" - % dict(base=base, error=msg))) - else: - log.append(_("Installed %(name)s" % dict(name=ret[1]))) - self.mw.progress.finish() + try: + for path in paths: + base = os.path.basename(path) + ret = self.install(path) + if ret[0] is False: + if ret[1] == "conflicts": + continue + elif ret[1] == "zip": + msg = _("Corrupt add-on file.") + elif ret[1] == "manifest": + msg = _("Invalid add-on manifest.") + errs.append(_("Error installing %(base)s: %(error)s" + % dict(base=base, error=msg))) + else: + log.append(_("Installed %(name)s" % dict(name=ret[1]))) + finally: + self.mw.progress.finish() return log, errs # Downloading