Commit Graph

88 Commits

Author SHA1 Message Date
david.ongenaert
1b07f905af Move settings to Editor Settings and other fixes
- Make logging an exported property of ScreenReader
- Move should_stop_on_focus back to ScreenReader, where it was originally
- Initialise TTS in ScreenReader instead of Plugin, so that it works in games too (that wasn't particularly smart of me)
- Prevent connect() errors when ScreenReader._enter_tree() is called more than once (for example when moving the node in the tree).
2021-05-19 13:17:30 +02:00
david.ongenaert
f968ed153b Accessibility configurable from project settings
- Move settings from separate .INI to project settings
- Replace autoloaded TTS instance with dependency injection
- Make loggin configurable

Inspiration for how to do project settings: WAT-Sharp
2021-05-18 22:06:26 +02:00
783fcf3a3c If an AcceptDialog has a label child and no dialog text, speak the label as if it were text. 2020-12-10 13:19:45 -06:00
6c494a0216 Remove unused group. 2020-11-09 12:13:45 -06:00
535336eca5 Assign a node name for easier debugging. 2020-11-09 12:13:07 -06:00
d6d9ff32e2 Eliminate ext check for some nodes where we want to guess a label but which have this property (I.e. LineEdit/TextEdit.) 2020-11-09 11:39:36 -06:00
0d00db483d This algorithm still needs work, but start by calling methods that actually exist. 2020-11-09 11:04:09 -06:00
4ce013787c Handle simple case of labels being in dialogs. 2020-11-09 10:50:52 -06:00
07c21921b7 If nodes have a non-empty ext property, don't guess a label. 2020-11-09 10:46:16 -06:00
fee1bc2b91 Minor cleanup.
* Reformat.
* Prepend some method names with `_`. GDScript convention is that private methods begin with `_`, and I'm slowly changing them over time.
* Speak that the user is focused on a button, not a texture button. That the button is a texture button is an implementation detail, and shouldn't change how they accessibly interact with or perceive it.
2020-09-11 10:44:24 -05:00
Thiago Seus
9cf47e58f5 Fix texture buttons and some tool buttons not reading properly. 2020-09-05 14:40:44 -03:00
348ac32314 Only stop speech on button_down. 2020-08-27 14:07:01 -05:00
6ecd8fa32e Stop TTS on button presses. 2020-08-27 13:12:12 -05:00
54c01c5381 Allow a global override to determine if the next focus event should interrupt speech.
There seem to be a small handful of cases where we want this--controls that gain focus immediately after a dialog appears, for instance. We allow these edge cases to indicate that the next focus shouldn't stop speech, then clear it on cases where speech isn't stopped. This is a bit hacky, but seems cleaner than anything else I came up with.
2020-08-10 13:26:57 -05:00
c218d18090 Revert "Focus and dialog presentation tweaks."
This causes scrolling through trees, lists, and just about everything else where focus doesn't change to a new widget to fail. Clearly another solution is needed.

This reverts commit c459a35f0d.
2020-08-10 12:39:53 -05:00
c459a35f0d Focus and dialog presentation tweaks.
* Remove indiscriminant speech stop on focus events.
* Only stop speech on input events that are keypresses.
* Don't interrupt speech when a dialog is presented.

Now dialogs present in their entirety without having their labels explicitly focused. This allows for Godot's default behavior, where the _OK_ button is automatically focused when the dialog appears, to speak the dialog text and the button as a screen reader user would expect.
2020-08-10 12:12:12 -05:00
6beeaa01bd Redirect "ui_accept" input for specific Tree edge cases.
Trees appear to eat "ui_accept" before `gui_input` receives it. This makes certain use cases--triggering buttons in cells--impossible via the keyboard.

Here, `ScreenReader` attempts to intercept recent presses of "ui_accept" and, if a button in a cell should receive focus, redirects the `InputEvent` to the custom handler for `Tree`.

Unfortunately, this loses the ability to click buttons in cells in the editor's node tree for some reason. It restores, or maybe gets working in the first place, clicking on the _Remove_ button in the input mapping screen. Not sure how to restore the former functionality--these trees are complex and not well-documented.
2020-07-22 12:13:19 -05:00
8f110a27d3 Label improvements, plus trimming.
* Labels themselves don't have labels, so `guess_label()` on a `Label` returns null.
* Remove unused `is_in_bar()` function.
* Prepend `_` to more private function names.
2020-06-16 11:54:49 -05:00
a8f7adaeee Add support for CheckButton, improve CheckBox support, and other minor tweaks. 2020-06-15 15:58:45 -05:00
d2f2145f17 Remove spammy print. 2020-06-11 13:24:56 -05:00
10a080ab99 Speak expanded/collapsed state of TreeItem immediately after its name. 2020-06-09 13:27:53 -05:00
8ee1c05512 Add basic touchscreen support for sliders. 2020-06-09 13:23:58 -05:00
548199d647 Significant improvements to tree-handling.
* Don't manipulate selection in any way. Leave that to Godot, and I'll fix issues in the engine if needed.
* Unify speech rendering of tree rows. This results in more useful announcements of buttons and such when tree items receive focus.
* Only handle `ui_up` and `ui_down` to ensure that focus won't leave a tree when the top-most or bottom-most row is arrowed past.
* Add a bit of handling to strip out duplicate collapse/focus events generated by the remote `SceneTree` in an active game.
2020-06-06 12:05:59 -05:00
3a160df5fd Remove code that no longer seems necessary for restoring focus in the editor when lost. 2020-06-05 15:14:04 -05:00
2da7fcff9d Correctly handle case where EditorInspectorSection child isn't expandable. 2020-05-28 13:13:39 -05:00
9e2e99349c Reformat. 2020-05-19 12:03:59 -05:00
6279f1a3c9 Replace a couple print calls with print_debug. 2020-05-17 18:18:18 -05:00
2463eced93 Fix fail-fast condition that prevented single character text fields from speaking. 2020-04-15 12:32:22 -05:00
b55bdb1547 Put 'dialog:' before message. 2020-03-30 15:15:46 -05:00
fa9e10b1ea Change Accessible initialization strategy.
`Accessible` is now a child of its `Control`. This helps to ensure that everything gets cleaned up as it should. Further, node additions no longer scrape the entire scene.

This may introduce regressions and has only been lightly tested, but without it, `ScreenReader` leaked in various circumstances, including some that caused segfaults on exit.
2020-03-18 08:56:45 -05:00
f47450d05d Add support for focusing RichTextLabels. 2020-01-30 13:23:52 -06:00
d180158749 Remove automatic capture of arrow keys by nodes.
On one hand, it's a bit confusing that UIs can be arrowed around independently of tab/shift-tab. Arrow navigation doesn't feel as intuitive, as it isn't obvious where you'll land.

On the other, it's quicker to navigate between areas of the editor UI by arrowing up/down between controls, and may solve the issue of having to tab a million times to traverse all controls. This also allows for in-game UIs to be traversed using arrows and, quite probably, gamepads as well.
2020-01-25 11:44:20 -06:00
1bef677066 Present button disabled state. 2020-01-21 15:28:23 -06:00
22bb195db0 Don't double-present popup menu item text in cases where the item and shortcut resource name are identical. 2020-01-13 18:06:26 -06:00
fc5b591fe3 Better dialog presentation, and make message labels non-focusable. 2020-01-13 17:59:48 -06:00
fe19717640 Make AcceptDialog focusable so its message can be reread. 2020-01-13 17:52:59 -06:00
cc910a8570 Improve dialog-handling and protect keybinding-setter special case. 2020-01-13 17:16:34 -06:00
be6a6b528e Add support for reading AcceptDialog messages automatically. 2020-01-02 11:43:56 -06:00
2aea81749c Make guessed labels non-focusable to minimize on tabbing. 2019-12-30 09:16:00 -06:00
d5c79f7c56 Don't guess the label for a label. 2019-12-30 09:13:32 -06:00
fbbbb1e06e Revert "Apparently, focused is triggered on mouse_enter as well, so this code isn't needed."
Necessary for next commit, which selectively ignores mouse events and needs this code for explore-by-touch.

This reverts commit dc6186c583.
2019-12-30 08:25:57 -06:00
dc6186c583 Apparently, focused is triggered on mouse_enter as well, so this code isn't needed. 2019-12-29 21:53:35 -06:00
50ea09d7f7 And bring back old cleanup code, which now seems to work better post-yield-abandonment. 2019-12-29 20:14:11 -06:00
833a34b602 Don't speak empty labels since this seems to cause a silent crash. 2019-12-29 19:52:33 -06:00
4ff6b51114 Double-tap runs ui_accept. 2019-12-29 18:52:44 -06:00
8f53556129 Better label-guessing logic, and make associated labels non-focusable. 2019-12-28 14:41:36 -06:00
d6a6609673 Eliminate yield in favor of _process. 2019-12-27 12:46:09 -06:00
aea75e961e Eliminate warnings about disconnection of nonexistent timeout signal. 2019-12-27 12:04:09 -06:00
9051f381fe Use WeakRef to avoid double-free of timers. 2019-12-26 18:39:10 -06:00
d9c740abd6 Return to having Accessible be a Node under ScreenReader, and having _exit_tree free resources.
This eliminates the need to track and iterate through a separate array of `Accessible`s in `ScreenReader`.

The previous performance issues are resolved by ensuring that any nodes processed aren't children of the `ScreenReader` node. I don't know of another way to avoid triggering signals on a child node than checking ancestry and failing fast.
2019-12-26 18:25:26 -06:00