mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-22 11:55:56 +00:00
Enhance Tree
presentation and add main script to sample game.
This commit is contained in:
parent
4762af0840
commit
75a65fa81c
|
@ -133,7 +133,16 @@ func focus_popup_menu_item(id):
|
||||||
|
|
||||||
func render_tree_item():
|
func render_tree_item():
|
||||||
var item = node.get_selected()
|
var item = node.get_selected()
|
||||||
var result = item.get_text(0)
|
var result = ""
|
||||||
|
for i in range(node.columns):
|
||||||
|
result += item.get_text(i) + ": "
|
||||||
|
if item.collapsed:
|
||||||
|
result += "collapsed "
|
||||||
|
else:
|
||||||
|
result += "expanded "
|
||||||
|
result += "tree item"
|
||||||
|
if item.is_selected(0):
|
||||||
|
result += ": selected"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
func focus_tab_container():
|
func focus_tab_container():
|
||||||
|
@ -163,7 +172,14 @@ func focus_tree():
|
||||||
else:
|
else:
|
||||||
tts.speak("tree", true)
|
tts.speak("tree", true)
|
||||||
|
|
||||||
func select_tree():
|
func collapse_tree_item(item):
|
||||||
|
if node.has_focus():
|
||||||
|
tts.speak("collapsed", true)
|
||||||
|
|
||||||
|
func input_tree(event):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func select_tree_item():
|
||||||
if node.has_focus():
|
if node.has_focus():
|
||||||
tts.speak(render_tree_item(), true)
|
tts.speak(render_tree_item(), true)
|
||||||
|
|
||||||
|
@ -200,10 +216,12 @@ func unfocused():
|
||||||
func gui_input(event):
|
func gui_input(event):
|
||||||
if node is TabContainer:
|
if node is TabContainer:
|
||||||
return input_tab_container(event)
|
return input_tab_container(event)
|
||||||
if node is ItemList:
|
elif node is ItemList:
|
||||||
return input_item_list(event)
|
return input_item_list(event)
|
||||||
elif node is LineEdit:
|
elif node is LineEdit:
|
||||||
return check_caret_moved()
|
return check_caret_moved()
|
||||||
|
elif node is Tree:
|
||||||
|
return input_tree(event)
|
||||||
|
|
||||||
func _init(tts, node):
|
func _init(tts, node):
|
||||||
if node.is_in_group("accessible"):
|
if node.is_in_group("accessible"):
|
||||||
|
@ -230,5 +248,6 @@ func _init(tts, node):
|
||||||
elif node is PopupMenu:
|
elif node is PopupMenu:
|
||||||
node.connect("id_focused", self, "focus_popup_menu_item")
|
node.connect("id_focused", self, "focus_popup_menu_item")
|
||||||
elif node is Tree:
|
elif node is Tree:
|
||||||
node.connect("item_selected", self, "select_tree")
|
node.connect("item_collapsed", self, "collapse_tree_item")
|
||||||
|
node.connect("item_selected", self, "select_tree_item")
|
||||||
node.connect("tree_exiting", self, "free")
|
node.connect("tree_exiting", self, "free")
|
||||||
|
|
13
main.gd
Normal file
13
main.gd
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
|
@ -1,7 +1,10 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://player.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://main.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://player.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
[node name="Main" type="Node"]
|
[node name="Main" type="Node"]
|
||||||
|
editor/display_folded = true
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
[node name="Player" parent="." instance=ExtResource( 2 )]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user