mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-25 05:15:57 +00:00
Assorted changes:
* Use new TTS.gd script rather than loading directly. TTS.gd gives us flexibility to handle TTS with the native Rust plugin on some platforms, something like a Java module under Android, etc. * Make `Panel` focusable. This handles the case where exiting a game from the editor places focus on an element without focus, thus breaking keyboard navigation. * Log when we attempt to grab focus so I can debug cases where focus tries to go somewhere it can't.
This commit is contained in:
parent
40cb92d39b
commit
56a7652656
|
@ -3,7 +3,8 @@ extends EditorPlugin
|
|||
|
||||
var Accessible = preload("accessible.gd")
|
||||
|
||||
const TTS = preload("res://addons/godot-tts/godot-tts.gdns")
|
||||
var TTS = preload("../godot-tts/TTS.gd")
|
||||
|
||||
var tts
|
||||
|
||||
func augment_node(node):
|
||||
|
|
|
@ -168,6 +168,9 @@ func menu_button_focus():
|
|||
tokens.append("menu")
|
||||
tts.speak(tokens.join(": "), false)
|
||||
|
||||
func panel_focus():
|
||||
tts.speak("panel", true)
|
||||
|
||||
func popup_menu_focus():
|
||||
tts.speak("menu", false)
|
||||
|
||||
|
@ -354,6 +357,8 @@ func focused():
|
|||
label_focus()
|
||||
elif node is LineEdit:
|
||||
line_edit_focus()
|
||||
elif node is Panel:
|
||||
panel_focus()
|
||||
elif node is PopupMenu:
|
||||
popup_menu_focus()
|
||||
elif node is TabContainer:
|
||||
|
@ -375,6 +380,7 @@ func unfocused():
|
|||
func click_focused():
|
||||
if node.has_focus():
|
||||
return
|
||||
print("Grabbing focus: %s" % node)
|
||||
node.grab_focus()
|
||||
|
||||
func gui_input(event):
|
||||
|
@ -413,7 +419,7 @@ func is_focusable(node):
|
|||
return true
|
||||
if node.get_class() == "EditorInspectorSection":
|
||||
return true
|
||||
if node is Container or node is Panel or node is Separator or node is ScrollBar or node is Popup or node.get_class() == "Control":
|
||||
if node is Container or node is Separator or node is ScrollBar or node is Popup or node.get_class() == "Control":
|
||||
return false
|
||||
return true
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user