Skip to content

Commit 054031a

Browse files
authored
Merge 47a80bd into 6b19080
2 parents 6b19080 + 47a80bd commit 054031a

4 files changed

Lines changed: 33 additions & 6 deletions

File tree

source/_addonStore/models/version.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def enableCompatibilityOverride(self):
6262
"""
6363
from addonHandler import AddonStateCategory, state
6464
overiddenAddons = state[AddonStateCategory.OVERRIDE_COMPATIBILITY]
65-
assert self.name not in overiddenAddons and self.canOverrideCompatibility
65+
assert self.name not in overiddenAddons, f"{self.name}, {overiddenAddons}"
66+
assert self.canOverrideCompatibility
6667
overiddenAddons.add(self.name)
6768
state[AddonStateCategory.BLOCKED].discard(self.name)
6869
state[AddonStateCategory.DISABLED].discard(self.name)

source/addonHandler/addonVersionCheck.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,32 @@
77
from typing import TYPE_CHECKING
88

99
import addonAPIVersion
10+
from buildVersion import version_year
1011

1112
if TYPE_CHECKING:
12-
from _addonStore.models.addon import SupportsVersionCheck # noqa: F401
13+
from _addonStore.models.version import SupportsVersionCheck # noqa: F401
14+
15+
16+
if version_year < 2024:
17+
def _isAddonForceDisabled(addon: "SupportsVersionCheck") -> bool:
18+
from addonHandler import AddonBase as AddonHandlerModel
19+
from _addonStore.models.addon import _AddonManifestModel, _AddonStoreModel
20+
from _addonStore.models.version import MajorMinorPatch
21+
forceDisabledAddons = {
22+
"tonysEnhancements": MajorMinorPatch(1, 15),
23+
}
24+
if isinstance(addon, _AddonStoreModel):
25+
addonVersion = addon.addonVersionNumber
26+
elif isinstance(addon, AddonHandlerModel):
27+
addonVersion = MajorMinorPatch._parseVersionFromVersionStr(addon.version)
28+
elif isinstance(addon, _AddonManifestModel):
29+
addonVersion = MajorMinorPatch._parseVersionFromVersionStr(addon.addonVersionName)
30+
else:
31+
raise NotImplementedError(f"Unexpected type for addon: {addon.name}, type: {type(addon)}")
32+
return (
33+
addon.name in forceDisabledAddons
34+
and addonVersion <= forceDisabledAddons[addon.name]
35+
)
1336

1437

1538
def hasAddonGotRequiredSupport(
@@ -29,6 +52,9 @@ def isAddonTested(
2952
"""True if this add-on is tested for the given API version.
3053
By default, the current version of NVDA is evaluated.
3154
"""
55+
if version_year < 2024:
56+
if _isAddonForceDisabled(addon):
57+
return False
3258
return addon.lastTestedNVDAVersion >= backwardsCompatToVersion
3359

3460

source/gui/_addonStoreGui/viewModels/store.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
)
1414
import os
1515
from typing import (
16-
Iterable,
1716
List,
1817
Optional,
1918
cast,
@@ -24,9 +23,9 @@
2423
from _addonStore.dataManager import addonDataManager
2524
from _addonStore.install import installAddon
2625
from _addonStore.models.addon import (
27-
AddonStoreModel,
2826
_createAddonGUICollection,
2927
_AddonGUIModel,
28+
_AddonManifestModel,
3029
_AddonStoreModel,
3130
)
3231
from _addonStore.models.channel import (
@@ -284,7 +283,7 @@ def installOverrideIncompatibilityForAddon(self, listItemVM: AddonListItemVM) ->
284283
"Could not disable the add-on: {addon}."
285284
)
286285

287-
def _handleEnableDisable(self, listItemVM: AddonListItemVM, shouldEnable: bool) -> None:
286+
def _handleEnableDisable(self, listItemVM: AddonListItemVM[_AddonManifestModel], shouldEnable: bool) -> None:
288287
try:
289288
listItemVM.model._addonHandlerModel.enable(shouldEnable)
290289
except addonHandler.AddonError:
@@ -302,7 +301,7 @@ def _handleEnableDisable(self, listItemVM: AddonListItemVM, shouldEnable: bool)
302301
listItemVM.status = getStatus(listItemVM.model)
303302
self.refresh()
304303

305-
def enableOverrideIncompatibilityForAddon(self, listItemVM: AddonListItemVM) -> None:
304+
def enableOverrideIncompatibilityForAddon(self, listItemVM: AddonListItemVM[_AddonManifestModel]) -> None:
306305
from ... import mainFrame
307306
if _shouldEnableWhenAddonTooOldDialog(mainFrame, listItemVM.model):
308307
listItemVM.model.enableCompatibilityOverride()

user_docs/en/changes.t2t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ What's New in NVDA
1414
- An option to have the volume of NVDA sounds and beeps follow the volume setting of the voice you are using. (#1409)
1515
- An option to separately configure the volume of NVDA sounds. (#1409, #15038)
1616
-
17+
- Note: WASAPI is incompatible with version 1.51 and older of Tony's enhancement add-on. (#15402)
1718
-
1819
- NVDA is now able to continually update the result when performing optical character recognition (OCR), speaking new text as it appears. (#2797)
1920
- To enable this functionality, enable the option "Periodically refresh recognized content" in the Windows OCR category of NVDA's settings dialog.

0 commit comments

Comments
 (0)