Skip to content

Commit 9f13012

Browse files
committed
solved compatibility issues with NVDA Alpha V28351 and above. It closes #92, closes #93 and closes #95.
1 parent c2a60c3 commit 9f13012

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

addon/globalPlugins/_ibmttsUtils.py

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# Author: David CM <[email protected]> and others.
44
#globalPlugins/_ibmttsutils.py
55

6-
import config, json, os, pickle, ssl, time, winUser, wx, zipfile
6+
import addonAPIVersion, config, json, os, pickle, ssl, time, winUser, wx, zipfile
77
from os import path
88
from ctypes import windll
99
from urllib.request import urlopen
1010

1111
import globalVars, gui, addonHandler
1212
from core import callLater
1313
from logHandler import log
14-
from gui.addonGui import _showAddonRequiresNVDAUpdateDialog, _showAddonTooOldDialog, promptUserForRestart
14+
from gui.addonGui import promptUserForRestart
1515

1616
addonHandler.initTranslation()
1717

@@ -140,7 +140,7 @@ def guiInstallAddon(addonPath):
140140
)
141141
return False
142142
if not addonHandler.addonVersionCheck.hasAddonGotRequiredSupport(bundle):
143-
_showAddonRequiresNVDAUpdateDialog(gui.MainFrame, bundle)
143+
_showAddonRequiresNVDAUpdateDialog(gui.mainFrame, bundle)
144144
return False
145145
if not addonHandler.addonVersionCheck.isAddonTested(bundle):
146146
_showAddonTooOldDialog(gui.mainFrame, bundle)
@@ -382,3 +382,43 @@ def updateTimer(self):
382382
self.autoCheckUpdate()
383383
else:
384384
self.timer = callLater(nextTime, self.autoCheckUpdate)
385+
386+
387+
def _showAddonRequiresNVDAUpdateDialog(parent, bundle):
388+
incompatibleMessage = _(
389+
# Translators: The message displayed when installing an add-on package is prohibited,
390+
# because it requires a later version of NVDA than is currently installed.
391+
"Installation of {summary} {version} has been blocked. The minimum NVDA version required for "
392+
"this add-on is {minimumNVDAVersion}, your current NVDA version is {NVDAVersion}"
393+
).format(
394+
summary=bundle.manifest['summary'],
395+
version=bundle.manifest['version'],
396+
minimumNVDAVersion=addonAPIVersion.formatForGUI(bundle.minimumNVDAVersion),
397+
NVDAVersion=addonAPIVersion.formatForGUI(addonAPIVersion.CURRENT)
398+
)
399+
gui.messageBox(
400+
# Translators: The message displayed when an error occurs when opening an add-on package for adding.
401+
incompatibleMessage,
402+
# Translators: The title of a dialog presented when an error occurs.
403+
_("Add-on not compatible"),
404+
wx.OK | wx.ICON_ERROR
405+
)
406+
407+
408+
def _showAddonTooOldDialog(parent, bundle):
409+
msg = _(
410+
# Translators: A message informing the user that this addon can not be installed
411+
# because it is not compatible.
412+
"Installation of {summary} {version} has been blocked."
413+
" An updated version of this add-on is required,"
414+
" the minimum add-on API supported by this version of NVDA is {backCompatToAPIVersion}"
415+
).format(
416+
backCompatToAPIVersion=addonAPIVersion.formatForGUI(addonAPIVersion.BACK_COMPAT_TO),
417+
**bundle.manifest
418+
)
419+
gui.messageBox(
420+
msg,
421+
# Translators: The title of the dialog presented when the add-on is too old.
422+
_("Add-on not compatible"),
423+
wx.OK | wx.ICON_ERROR
424+
)

0 commit comments

Comments
 (0)