From cd5823a2140f8a8240ed014f72444dc267d03e12 Mon Sep 17 00:00:00 2001 From: Hiroki Fujii Date: Sat, 20 Jan 2024 18:58:12 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=83=83=E3=83=97=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addon/globalPlugins/dokutor_for_nvda/updater.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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):