yagvm/UI/Main/GroupsView.gd

36 lines
928 B
GDScript

extends VBoxContainer
@onready var group_menus_container: VBoxContainer = %GroupMenusContainer
@onready var new_group_button: Button = %NewGroupButton
@onready var group_edit_dialog: GroupEditDialog = %GroupEditDialog
const GROUP_MENU_SCENE := preload("res://UI/Components/GroupMenu.tscn")
var group_list_metadata: GroupListMetadata
func _ready() -> void:
group_list_metadata = GroupListMetadata.new()
new_group_button.pressed.connect(add_new_group)
func add_new_group():
group_edit_dialog.clear()
group_edit_dialog.ok_button_text = "Create"
group_edit_dialog.confirmed.connect(
func():
var gm := group_edit_dialog.group_metadata
# TODO: hack, redo later
var group_name := group_edit_dialog.name_line_edit.text
var group_menu: GroupMenu = GROUP_MENU_SCENE.instantiate()
group_menus_container.add_child(group_menu)
group_menu.setup_from_metadata(group_name, gm)
)
group_edit_dialog.show()