Basic support for Range.

Tested with `HSlider` and has basic support for other widget types, but I'm only adding support for what I'm immediately using or can access via the editor.
This commit is contained in:
Nolan Darilek 2019-10-18 10:58:16 -05:00
parent 82b24801a3
commit e1d24a00a4

View File

@ -243,6 +243,24 @@ func popup_menu_item_id_pressed(index):
else: else:
TTS.speak("unchecked", true) TTS.speak("unchecked", true)
func range_focused():
var tokens = PoolStringArray([])
tokens.append(str(node.value))
if node is HSlider:
tokens.append("horizontal slider")
elif node is VSlider:
tokens.append("vertical slider")
elif node is SpinBox:
tokens.append("spin box")
else:
tokens.append("range")
tokens.append("minimum %s" % node.min_value)
tokens.append("maximum %s" % node.max_value)
TTS.speak(tokens.join(": "), false)
func range_value_changed(value):
TTS.speak("%s" % value, true)
func text_edit_focus(): func text_edit_focus():
var tokens = PoolStringArray([]) var tokens = PoolStringArray([])
if node.text: if node.text:
@ -450,6 +468,8 @@ func focused():
popup_menu_focused() popup_menu_focused()
elif node is ProgressBar: elif node is ProgressBar:
progress_bar_focused() progress_bar_focused()
elif node is Range:
range_focused()
elif node is TabContainer: elif node is TabContainer:
tab_container_focused() tab_container_focused()
elif node is TextEdit: elif node is TextEdit:
@ -584,6 +604,8 @@ func _init(node):
elif node is PopupMenu: elif node is PopupMenu:
node.connect("id_focused", self, "popup_menu_item_id_focused") node.connect("id_focused", self, "popup_menu_item_id_focused")
node.connect("id_pressed", self, "popup_menu_item_id_pressed") node.connect("id_pressed", self, "popup_menu_item_id_pressed")
elif node is Range:
node.connect("value_changed", self, "range_value_changed")
elif node is ProgressBar: elif node is ProgressBar:
node.connect("value_changed", self, "progress_bar_value_changed") node.connect("value_changed", self, "progress_bar_value_changed")
elif node is TabContainer: elif node is TabContainer: