Skip to content

Commit 4026ed3

Browse files
Merge branch 'master' into release
2 parents e6fa5e4 + b44432f commit 4026ed3

File tree

13 files changed

+97
-164
lines changed

13 files changed

+97
-164
lines changed

.github/workflows/pullRequest.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
run: |
2525
python -m pip install -r requirements.txt
2626
27+
- name: download gettext tools
28+
run: python tools\download_gettext.py
29+
2730
- name: run scons
2831
run: scons
2932

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ addon/doc/en/
99
*.nvda-addon
1010
.sconsign.dblite
1111
public/readme.md
12+
.vscode/

addon/doc/ja/readme.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# English Reading Enhancer Ver1.1.1 説明書
1+
# English Reading Enhancer Ver1.1.2 説明書
22

3-
(更新: 2024-08-21)
3+
(更新: 2025-02-23)
44

55
[ソフトウェア詳細ページ](https://actlab.org/software/ERE)
66

@@ -145,6 +145,10 @@ Copyright (C) 2022 Kazto Kitabatake, ACT Laboratory All rights reserved.
145145
Copyright (c) 2022 AccessibleToolsLaboratory
146146

147147
## 更新履歴
148+
### 2025/02/23 Version 1.1.3
149+
150+
1. NVDA 2025.1のアップデートに対応しました。
151+
1. 読み上げ辞書を更新しました。
148152

149153
### 2024/08/21 Version 1.1.1
150154

addon/globalPlugins/ERE/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from logHandler import log
1515
from .constants import *
1616
from . import updater
17+
from . import compatibilityUtil
1718
from ._englishToKanaConverter.englishToKanaConverter import EnglishToKanaConverter
1819
from scriptHandler import script
1920

@@ -48,7 +49,7 @@ def __init__(self):
4849

4950
def _checkAutoLanguageSwitchingState(self):
5051
if self.getStateSetting() and config.conf["speech"]["autoLanguageSwitching"]:
51-
gui.messageBox(_("Automatic Language switching is enabled. English Reading Enhancer may not work correctly. To use this add-on, we recommend to disable this functionality."), _("Warning"))
52+
compatibilityUtil.messageBox(_("Automatic Language switching is enabled. English Reading Enhancer may not work correctly. To use this add-on, we recommend to disable this functionality."), _("Warning"))
5253

5354
def terminate(self):
5455
super(GlobalPlugin, self).terminate()
@@ -121,7 +122,7 @@ def toggleUpdateCheck(self, evt):
121122
self.setUpdateCheckSetting(changed)
122123
msg = _("Updates will be checked automatically when launching NVDA.") if changed is True else _("Updates will not be checked when launching NVDA.")
123124
self.updateCheckToggleItem.SetItemLabel(self.updateCheckToggleString())
124-
gui.messageBox(msg, _("Settings changed"))
125+
compatibilityUtil.messageBox(msg, _("Settings changed"))
125126

126127
def performUpdateCheck(self, evt):
127128
updater.AutoUpdateChecker().autoUpdateCheck(mode=updater.MANUAL)
@@ -137,7 +138,7 @@ def toggleState(self, evt):
137138
self.setStateSetting(changed)
138139
msg = _("English Reading Enhancer has been enabled.") if changed is True else _("English Reading Enhancer has been disabled.")
139140
self.stateToggleItem.SetItemLabel(self.stateToggleString())
140-
gui.messageBox(msg, _("Settings changed"))
141+
compatibilityUtil.messageBox(msg, _("Settings changed"))
141142
if changed:
142143
t = threading.Thread(target=self._checkAutoLanguageSwitchingState, daemon=True)
143144
t.start()
@@ -161,7 +162,7 @@ def reportMisreadings(self, evt):
161162
if gui.message.isModalMessageBoxActive():
162163
return
163164
if not config.conf["ERE_global"]["accessToken"]:
164-
gui.messageBox(_("Before using this feature, please set your GitHub Access Token."), _("Error"))
165+
compatibilityUtil.messageBox(_("Before using this feature, please set your GitHub Access Token."), _("Error"))
165166
return
166167
from .dialogs import reportMisreadingsDialog
167168
gui.mainFrame.prePopup()
@@ -183,7 +184,7 @@ def reportMisreadings(self, evt):
183184
)
184185
for label, field in z:
185186
if not field:
186-
gui.messageBox(_("%s is not entered.") % label, _("Error"), wx.ICON_ERROR)
187+
compatibilityUtil.messageBox(_("%s is not entered.") % label, _("Error"))
187188
return
188189
# end validation
189190
from .constants import addonVersion
@@ -216,9 +217,9 @@ def _sendMisreadings(self, eng, oldKana, newKana, comment, addonVersion):
216217
util = GhUtil(config.conf["ERE_global"]["accessToken"])
217218
result = util.createIssue(GH_REPO_OWNER, GH_REPO_NAME, title, body)
218219
if not result:
219-
gui.messageBox(_("Failed to send a report."), _("Error"), wx.ICON_ERROR)
220+
compatibilityUtil.messageBox(_("Failed to send a report."), _("Error"))
220221
return
221-
gui.messageBox(_("Report sent."), _("Success"))
222+
compatibilityUtil.messageBox(_("Report sent."), _("Success"))
222223

223224
# define script
224225
@script(description=_("Report Misreadings"), gesture="kb:nvda+control+shift+e")
@@ -248,7 +249,7 @@ def setAccessToken(self, evt):
248249
util = GhUtil(token)
249250
if not util.isActive():
250251
# 認証されていない
251-
gui.messageBox(_("GitHub Access Token is invalid."), _("Error"), wx.ICON_ERROR)
252+
compatibilityUtil.messageBox(_("GitHub Access Token is invalid."), _("Error"))
252253
continue
253254
break
254255
config.conf["ERE_global"]["accessToken"] = token
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import gui
2+
import wx
3+
import versionInfo
4+
5+
def isCompatibleWith2025():
6+
return versionInfo.version_year >= 2025
7+
8+
def messageBox(message: str, title: str, parent: wx.Window | None=None):
9+
if isCompatibleWith2025():
10+
gui.message.MessageDialog.alert(message, title, parent)
11+
else:
12+
gui.messageBox(message, title, style=wx.CENTER, parent=parent)

addon/globalPlugins/ERE/dialogs/reportMisreadingsDialog.py

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

33
import wx
4+
from .. import compatibilityUtil
45

56
# 翻訳が当たるようにする
67
try:
@@ -67,7 +68,7 @@ def okButtonPressedEvent(self, event: wx.CommandEvent):
6768
for label, field in z:
6869
if not field:
6970
import gui
70-
gui.messageBox(_("%s is not entered.") % label, _("Error"), wx.ICON_ERROR, self)
71+
compatibilityUtil.messageBox(_("%s is not entered.") % label, _("Error"), self)
7172
return
7273
# end validation
7374
event.Skip()

addon/globalPlugins/ERE/updater.py

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@
1717
from urllib.parse import urlencode
1818
from .constants import *
1919
from .translate import *
20-
21-
try:
22-
import addonHandler
23-
addonHandler.initTranslation()
24-
except BaseException:
25-
def _(x): return x
20+
from . import updaterStrings as strs
2621

2722
try:
2823
import updateCheck
@@ -38,6 +33,22 @@ def _(x): return x
3833
AUTO=0
3934
MANUAL=1
4035

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+
4152
class AutoUpdateChecker:
4253
def __init__(self):
4354
self.updater = None
@@ -74,13 +85,12 @@ def check_update(self):
7485
f = urlopen(req)
7586
except BaseException:
7687
if self.mode == MANUAL:
77-
gui.messageBox(_("Unable to connect to update server.\nCheck your internet connection."),
78-
_("Error"), style=wx.CENTER | wx.ICON_WARNING)
88+
messageBox(strs.ERROR_UNABLE_TO_CONNECT, strs.ERROR)
7989
return False
8090

8191
if f.getcode() != 200:
8292
if self.mode == MANUAL:
83-
gui.messageBox(_("Unable to connect to update server."), _("Error"), style=wx.CENTER | wx.ICON_WARNING)
93+
messageBox(strs.ERROR_UNABLE_TO_CONNECT_SERVERSIDE, strs.ERROR)
8494
return False
8595

8696
try:
@@ -89,31 +99,25 @@ def check_update(self):
8999
update_dict = json.loads(update_dict)
90100
except BaseException:
91101
if self.mode == MANUAL:
92-
gui.messageBox(
93-
_("The update information is invalid.\nPlease contact ACT Laboratory for further information."),
94-
_("Error"),
95-
style=wx.CENTER | wx.ICON_WARNING)
102+
messageBox(strs.ERROR_UPDATE_INFO_INVALID, strs.ERROR)
96103
return False
97104

98105
code = update_dict["code"]
99106
if code == UPDATER_LATEST:
100107
if self.mode == MANUAL:
101-
gui.messageBox(_("No updates found.\nYou are using the latest version."), _("Update check"), style=wx.CENTER | wx.ICON_INFORMATION)
108+
messageBox(strs.NO_UPDATES, strs.UPDATE_CHECK_TITLE)
102109
return False
103110
elif code == UPDATER_BAD_PARAM:
104111
if self.mode == MANUAL:
105-
gui.messageBox(_("The request parameter is invalid. Please contact the developer."),
106-
_("Update check"), style=wx.CENTER | wx.ICON_INFORMATION)
112+
messageBox(strs.ERROR_REQUEST_PARAMETERS_INVALID, strs.UPDATE_CHECK_TITLE)
107113
return False
108114
elif code == UPDATER_NOT_FOUND:
109115
if self.mode == MANUAL:
110-
gui.messageBox(_("The updater is not registered. Please contact the developer."),
111-
_("Update check"), style=wx.CENTER | wx.ICON_INFORMATION)
116+
messageBox(strs.UPDATER_NOT_REGISTERED, strs.UPDATE_CHECK_TITLE)
112117
return False
113118
elif code == UPDATER_VISIT_SITE:
114119
if self.mode == MANUAL:
115-
gui.messageBox(_("An update was found, but updating from the current version is not possible. Please visit the software's website. "),
116-
_("Update check"), style=wx.CENTER | wx.ICON_INFORMATION)
120+
messageBox(strs.UPDATE_NOT_POSSIBLE, strs.UPDATE_CHECK_TITLE)
117121
return False
118122

119123
new_version = update_dict["update_version"]
@@ -124,11 +128,11 @@ def check_update(self):
124128
hash = update_dict["updater_hash"]
125129
# end set hash
126130

127-
caption = _("Update confirmation")
128-
question = _("{summary} Ver.{newVersion} is available.\nWould you like to update?\nCurrent version: {currentVersion}\nNew version: {newVersion}").format(
131+
caption = strs.UPDATE_CONFIRMATION_TITLE
132+
question = strs.UPDATE_CONFIRMATION_MESSAGE.format(
129133
summary=addonSummary, newVersion=new_version, currentVersion=addonVersion)
130-
answer = gui.messageBox(question, caption, style=wx.CENTER | wx.OK | wx.CANCEL | wx.CANCEL_DEFAULT | wx.ICON_INFORMATION)
131-
if answer == wx.OK:
134+
answer = confirm(question, caption)
135+
if answer == True:
132136
downloader = UpdateDownloader(addonName, [url], hash)
133137
wx.CallAfter(downloader.start)
134138
return
@@ -151,8 +155,8 @@ def start(self):
151155
self._shouldCancel = False
152156
self._guiExecTimer = wx.PyTimer(self._guiExecNotify)
153157
gui.mainFrame.prePopup()
154-
self._progressDialog = wx.ProgressDialog(_("Downloading add-on update"),
155-
_("Connecting"),
158+
self._progressDialog = wx.ProgressDialog(strs.DOWNLOADING,
159+
strs.CONNECTING,
156160
style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME | wx.PD_REMAINING_TIME | wx.PD_AUTO_HIDE,
157161
parent=gui.mainFrame)
158162
self._progressDialog.Raise()
@@ -163,10 +167,7 @@ def start(self):
163167
def _error(self):
164168
self._stopped()
165169
self.cleanup_tempfile()
166-
gui.messageBox(
167-
_("Error downloading add-on update."),
168-
translate("Error"),
169-
wx.OK | wx.ICON_ERROR)
170+
messageBox(strs.ERROR_DOWNLOADING, strs.ERROR)
170171

171172
def _download(self, url):
172173
headers = {}
@@ -221,27 +222,23 @@ def _downloadSuccess(self):
221222
bundle = addonHandler.AddonBundle(self.destPath)
222223
except BaseException:
223224
log.error("Error opening addon bundle from %s" % self.destPath, exc_info=True)
224-
gui.messageBox(translate("Failed to open add-on package file at %s - missing file or invalid file format") % self.destPath,
225-
translate("Error"),
226-
wx.OK | wx.ICON_ERROR)
225+
messageBox(strs.ERROR_OPENING % self.destPath, strs.ERROR)
227226
return
228227
bundleName = bundle.manifest['name']
229228
for addon in addonHandler.getAvailableAddons():
230229
if not addon.isPendingRemove and bundleName == addon.manifest['name']:
231230
addon.requestRemove()
232231
break
233232
progressDialog = gui.IndeterminateProgressDialog(gui.mainFrame,
234-
_("Updating add-on"),
235-
_("Please wait while the add-on is being updated."))
233+
strs.UPDATING,
234+
strs.UPDATING_PLEASE_WAIT)
236235
try:
237236
gui.ExecAndPump(addonHandler.installAddonBundle, bundle)
238237
except BaseException:
239238
log.error("Error installing addon bundle from %s" % self.destPath, exc_info=True)
240239
progressDialog.done()
241240
del progressDialog
242-
gui.messageBox(_("Failed to update add-on from %s.") % self.destPath,
243-
translate("Error"),
244-
wx.OK | wx.ICON_ERROR)
241+
messageBox(strs.ERROR_FAILED_TO_UPDATE % self.destPath, strs.ERROR)
245242
return
246243
else:
247244
progressDialog.done()
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 = _("Error")
8+
ERROR_UNABLE_TO_CONNECT = _("Unable to connect to update server.\nCheck your internet connection.")
9+
ERROR_UNABLE_TO_CONNECT_SERVERSIDE = _("Unable to connect to update server.")
10+
ERROR_UPDATE_INFO_INVALID = _("The update information is invalid.\nPlease contact ACT Laboratory for further information.")
11+
ERROR_REQUEST_PARAMETERS_INVALID = _("The request parameter is invalid. Please contact the developer.")
12+
ERROR_DOWNLOADING = _("Error downloading add-on update.")
13+
ERROR_OPENING = _("Failed to open add-on package file at %s - missing file or invalid file format")
14+
ERROR_FAILED_TO_UPDATE = _("Failed to update add-on from %s.")
15+
NO_UPDATES = _("No updates found.\nYou are using the latest version.")
16+
UPDATER_NOT_REGISTERED = _("The updater is not registered. Please contact the developer.")
17+
UPDATE_NOT_POSSIBLE = _("An update was found, but updating from the current version is not possible. Please visit the software's website. ")
18+
UPDATE_CHECK_TITLE = _("Update check")
19+
UPDATE_CONFIRMATION_TITLE = _("Update confirmation")
20+
UPDATE_CONFIRMATION_MESSAGE = _("{summary} Ver.{newVersion} is available.\nWould you like to update?\nCurrent version: {currentVersion}\nNew version: {newVersion}")
21+
DOWNLOADING = _("Downloading add-on update")
22+
CONNECTING = _("Connecting")
23+
UPDATING = _("Updating add-on")
24+
UPDATING_PLEASE_WAIT = _("Please wait while the add-on is being updated.")

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.1"
4-
ADDON_RELEASE_DATE = "2024-08-21"
3+
ADDON_VERSION = "1.1.2"
4+
ADDON_RELEASE_DATE = "2025-02-23"
55
ADDON_NAME = "EnglishReadingEnhancer"
66
ADDON_KEYWORD = "ERE"
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.1",
44+
"addon_lastTestedNVDAVersion": "2025.1",
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!

0 commit comments

Comments
 (0)