Add advanced TextPattern: find / select / read text attributes#421
Merged
Conversation
ax_text shipped whole-range reads but couldn't search a control's text, select a found range, or read formatting. Round out TextPattern: find_control_text searches real content (not OCR) via FindText, select_control_text finds + selects a range so the next keystrokes replace it, and control_text_attributes reads font/size/bold/italic/ colour. Extends the backend ABC + Windows UIA backend and the ax_text facade.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 23 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
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.



Why
ax_textshipped the three whole-range reads (document / selection / visible). It couldn't search for a substring, select a found range, or read text formatting attributes — needed to assert "the error word is red and bold" or to place the caret/selection at matched text before typing. This rounds TextPattern out from "dump the text" to "interrogate and manipulate" it.find_control_text— whethertextoccurs in the control (FindText; the real content, not OCR)select_control_text— findtextand select its range so the next keystrokes replace itcontrol_text_attributes— the selection's{font_name, font_size, bold, italic, foreground_color}Sixth feature of the ROUND-15 native-UIA depth lane (the v200 milestone).
Design
base.py_unsupporteddefaults) + real UIA inwindows_backend.py(a_find_rangehelper overDocumentRange.FindText;GetSelection/DocumentRange+GetAttributeValueover the TextPattern attribute ids FontName=40005 / FontSize=40006 / FontWeight=40007→bold / ForegroundColor=40008 / IsItalic=40014, with module-level_attr/_read_text_attributeshelpers to keep CC<10) + extends the existingutils/ax_text/facade.__all__→AC_find_control_text/AC_select_control_text/AC_control_text_attributes→ac_*MCP tools (find/attributes read-only, select destructive) → Script Builder (Native UI). Qt-free verified.Tests
Extended
test/unit_test/headless/test_ax_text_batch.py— the fake backend gainsfind_text/select_text/text_attributes; covers find true/false, select, attributes, plus the updated 5-layer wiring. 17 passed with the legacy_accessible sibling. Real UIA not run in CI.