|
3 | 3 | # Author: David CM <[email protected]> and others.
|
4 | 4 | #globalPlugins/_ibmttsutils.py
|
5 | 5 |
|
6 |
| -import config, json, os, pickle, ssl, time, winUser, wx, zipfile |
| 6 | +import addonAPIVersion, config, json, os, pickle, ssl, time, winUser, wx, zipfile |
7 | 7 | from os import path
|
8 | 8 | from ctypes import windll
|
9 | 9 | from urllib.request import urlopen
|
10 | 10 |
|
11 | 11 | import globalVars, gui, addonHandler
|
12 | 12 | from core import callLater
|
13 | 13 | from logHandler import log
|
14 |
| -from gui.addonGui import _showAddonRequiresNVDAUpdateDialog, _showAddonTooOldDialog, promptUserForRestart |
| 14 | +from gui.addonGui import promptUserForRestart |
15 | 15 |
|
16 | 16 | addonHandler.initTranslation()
|
17 | 17 |
|
@@ -140,7 +140,7 @@ def guiInstallAddon(addonPath):
|
140 | 140 | )
|
141 | 141 | return False
|
142 | 142 | if not addonHandler.addonVersionCheck.hasAddonGotRequiredSupport(bundle):
|
143 |
| - _showAddonRequiresNVDAUpdateDialog(gui.MainFrame, bundle) |
| 143 | + _showAddonRequiresNVDAUpdateDialog(gui.mainFrame, bundle) |
144 | 144 | return False
|
145 | 145 | if not addonHandler.addonVersionCheck.isAddonTested(bundle):
|
146 | 146 | _showAddonTooOldDialog(gui.mainFrame, bundle)
|
@@ -382,3 +382,43 @@ def updateTimer(self):
|
382 | 382 | self.autoCheckUpdate()
|
383 | 383 | else:
|
384 | 384 | 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