Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextInfos must inherit from BaseContentRecogTextInfo #12157

Merged
merged 7 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions source/contentRecog/recogUi.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,8 @@ def makeTextInfo(self, position):
ti.collapse()
else:
ti = self.result.makeTextInfo(self, position)
if not isinstance(ti, BaseContentRecogTextInfo):
# Support of TextInfos that do not inherit from BaseContentRecogTextInfo is deprecated
# and will be removed in NVDA 2020.1.
log.warning(
f"Deprecation: {type(ti)} must inherit from {BaseContentRecogTextInfo} to avoid reference cycles."
)
ti = self._patchTextInfo(ti)
return ti

def _patchTextInfo(self, info):
# Patch TextInfos so that updateSelection/Caret updates our fake selection.
info.updateCaret = lambda: self._setSelection(info, True)
info.updateSelection = lambda: self._setSelection(info, False)
# Ensure any copies get patched too.
oldCopy = info.copy
info.copy = lambda: self._patchTextInfo(oldCopy())
return info

def _setSelection(self, textInfo, collapse):
self._selection = textInfo.copy()
if collapse:
self._selection.collapse()

def setFocus(self):
ti = self.parent.treeInterceptor
if isinstance(ti, browseMode.BrowseModeDocumentTreeInterceptor):
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ What's New in NVDA
- `ROLE_EQUATION` has been removed from controlTypes - use `ROLE_MATH`` instead. (#12164)
- `autoSettingsUtils.driverSetting` classes are removed from `driverHandler` - please use them from `autoSettingUtils.driverSetting`. (#12168)
- `autoSettingsUtils.utils` classes are removed from `driverHandler` - please use them from `autoSettingUtils.utils`. (#12168)
- Support of `TextInfo`s that do not inherit from `contentRecog.BaseContentRecogTextInfo` is removed. (#12157)


= 2020.4 =
Expand Down