Skip to content

Create typing hints for IUIAutomationTextRange#13903

Merged
seanbudd merged 4 commits into
masterfrom
addTypingToNVDAOjectsUIA
Jul 18, 2022
Merged

Create typing hints for IUIAutomationTextRange#13903
seanbudd merged 4 commits into
masterfrom
addTypingToNVDAOjectsUIA

Conversation

@seanbudd

@seanbudd seanbudd commented Jul 14, 2022

Copy link
Copy Markdown
Member

Link to issue number:

Summary of the issue:

Objects from comInterfaces generally do not have helpful type hints.

Description of user facing changes

When a variable is type hinted with IUIAutomationTextRangeT supported functions will appear as type hints.

Description of development approach

Implements methods found in https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationtextrange, checked against usages in NVDA code.

Testing strategy:

Known issues with pull request:

Change log entries:

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English

@seanbudd seanbudd requested a review from a team as a code owner July 14, 2022 04:25
@seanbudd seanbudd requested a review from feerrenrut July 14, 2022 04:25
class _IUIAutomationTextRangeT(Protocol):
# Based on IUIAutomationTextRange
# https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationtextrange
# Currently incomplete.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Unfortunately this did not generate helpful types.

The comInterfaces code in _944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.py does not provide a lot of type information.

class IUIAutomationTextRange(comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0.IUnknown):
    _case_insensitive_ = True
    _iid_ = GUID('{A543CC6A-F4AE-494B-8239-C814481187A8}')
    _idlflags_ = []

Running stubgen produces nothing helpful.
stubgen -m source.comInterfaces._944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0

Output:

class IUIAutomationTextRange(comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0.IUnknown): ...
class IUIAutomationTextRangeArray(comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0.IUnknown): ...

@seanbudd seanbudd merged commit ae70195 into master Jul 18, 2022
@seanbudd seanbudd deleted the addTypingToNVDAOjectsUIA branch July 18, 2022 00:10
@nvaccessAuto nvaccessAuto added this to the 2022.3 milestone Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants