Bug report form and bug info menus now correctly set focus on themselves, making them possible to use with a controller.

This commit is contained in:
Jamie Greunbaum 2024-06-09 16:39:00 -04:00
parent 026f31ae35
commit 30152c45cc
3 changed files with 19 additions and 4 deletions

View File

@ -5,6 +5,7 @@ extends Control
@onready var __bug_info_title_label : Label = $VBoxContainer/Title
@onready var __bug_info_severity_label : Label = $VBoxContainer/Severity
@onready var __bug_info_status_label : Label = $VBoxContainer/Status
@onready var __close_button : Button = $VBoxContainer/Buttons/Close
var bug_info : BugbotBugData = null : set = __set_bug_info
var stored_mouse_mode : Input.MouseMode
@ -13,6 +14,9 @@ var stored_mouse_mode : Input.MouseMode
func _enter_tree() -> void:
stored_mouse_mode = Input.mouse_mode
Input.mouse_mode = Input.MouseMode.MOUSE_MODE_VISIBLE
func _ready() -> void:
__close_button.grab_focus()
func _exit_tree() -> void:
Input.mouse_mode = stored_mouse_mode

View File

@ -36,17 +36,17 @@ const __BUTTON_DISABLED_MESSAGE : StringName = &"Not available"
const __ERROR_TEXT_COLOUR : Color = Color(0.75, 0.0, 0.0)
func _enter_tree():
func _enter_tree() -> void:
__stored_mouse_mode = Input.mouse_mode
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
__server_api = BugbotServerAPI._create_new_server_api()
func _exit_tree():
func _exit_tree() -> void:
Input.mouse_mode = __stored_mouse_mode
func fill_tags(tag_list:Array):
func fill_tags(tag_list:Array) -> void:
__label_groups.resize(BugbotServerAPI.BugbotTagArray.MAX)
__label_groups = tag_list
if __label_groups.size() != BugbotServerAPI.BugbotTagArray.MAX:
@ -59,8 +59,14 @@ func fill_tags(tag_list:Array):
__fill_item_list(__os_button, __os_label, BugbotServerAPI.BugbotTagArray.OS)
__fill_item_list(__component_button, __component_label, BugbotServerAPI.BugbotTagArray.COMPONENT)
__fill_item_list(__severity_button, __severity_label, BugbotServerAPI.BugbotTagArray.SEVERITY)
if __version_button.visible: __version_button.grab_focus()
elif __hardware_button.visible: __hardware_button.grab_focus()
elif __os_button.visible: __os_button.grab_focus()
elif __component_button.visible: __component_button.grab_focus()
elif __severity_button.visible: __severity_button.grab_focus()
func __fill_item_list(menu_button:MenuButton, menu_label:Label, label_group:int):
func __fill_item_list(menu_button:MenuButton, menu_label:Label, label_group:int) -> void:
var menu_options : Array = __label_groups[label_group]
if menu_options.is_empty():
menu_button.text = __BUTTON_DISABLED_MESSAGE

View File

@ -52,6 +52,7 @@ horizontal_alignment = 2
[node name="VersionButton" type="MenuButton" parent="Form/VBoxContainerLeft/GridContainer"]
layout_mode = 2
focus_neighbor_right = NodePath("../../../VBoxContainerRight/GridContainer/SummaryText")
focus_mode = 2
action_mode = 1
text = "Select Version"
@ -66,6 +67,7 @@ horizontal_alignment = 2
[node name="HardwareButton" type="MenuButton" parent="Form/VBoxContainerLeft/GridContainer"]
layout_mode = 2
focus_neighbor_right = NodePath("../../../VBoxContainerRight/GridContainer/SummaryText")
focus_mode = 2
action_mode = 1
text = "Select Hardware"
@ -80,6 +82,7 @@ horizontal_alignment = 2
[node name="OSButton" type="MenuButton" parent="Form/VBoxContainerLeft/GridContainer"]
layout_mode = 2
focus_neighbor_right = NodePath("../../../VBoxContainerRight/GridContainer/SummaryText")
focus_mode = 2
action_mode = 1
text = "Select OS"
@ -94,6 +97,7 @@ horizontal_alignment = 2
[node name="ComponentButton" type="MenuButton" parent="Form/VBoxContainerLeft/GridContainer"]
layout_mode = 2
focus_neighbor_right = NodePath("../../../VBoxContainerRight/GridContainer/SummaryText")
focus_mode = 2
action_mode = 1
text = "Select Component"
@ -108,6 +112,7 @@ horizontal_alignment = 2
[node name="SeverityButton" type="MenuButton" parent="Form/VBoxContainerLeft/GridContainer"]
layout_mode = 2
focus_neighbor_right = NodePath("../../../VBoxContainerRight/GridContainer/SummaryText")
focus_mode = 2
action_mode = 1
text = "Select Severity"