Speak classes of controls for which we don't have a handler, and minor naming cleanup.

This commit is contained in:
Nolan Darilek 2019-09-20 08:55:47 -05:00
parent 56a7652656
commit f11edefdb5

View File

@ -334,7 +334,7 @@ func tab_container_input(event):
if node.current_tab != new_tab: if node.current_tab != new_tab:
node.current_tab = new_tab node.current_tab = new_tab
func focused(): func focus():
print("Focus: %s" % node) print("Focus: %s" % node)
node.get_tree().root.warp_mouse(node.rect_global_position) node.get_tree().root.warp_mouse(node.rect_global_position)
tts.stop() tts.stop()
@ -368,16 +368,17 @@ func focused():
elif node is Tree: elif node is Tree:
tree_focus() tree_focus()
else: else:
tts.speak(node.get_class(), true)
print("No handler") print("No handler")
if node.hint_tooltip and not spoke_hint_tooltip: if node.hint_tooltip and not spoke_hint_tooltip:
tts.speak(node.hint_tooltip, false) tts.speak(node.hint_tooltip, false)
spoke_hint_tooltip = false spoke_hint_tooltip = false
func unfocused(): func unfocus():
print("Unfocused") print("Unfocused")
position_in_children = 0 position_in_children = 0
func click_focused(): func click_focus():
if node.has_focus(): if node.has_focus():
return return
print("Grabbing focus: %s" % node) print("Grabbing focus: %s" % node)
@ -451,10 +452,10 @@ func _init(tts, node):
self.node = node self.node = node
if is_focusable(node): if is_focusable(node):
node.set_focus_mode(Control.FOCUS_ALL) node.set_focus_mode(Control.FOCUS_ALL)
node.connect("focus_entered", self, "focused") node.connect("focus_entered", self, "focus")
node.connect("mouse_entered", self, "click_focused") node.connect("mouse_entered", self, "click_focus")
node.connect("focus_exited", self, "unfocused") node.connect("focus_exited", self, "unfocus")
node.connect("mouse_exited", self, "unfocused") node.connect("mouse_exited", self, "unfocus")
node.connect("gui_input", self, "gui_input") node.connect("gui_input", self, "gui_input")
if node is CheckBox: if node is CheckBox:
node.connect("toggled", self, "checkbox_toggled") node.connect("toggled", self, "checkbox_toggled")