yagvm/UI/Dialogs/GroupEditDialog.gd
2023-05-27 05:54:11 +03:00

44 lines
1.4 KiB
GDScript

extends ConfirmationDialog
class_name GroupEditDialog
@onready var name_line_edit: LineEdit = %NameLineEdit
@onready var icon_path_line_edit: LineEdit = %IconPathLineEdit
@onready var description_text_edit: TextEdit = %DescriptionTextEdit
@onready var override_editor_settings_menu: OverrideEditorSettingsMenu = %OverrideEditorSettingsMenu
var group_metadata: GroupMetadata
func clear() -> void:
name_line_edit.clear()
icon_path_line_edit.clear()
description_text_edit.clear()
override_editor_settings_menu.clear()
group_metadata = GroupMetadata.new()
func get_group_metadata() -> GroupMetadata:
group_metadata.icon_path = icon_path_line_edit.text
group_metadata.description = description_text_edit.text
group_metadata.settings_overrides = override_editor_settings_menu.get_overrides()
group_metadata.name = name_line_edit.text
group_metadata.save_request.emit()
return group_metadata
func fill_from_group_metadata() -> void:
name_line_edit.text = group_metadata.name
icon_path_line_edit.text = group_metadata.icon_path
description_text_edit.text = group_metadata.description
override_editor_settings_menu.fill_from_dictionary(group_metadata.settings_overrides)
func clear_ok_button_connections() -> void:
for connection in get_signal_connection_list("confirmed"):
var callable := connection["callable"] as Callable
var _signal := connection["signal"] as Signal
_signal.disconnect(callable)