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

Conversation

seanbudd
Copy link
Member

@seanbudd seanbudd commented Mar 12, 2021

Link to issue number:

Part of #12123

Implements deprecation announced in: #11510

Summary of the issue:

TextInfos that are used in content recognition module contentRecog must inherit from BaseContentRecogTextInfo

Description of how this pull request fixes the issue:

Code was which manually added BaseContentRecogTextInfo API functions updateCaret, updateSelection to TextInfos is removed.

Unused helper functions for the removed code was also removed

Instances where RuntimeErrors were passed into RecogResultNVDAObject were replaced with raising the errors directly.

Testing strategy:

  • in RecogResultNVDAObject.makeTextInfo ti can be assigned from 3 locations, but only two ways: self.result.makeTextInfo  and self._selection.copy()
  • self._selection is set from the __init__, ( self._selection = self.makeTextInfo(textInfos.POSITION_FIRST) ) and will be the result of ti = self.result.makeTextInfo  . So we only have to look at where result comes from.
  • result is passed in when the class is created, looking for usages of RecogResultNVDAObject , it is only from def _recogOnResult but result is passed into that as well.
  • If you look for where that is called you'll find def recognize in uwpOcr.py
  • Here, the result LinesWordsResult(data, imgInfo) is passed eventually passed into RecogResultNVDAObject via _recogOnResult, the RuntimeErrors passed in are handled in _recogOnResult
  • LinesWordsResult.makeTextInfo creates a LwrTextInfo  object, which subclasses BaseContentRecogTextInfo

Search the code base for usages of _patchTextInfo and confirm the only usages are self references and in the removed code.

find . -type f -name '*.py' -exec grep -P "\b_patchTextInfo\b" {} +

Search the code base for usages of _setSelection and confirm the only usages are in the removed code.

find . -type f -name '*.py' -exec grep -P "\b_setSelection\b" {} +

Known issues with pull request:

None

Change log entry:

Developer Changes

- Support of `TextInfo`s that do not inherit from `contentRecog.BaseContentRecogTextInfo` is removed (#12157)

Code Review Checklist:

  • Pull Request description is up to date.
  • Unit tests.
  • System (end to end) tests.
  • Manual tests.
  • User Documentation.
  • Change log entry.
  • Context sensitive help for GUI changes.

@seanbudd seanbudd added the deprecated/2021.1 Label used to track deprecations due for removal in the 2021.1 release label Mar 12, 2021
@seanbudd seanbudd added this to the 2021.1 milestone Mar 12, 2021
@seanbudd seanbudd self-assigned this Mar 12, 2021
@seanbudd seanbudd changed the title Dep 11510 TextInfos must inherit from BaseContentRecogTextInfo Mar 12, 2021
@seanbudd seanbudd mentioned this pull request Mar 12, 2021
18 tasks
Copy link
Contributor

@feerrenrut feerrenrut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @seanbudd

@seanbudd seanbudd merged commit 4b74c7b into master Mar 17, 2021
@seanbudd seanbudd deleted the dep-11510 branch March 17, 2021 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated/2021.1 Label used to track deprecations due for removal in the 2021.1 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants