Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

アップデータの24.1対応 #9

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading