Lazily register for custom UIA properties and annotations#14248
Merged
Conversation
See test results for failed build of commit 4e089fd1eb |
seanbudd
reviewed
Oct 14, 2022
Member
There was a problem hiding this comment.
These changes generally look good.
I'm concerned that removing get is an API breakage.
If this is an API breakage, please follow the steps in devDocs/deprecations.md to retain the deprecated methods if possible,
It may be possible to make the get functions return the class itself?
Member
|
Rather than initializing these implicitly, would it be possible to explicitly initialize these through an initializer being called? |
Member
|
Is this PR abandoned? |
seanbudd
approved these changes
Jan 18, 2023
seanbudd
left a comment
Member
There was a problem hiding this comment.
I think this is fine to be merged, now that we have reached a breaking release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
None. Related to #12971 and #12843 comment
Summary of the issue:
Registering for custom UIA annotations and properties can only be done after
NVDAHelperis initialized. In normal usage this is not a problem, however since registration occurs on import it is impossible to write unit tests or generate developer documentation for anything which imports fromNVDAObjects.UIA. The error when generating developer documentation is as follows:Description of user facing changes
This should affect only developers - classes holding custom UIA properties and annotations are no longer singletons.
Description of development approach
Rather than making
UIAHandler.customAnnotations.CustomAnnotationTypesCommon,UIAHandler.customProps.CustomPropertiesCommonand the Excel specific annotations and properties singletons, we now register for custom properties and annotations first time they're needed rather than on import. To avoid unnecessary interactions with UIA registered id's are cached for lifetime of NVDA. While at it I've also moved imports below the module level docstring since that is the more standard place.Testing strategy:
NVDAHelperare shownKnown issues with pull request:
None known
Change log entries:
For Developers:
UIAHandler.customAnnotations.CustomAnnotationTypesCommon,UIAHandler.customProps.CustomPropertiesCommon,NVDAObjects.UIA.excel.ExcelCustomPropertiesandNVDAObjects.UIA.excel.ExcelCustomAnnotationTypesare no longer singletons - theirgetmethod has been removed.Code Review Checklist: