diff --git a/addon/globalPlugins/dokutor_for_nvda/updater.py b/addon/globalPlugins/dokutor_for_nvda/updater.py index 0a2321b..29b284b 100644 --- a/addon/globalPlugins/dokutor_for_nvda/updater.py +++ b/addon/globalPlugins/dokutor_for_nvda/updater.py @@ -46,7 +46,12 @@ def __init__(self): if not updatable: log.warning("Update check not supported.") - def autoUpdateCheck(self, mode=0): + def autoUpdateCheck(self, mode=AUTO): + """ + Call this method to check for updates. mode=AUTO means automatic update check, and MANUAL means manual triggering like "check for updates" menu invocation. + When set to AUTO mode, some dialogs are not displayed (latest and error). + """ + if not updatable: return self.updater = NVDAAddOnUpdater(mode) @@ -212,7 +217,7 @@ def _download(self, url): def _downloadSuccess(self): self._stopped() from gui import addonGui - closeAfter = addonGui.AddonsDialog._instance is None or (versionInfo.version_year, versionInfo.version_major) >= (2019, 1) + addonGui.promptUserForRestart() try: try: bundle = addonHandler.AddonBundle(self.destPath.decode("mbcs")) @@ -236,8 +241,6 @@ def _downloadSuccess(self): gui.ExecAndPump(addonHandler.installAddonBundle, bundle) except BaseException: log.error("Error installing addon bundle from %s" % self.destPath, exc_info=True) - if not closeAfter: - addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList() progressDialog.done() del progressDialog gui.messageBox(_("アドオンのアップデートに失敗しました。"), @@ -245,14 +248,10 @@ def _downloadSuccess(self): wx.OK | wx.ICON_ERROR) return else: - if not closeAfter: - addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList(activeIndex=-1) progressDialog.done() del progressDialog finally: self.cleanup_tempfile() - if closeAfter: - wx.CallLater(1, addonGui.AddonsDialog(gui.mainFrame).Close) def cleanup_tempfile(self): if not os.path.isfile(self.destPath):