Skip to content

Commit

Permalink
Merge pull request #9 from actlaboratory/update_updater
Browse files Browse the repository at this point in the history
アップデータの24.1対応
  • Loading branch information
hrk-fujii authored Jan 20, 2024
2 parents 8bc762f + cd5823a commit 981bb55
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions addon/globalPlugins/dokutor_for_nvda/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"))
Expand All @@ -236,23 +241,17 @@ 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(_("アドオンのアップデートに失敗しました。"),
_("エラー"),
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):
Expand Down

0 comments on commit 981bb55

Please sign in to comment.