- Adjusted theming, including adding an error colour to text when a form field needs to be filled out.
This commit is contained in:
parent
941967d5ee
commit
b7a08e7511
@ -4,13 +4,21 @@ extends ColorRect
|
||||
signal submitted(map_name:String, bug_location:Vector3, bug_rotation:Vector3)
|
||||
signal cancelled
|
||||
|
||||
@onready var __product_name : Label = $Form/VBoxContainerLeft/GridContainer/ProductName
|
||||
@onready var __version_label : Label = $Form/VBoxContainerLeft/GridContainer/VersionLabel
|
||||
@onready var __version_button : MenuButton = $Form/VBoxContainerLeft/GridContainer/VersionButton
|
||||
@onready var __hardware_label : MenuButton = $Form/VBoxContainerLeft/GridContainer/HardwareLabel
|
||||
@onready var __hardware_button : MenuButton = $Form/VBoxContainerLeft/GridContainer/HardwareButton
|
||||
@onready var __os_label : Label = $Form/VBoxContainerLeft/GridContainer/OSLabel
|
||||
@onready var __os_button : MenuButton = $Form/VBoxContainerLeft/GridContainer/OSButton
|
||||
@onready var __component_label : Label = $Form/VBoxContainerLeft/GridContainer/ComponentLabel
|
||||
@onready var __component_button : MenuButton = $Form/VBoxContainerLeft/GridContainer/ComponentButton
|
||||
@onready var __severity_label : Label = $Form/VBoxContainerLeft/GridContainer/SeverityLabel
|
||||
@onready var __severity_button : MenuButton = $Form/VBoxContainerLeft/GridContainer/SeverityButton
|
||||
|
||||
@onready var __summary_label : Label = $Form/VBoxContainerRight/GridContainer/SummaryLabel
|
||||
@onready var __summary_text : LineEdit = $Form/VBoxContainerRight/GridContainer/SummaryText
|
||||
@onready var __description_label : Label = $Form/VBoxContainerRight/GridContainer/DescriptionLabel
|
||||
@onready var __description_text : TextEdit = $Form/VBoxContainerRight/GridContainer/DescriptionText
|
||||
|
||||
@onready var __submit_button : Button = $Form/VBoxContainerRight/SubmitButton
|
||||
@ -23,7 +31,8 @@ var __label_groups : Array
|
||||
var __stored_mouse_mode : int
|
||||
var __server_api : BugbotServerAPI
|
||||
|
||||
const __button_disabled_message : StringName = &"Not available"
|
||||
const __BUTTON_DISABLED_MESSAGE : StringName = &"Not available"
|
||||
const __ERROR_TEXT_COLOUR : Color = Color(0.75, 0.0, 0.0)
|
||||
|
||||
|
||||
func _enter_tree():
|
||||
@ -40,6 +49,7 @@ func fill_tags(tag_list:Array):
|
||||
__label_groups.resize(BugbotServerAPI.BugbotTagArray.MAX)
|
||||
__label_groups = tag_list
|
||||
|
||||
__product_name.text = ProjectSettings.get_setting("application/config/name", "")
|
||||
__fill_item_list(__version_button, BugbotServerAPI.BugbotTagArray.VERSION)
|
||||
__fill_item_list(__hardware_button, BugbotServerAPI.BugbotTagArray.HARDWARE)
|
||||
__fill_item_list(__os_button, BugbotServerAPI.BugbotTagArray.OS)
|
||||
@ -49,7 +59,7 @@ func fill_tags(tag_list:Array):
|
||||
func __fill_item_list(menu_button:MenuButton, label_group:int):
|
||||
var menu_options : Array = __label_groups[label_group]
|
||||
if menu_options.is_empty():
|
||||
menu_button.text = __button_disabled_message
|
||||
menu_button.text = __BUTTON_DISABLED_MESSAGE
|
||||
menu_button.disabled = true
|
||||
else:
|
||||
var menu : PopupMenu = menu_button.get_popup()
|
||||
@ -67,17 +77,33 @@ func _on_submit_button_pressed() -> void:
|
||||
var description_text : String = __description_text.text
|
||||
if summary_text.is_empty():
|
||||
printerr("You must fill in a summary.")
|
||||
__summary_label.add_theme_color_override("font_color", __ERROR_TEXT_COLOUR)
|
||||
__summary_text.add_theme_color_override("font_color", __ERROR_TEXT_COLOUR)
|
||||
error_detected = true
|
||||
else:
|
||||
__summary_label.remove_theme_color_override("font_color")
|
||||
__summary_text.remove_theme_color_override("font_color")
|
||||
|
||||
if description_text.is_empty():
|
||||
printerr("You must fill in a description.")
|
||||
__description_label.add_theme_color_override("font_color", __ERROR_TEXT_COLOUR)
|
||||
__description_text.add_theme_color_override("font_color", __ERROR_TEXT_COLOUR)
|
||||
error_detected = true
|
||||
else:
|
||||
__description_label.remove_theme_color_override("font_color")
|
||||
__description_text.remove_theme_color_override("font_color")
|
||||
|
||||
var labels_to_be_added : Array
|
||||
# Check severity first, since this is a requirement.
|
||||
__get_label_ids_for_submission_data(labels_to_be_added, BugbotServerAPI.BugbotTagArray.SEVERITY)
|
||||
if labels_to_be_added.is_empty():
|
||||
printerr("You must select a severity level.")
|
||||
__severity_label.add_theme_color_override("font_color", __ERROR_TEXT_COLOUR)
|
||||
__severity_button.add_theme_color_override("font_color", __ERROR_TEXT_COLOUR)
|
||||
error_detected = true
|
||||
else:
|
||||
__severity_label.remove_theme_color_override("font_color")
|
||||
__severity_button.remove_theme_color_override("font_color")
|
||||
|
||||
if error_detected:
|
||||
__submit_button.disabled = false
|
||||
|
||||
Binary file not shown.
@ -18,7 +18,7 @@ script = ExtResource("2_w8fc6")
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.1
|
||||
anchor_top = 0.45
|
||||
anchor_top = 0.54
|
||||
anchor_right = 0.9
|
||||
anchor_bottom = 0.9
|
||||
grow_horizontal = 2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user