Skip to content

Commit a8bb25c

Browse files
committed
Merge branch 'master' into release
2 parents 19059e3 + 4f6dcf9 commit a8bb25c

8 files changed

Lines changed: 100 additions & 53 deletions

File tree

addon/globalPlugins/dokutor_for_nvda/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .constants import *
1919
from . import updater
2020
from . import converter
21+
from .compat import messageBox
2122

2223

2324
try:
@@ -116,14 +117,14 @@ def toggleEnableOnStartup(self, evt):
116117
self.setEnableOnStartupSetting(changed)
117118
msg = _("NVDA起動時に、自動で理療科用読み辞書を適用します。") if changed is True else _("NVDA起動時は、通常の読み辞書を利用します。")
118119
self.enableOnStartupToggleItem.SetItemLabel(self.enableOnStartupToggleString())
119-
wx.MessageBox(msg, _("設定変更完了"))
120+
messageBox(msg, _("設定変更完了"))
120121

121122
def toggleUpdateCheck(self, evt):
122123
changed = not self.getUpdateCheckSetting()
123124
self.setUpdateCheckSetting(changed)
124125
msg = _("NVDA起動時に、自動でDFNのアップデートを確認します。") if changed is True else _("NVDA起動時に、DFNのアップデートを確認しません。")
125126
self.updateCheckToggleItem.SetItemLabel(self.updateCheckToggleString())
126-
wx.MessageBox(msg, _("設定変更完了"))
127+
messageBox(msg, _("設定変更完了"))
127128

128129
def performUpdateCheck(self, evt):
129130
updater.AutoUpdateChecker().autoUpdateCheck(mode=updater.MANUAL)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import wx
2+
import gui
3+
import versionInfo
4+
5+
def isCompatibleWith2025():
6+
return versionInfo.version_year >= 2025
7+
8+
def messageBox(message, title):
9+
if isCompatibleWith2025():
10+
gui.message.MessageDialog.alert(message, title)
11+
else:
12+
gui.messageBox(message, title, style=wx.CENTER)
13+
14+
15+
def yesno(message, title):
16+
if isCompatibleWith2025():
17+
dlg = gui.message.MessageDialog(None, message, title, buttons=gui.message.DefaultButtonSet.YES_NO)
18+
return dlg.ShowModal() == gui.message.ReturnCode.YES
19+
else:
20+
return gui.messageBox(message, title, style=wx.CENTER | wx.YES | wx.NO | wx.ICON_INFORMATION) == wx.YES
21+

addon/globalPlugins/dokutor_for_nvda/updater.py

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# coding: UTF-8
2-
31
from __future__ import unicode_literals
42
import addonHandler
53
import globalVars
@@ -19,12 +17,7 @@
1917
from urllib.parse import urlencode
2018
from .constants import *
2119
from .translate import *
22-
23-
try:
24-
import addonHandler
25-
addonHandler.initTranslation()
26-
except BaseException:
27-
def _(x): return x
20+
from . import updaterStrings as strs
2821

2922
try:
3023
import updateCheck
@@ -40,6 +33,22 @@ def _(x): return x
4033
AUTO=0
4134
MANUAL=1
4235

