Skip to content

Commit

Permalink
アップデータ修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroki Fujii committed Jan 20, 2024
1 parent 8bc762f commit cd5823a
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 cd5823a

Please sign in to comment.