36+
def isCompatibleWith2025():
37+
return versionInfo.version_year >= 2025
38+
39+
def messageBox(message, title):
40+
if isCompatibleWith2025():
41+
gui.message.MessageDialog.alert(message, title)
42+
else:
43+
gui.messageBox(message, title, style=wx.CENTER)
44+
45+
def confirm(message, title):
46+
if isCompatibleWith2025():
47+
return gui.message.MessageDialog.confirm(message, title) == gui.message.ReturnCode.OK
48+
else:
49+
return gui.messageBox(message, title, style=wx.CENTER | wx.OK | wx.CANCEL | wx.ICON_INFORMATION) == wx.OK
50+
51+
4352
class AutoUpdateChecker:
4453
def __init__(self):
4554
self.updater = None
@@ -51,7 +60,6 @@ def autoUpdateCheck(self, mode=AUTO):
5160
Call this method to check for updates. mode=AUTO means automatic update check, and MANUAL means manual triggering like "check for updates" menu invocation.
5261
When set to AUTO mode, some dialogs are not displayed (latest and error).
5362
"""
54-
5563
if not updatable:
5664
return
5765
self.updater = NVDAAddOnUpdater(mode)
@@ -66,6 +74,7 @@ def __init__(self, mode, version=addonVersion):
6674
t.start()
6775

6876
def check_update(self):
77+
"""Called as the thread entry point."""
6978
post_params = {
7079
"name": addonKeyword,
7180
"version": addonVersion,
@@ -76,13 +85,12 @@ def check_update(self):
7685
f = urlopen(req)
7786
except BaseException:
7887
if self.mode == MANUAL:
79-
gui.messageBox(_("アップデートサーバに接続できません。\nインターネット接続を確認してください。"),
80-
_("エラー"), style=wx.CENTER | wx.ICON_WARNING)
88+
messageBox(strs.ERROR_UNABLE_TO_CONNECT, strs.ERROR)
8189
return False
8290

8391
if f.getcode() != 200:
8492
if self.mode == MANUAL:
85-
gui.messageBox(_("アップデートサーバに接続できません。"), _("エラー"), style=wx.CENTER | wx.ICON_WARNING)
93+
messageBox(strs.ERROR_UNABLE_TO_CONNECT_SERVERSIDE, strs.ERROR)
8694
return False
8795

8896
try:
@@ -91,31 +99,25 @@ def check_update(self):
9199
update_dict = json.loads(update_dict)
92100
except BaseException:
93101
if self.mode == MANUAL:
94-
gui.messageBox(
95-
_("不正なデータが送信されました。\nこの問題が継続する場合、ACT Laboratoryにお問い合わせください。"),
96-
_("エラー"),
97-
style=wx.CENTER | wx.ICON_WARNING)
102+
messageBox(strs.ERROR_UPDATE_INFO_INVALID, strs.ERROR)
98103
return False
99104

100105
code = update_dict["code"]
101106
if code == UPDATER_LATEST:
102107
if self.mode == MANUAL:
103-
gui.messageBox(_("お使いのアドオンは最新です。"), _("アップデート確認"), style=wx.CENTER | wx.ICON_INFORMATION)
108+
messageBox(strs.NO_UPDATES, strs.UPDATE_CHECK_TITLE)
104109
return False
105110
elif code == UPDATER_BAD_PARAM:
106111
if self.mode == MANUAL:
107-
gui.messageBox(_("不正なデータが送信されました。\nこの問題が継続する場合、ACT Laboratoryにお問い合わせください。"),
108-
_("アップデート確認"), style=wx.CENTER | wx.ICON_INFORMATION)
112+
messageBox(strs.ERROR_REQUEST_PARAMETERS_INVALID, strs.UPDATE_CHECK_TITLE)
109113
return False
110114
elif code == UPDATER_NOT_FOUND:
111115
if self.mode == MANUAL:
112-
gui.messageBox(_("このアドオンのアップデータは登録されていません。\nこの問題が継続する場合、ACT Laboratoryまでお問い合わせください。"),
113-
_("アップデート確認"), style=wx.CENTER | wx.ICON_INFORMATION)
116+
messageBox(strs.UPDATER_NOT_REGISTERED, strs.UPDATE_CHECK_TITLE)
114117
return False
115118
elif code == UPDATER_VISIT_SITE:
116119
if self.mode == MANUAL:
117-
gui.messageBox(_("アップデートが見つかりましたが、このままアップデートを継続することができません。\nアドオンのウェブサイトを確認してください。"),
118-
_("アップデート確認"), style=wx.CENTER | wx.ICON_INFORMATION)
120+
messageBox(strs.UPDATE_NOT_POSSIBLE, strs.UPDATE_CHECK_TITLE)
119121
return False
120122

121123
new_version = update_dict["update_version"]
@@ -126,11 +128,11 @@ def check_update(self):
126128
hash = update_dict["updater_hash"]
127129
# end set hash
128130

129-
caption = _("アップデート確認")
130-
question = _("{summary} Ver.{newVersion}が利用できます。\nアップデートしますか?\n現在のバージョン: {currentVersion}\n最新バージョン: {newVersion}").format(
131+
caption = strs.UPDATE_CONFIRMATION_TITLE
132+
question = strs.UPDATE_CONFIRMATION_MESSAGE.format(
131133
summary=addonSummary, newVersion=new_version, currentVersion=addonVersion)
132-
answer = gui.messageBox(question, caption, style=wx.CENTER | wx.OK | wx.CANCEL | wx.CANCEL_DEFAULT | wx.ICON_INFORMATION)
133-
if answer == wx.OK:
134+
answer = confirm(question, caption)
135+
if answer == True:
134136
downloader = UpdateDownloader(addonName, [url], hash)
135137
wx.CallAfter(downloader.start)
136138
return
@@ -153,8 +155,8 @@ def start(self):
153155
self._shouldCancel = False
154156
self._guiExecTimer = wx.PyTimer(self._guiExecNotify)
155157
gui.mainFrame.prePopup()
156-
self._progressDialog = wx.ProgressDialog(_("アップデートをダウンロード中"),
157-
_("接続中..."),
158+
self._progressDialog = wx.ProgressDialog(strs.DOWNLOADING,
159+
strs.CONNECTING,
158160
style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME | wx.PD_REMAINING_TIME | wx.PD_AUTO_HIDE,
159161
parent=gui.mainFrame)
160162
self._progressDialog.Raise()
@@ -165,10 +167,7 @@ def start(self):
165167
def _error(self):
166168
self._stopped()
167169
self.cleanup_tempfile()
168-
gui.messageBox(
169-
_("アップデートのダウンロードに失敗しました。"),
170-
_("エラー"),
171-
wx.OK | wx.ICON_ERROR)
170+
messageBox(strs.ERROR_DOWNLOADING, strs.ERROR)
172171

173172
def _download(self, url):
174173
headers = {}
@@ -216,42 +215,38 @@ def _download(self, url):
216215

217216
def _downloadSuccess(self):
218217
self._stopped()
219-
from gui import addonGui
220-
addonGui.promptUserForRestart()
221218
try:
222219
try:
223220
bundle = addonHandler.AddonBundle(self.destPath.decode("mbcs"))
224221
except AttributeError:
225222
bundle = addonHandler.AddonBundle(self.destPath)
226223
except BaseException:
227224
log.error("Error opening addon bundle from %s" % self.destPath, exc_info=True)
228-
gui.messageBox(translate("Failed to open add-on package file at %s - missing file or invalid file format") % self.destPath,
229-
translate("Error"),
230-
wx.OK | wx.ICON_ERROR)
225+
messageBox(strs.ERROR_OPENING % self.destPath, strs.ERROR)
231226
return
232227
bundleName = bundle.manifest['name']
233228
for addon in addonHandler.getAvailableAddons():
234229
if not addon.isPendingRemove and bundleName == addon.manifest['name']:
235230
addon.requestRemove()
236231
break
237232
progressDialog = gui.IndeterminateProgressDialog(gui.mainFrame,
238-
_("アップデートをダウンロード中"),
239-
_("アドオンがアップデートされるまでお待ちください。"))
233+
strs.UPDATING,
234+
strs.UPDATING_PLEASE_WAIT)
240235
try:
241236
gui.ExecAndPump(addonHandler.installAddonBundle, bundle)
242237
except BaseException:
243238
log.error("Error installing addon bundle from %s" % self.destPath, exc_info=True)
244239
progressDialog.done()
245240
del progressDialog
246-
gui.messageBox(_("アドオンのアップデートに失敗しました。"),
247-
_("エラー"),
248-
wx.OK | wx.ICON_ERROR)
241+
messageBox(strs.ERROR_FAILED_TO_UPDATE % self.destPath, strs.ERROR)
249242
return
250243
else:
251244
progressDialog.done()
252245
del progressDialog
253246
finally:
254247
self.cleanup_tempfile()
248+
from gui import addonGui
249+
addonGui.promptUserForRestart()
255250

256251
def cleanup_tempfile(self):
257252
if not os.path.isfile(self.destPath):
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
try:
2+
import addonHandler
3+
addonHandler.initTranslation()
4+
except BaseException:
5+
def _(x): return x
6+
7+
ERROR = _("エラー")
8+
ERROR_UNABLE_TO_CONNECT = _("アップデートサーバに接続できません。\nインターネット接続を確認してください。")
9+
ERROR_UNABLE_TO_CONNECT_SERVERSIDE = _("アップデートサーバに接続できません。")
10+
ERROR_UPDATE_INFO_INVALID = _("アップデート情報が誤っています。\n詳しくは、ACT Laboratory までお問い合わせください。")
11+
ERROR_REQUEST_PARAMETERS_INVALID = _("リクエストパラメータが誤っています。開発者にお問い合わせください。")
12+
ERROR_DOWNLOADING = _("アドオンのアップデートのダウンロード中にエラーが発生しました")
13+
ERROR_OPENING = _("アドオンパッケージファイル %s を開けませんでした。ファイルの形式が誤っているか、ファイルが壊れています。")
14+
ERROR_FAILED_TO_UPDATE = _("%sのアップデートに失敗しました。")
15+
NO_UPDATES = _("アップデートが見つかりませんでした。\nこのバージョンは、最新です。")
16+
UPDATER_NOT_REGISTERED = _("このアップデータは、登録されていません。開発者にお問い合わせください。")
17+
UPDATE_NOT_POSSIBLE = _("アップデートが見つかりましたが、このバージョンからのアップデートができません。ソフトウェアのWebサイトを確認してください。")
18+
UPDATE_CHECK_TITLE = _("アップデートの確認")
19+
UPDATE_CONFIRMATION_TITLE = _("アップデート確認")
20+
UPDATE_CONFIRMATION_MESSAGE = _("{summary} Ver.{newVersion} が利用可能です。\nアップデートしますか?\n現在のバージョン: {currentVersion}\n新しいバージョン: {newVersion}")
21+
DOWNLOADING = _("アドオンのアップデートをダウンロードしています")
22+
CONNECTING = _("接続中")
23+
UPDATING = _("アドオンをアップデートしています")
24+
UPDATING_PLEASE_WAIT = _("アドオンがアップデートされるまでお待ちください")

buildVars.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: UTF-8 -*-
22

3-
ADDON_VERSION = "1.1.4"
4-
ADDON_RELEASE_DATE = "2024-01-21"
3+
ADDON_VERSION = "1.1.5"
4+
ADDON_RELEASE_DATE = "2025-02-27"
55
ADDON_NAME = "dokutor_for_nvda"
66
ADDON_KEYWORD = "DFN"
77

@@ -41,7 +41,7 @@ def _(arg):
4141
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
4242
"addon_minimumNVDAVersion": 2019.3,
4343
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
44-
"addon_lastTestedNVDAVersion": 2024.5,
44+
"addon_lastTestedNVDAVersion": 2025.5,
4545
# Add-on update channel (default is None, denoting stable releases,
4646
# and for development releases, use "dev".)
4747
# Do not change unless you know what you are doing!

public/readme.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# 読ターFor NVDA Ver1.1.4 説明書
1+
# 読ターFor NVDA Ver1.1.5 説明書
22

3-
(更新: 2024-01-21)
3+
(更新: 2025-02-27)
44

55

66
## 目次
@@ -154,6 +154,9 @@ ACT Laboratory(Accessible Tools Laboratory)は、プログラミングを学ぶ
154154

155155
## 8. 更新履歴
156156

157+
* 1.1.5 (2025/02/27)
158+
* NVDA 2025.1に対応
159+
157160
* 1.1.4 (2024/01/21)
158161
* NVDA 2024.1に対応
159162

readme.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# 読ターFor NVDA Ver1.1.4 説明書
1+
# 読ターFor NVDA Ver1.1.5 説明書
22

3-
(更新: 2024-01-21)
3+
(更新: 2025-02-27)
44

55

66
## 目次
@@ -154,6 +154,9 @@ ACT Laboratory(Accessible Tools Laboratory)は、プログラミングを学ぶ
154154

155155
## 8. 更新履歴
156156

157+
* 1.1.5 (2025/02/27)
158+
* NVDA 2025.1に対応
159+
157160
* 1.1.4 (2024/01/21)
158161
* NVDA 2024.1に対応
159162

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version": "1.1.4", "release_date": "2024-01-21"}
1+
{"version": "1.1.5", "release_date": "2025-02-27"}

0 commit comments

Comments
 (0)