Compare commits
7 Commits
1ecf9dba09
...
f0ce658518
Author | SHA1 | Date | |
---|---|---|---|
f0ce658518 | |||
8fdec75ec9 | |||
86441354a3 | |||
c3fd701491 | |||
2321735df8 | |||
c9c1cdeaae | |||
3e967559e2 |
@ -4,3 +4,4 @@ class_name GroupMetadata
|
|||||||
@export var icon_path: String
|
@export var icon_path: String
|
||||||
@export var description: String
|
@export var description: String
|
||||||
@export var installs: Array[InstallMetadata]
|
@export var installs: Array[InstallMetadata]
|
||||||
|
@export var settings_overrides: Dictionary
|
||||||
|
@ -9,17 +9,20 @@ class_name GroupMenu
|
|||||||
@onready var add_install_button_container: CenterContainer = %AddInstallButtonContainer
|
@onready var add_install_button_container: CenterContainer = %AddInstallButtonContainer
|
||||||
@onready var add_install_button: Button = %AddInstallButton
|
@onready var add_install_button: Button = %AddInstallButton
|
||||||
@onready var description_label: Label = %DescriptionLabel
|
@onready var description_label: Label = %DescriptionLabel
|
||||||
|
@onready var inner_separator: HSeparator = %InnerSeparator
|
||||||
|
|
||||||
@onready var edit_group_button: Button = %EditGroupButton
|
@onready var edit_group_button: Button = %EditGroupButton
|
||||||
@onready var delete_group_button: Button = %DeleteGroupButton
|
@onready var delete_group_button: Button = %DeleteGroupButton
|
||||||
|
|
||||||
@onready var header_container: HBoxContainer = %HeaderContainer
|
@onready var header_container: HBoxContainer = %HeaderContainer
|
||||||
|
|
||||||
|
var group_metadata: GroupMetadata
|
||||||
|
|
||||||
signal add_install_button_pressed
|
signal add_install_button_pressed
|
||||||
|
|
||||||
signal edit_group_button_pressed
|
signal edit_group_button_pressed
|
||||||
signal delete_button_pressed
|
signal delete_button_pressed
|
||||||
signal header_text_changed(new_text: String)
|
signal header_text_changed(new_text: String, old_text: String)
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@ -38,8 +41,9 @@ func _ready() -> void:
|
|||||||
header_text_label.gui_input.connect(_on_header_text_label_gui_input)
|
header_text_label.gui_input.connect(_on_header_text_label_gui_input)
|
||||||
|
|
||||||
|
|
||||||
func add(item: InstallItem) -> void:
|
func add(item: InstallItem) -> int:
|
||||||
pass
|
child_container.add_child(item)
|
||||||
|
return child_container.get_child_count()
|
||||||
|
|
||||||
|
|
||||||
func free_item(at_idx: int) -> void:
|
func free_item(at_idx: int) -> void:
|
||||||
@ -78,6 +82,7 @@ func set_children_visible(p_visible: bool) -> void:
|
|||||||
collapse_button.text = "v" if p_visible else ">"
|
collapse_button.text = "v" if p_visible else ">"
|
||||||
child_container.visible = p_visible
|
child_container.visible = p_visible
|
||||||
add_install_button_container.visible = p_visible
|
add_install_button_container.visible = p_visible
|
||||||
|
inner_separator.visible = p_visible
|
||||||
|
|
||||||
|
|
||||||
func add_custom(control: Control) -> void:
|
func add_custom(control: Control) -> void:
|
||||||
@ -90,9 +95,10 @@ func setup_rename() -> void:
|
|||||||
l.size_flags_horizontal = header_text_label.size_flags_horizontal
|
l.size_flags_horizontal = header_text_label.size_flags_horizontal
|
||||||
|
|
||||||
# edit_group_button.disabled = true
|
# edit_group_button.disabled = true
|
||||||
|
var label_index := header_text_label.get_index()
|
||||||
|
|
||||||
header_container.add_child(l)
|
header_container.add_child(l)
|
||||||
header_container.move_child(l, 2)
|
header_container.move_child(l, label_index)
|
||||||
|
|
||||||
var reenable = func():
|
var reenable = func():
|
||||||
header_text_label.visible = true
|
header_text_label.visible = true
|
||||||
@ -102,8 +108,9 @@ func setup_rename() -> void:
|
|||||||
|
|
||||||
l.text_submitted.connect(
|
l.text_submitted.connect(
|
||||||
func(new_text: String):
|
func(new_text: String):
|
||||||
|
var old_text: = header_text_label.text
|
||||||
header_text_label.text = new_text
|
header_text_label.text = new_text
|
||||||
header_text_changed.emit(new_text)
|
header_text_changed.emit(new_text, old_text)
|
||||||
|
|
||||||
reenable.call()
|
reenable.call()
|
||||||
)
|
)
|
||||||
@ -111,6 +118,14 @@ func setup_rename() -> void:
|
|||||||
l.grab_focus()
|
l.grab_focus()
|
||||||
|
|
||||||
|
|
||||||
|
func setup_from_metadata(header_text: String, p_group_metadata: GroupMetadata) -> void:
|
||||||
|
group_metadata = p_group_metadata
|
||||||
|
set_text(header_text)
|
||||||
|
set_description(group_metadata.description)
|
||||||
|
# TODO: add installs
|
||||||
|
# TODO: add icon
|
||||||
|
|
||||||
|
|
||||||
func _on_header_text_label_gui_input(event: InputEvent) -> void:
|
func _on_header_text_label_gui_input(event: InputEvent) -> void:
|
||||||
if event is InputEventMouseButton && \
|
if event is InputEventMouseButton && \
|
||||||
(event as InputEventMouseButton).double_click && \
|
(event as InputEventMouseButton).double_click && \
|
||||||
|
@ -62,7 +62,8 @@ layout_mode = 2
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="HSeparator2" type="HSeparator" parent="."]
|
[node name="InnerSeparator" type="HSeparator" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="AddInstallButtonContainer" type="CenterContainer" parent="."]
|
[node name="AddInstallButtonContainer" type="CenterContainer" parent="."]
|
||||||
@ -73,3 +74,7 @@ layout_mode = 2
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "New Install"
|
text = "New Install"
|
||||||
|
|
||||||
|
[node name="HSeparator3" type="HSeparator" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 16
|
||||||
|
62
UI/Components/InstallItem.gd
Normal file
62
UI/Components/InstallItem.gd
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
extends HBoxContainer
|
||||||
|
class_name InstallItem
|
||||||
|
|
||||||
|
@onready var item_icon: TextureRect = %ItemIcon
|
||||||
|
@onready var name_label: Label = %NameLabel
|
||||||
|
@onready var edit_item_button: Button = %EditItemButton
|
||||||
|
@onready var delete_item_button: Button = %DeleteItemButton
|
||||||
|
@onready var launch_item_button: Button = %LaunchItemButton
|
||||||
|
|
||||||
|
var install_metadata: InstallMetadata
|
||||||
|
|
||||||
|
signal edit_item_button_pressed
|
||||||
|
signal delete_item_button_pressed
|
||||||
|
signal launch_item_button_pressed
|
||||||
|
|
||||||
|
signal name_changed(new_name: String)
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
edit_item_button.pressed.connect(func(): edit_item_button_pressed.emit())
|
||||||
|
delete_item_button.pressed.connect(func(): delete_item_button_pressed.emit())
|
||||||
|
|
||||||
|
name_label.gui_input.connect(_on_name_label_gui_input)
|
||||||
|
|
||||||
|
|
||||||
|
func set_icon(icon: Texture2D) -> void:
|
||||||
|
item_icon.texture = icon
|
||||||
|
|
||||||
|
|
||||||
|
func set_icon_visible(p_visible: bool) -> void:
|
||||||
|
item_icon.visible = p_visible
|
||||||
|
|
||||||
|
|
||||||
|
func setup_rename() -> void:
|
||||||
|
name_label.visible = false
|
||||||
|
var l := RenameLineEdit.new(name_label.text)
|
||||||
|
l.size_flags_horizontal = name_label.size_flags_horizontal
|
||||||
|
|
||||||
|
var label_index := name_label.get_index()
|
||||||
|
|
||||||
|
add_child(l)
|
||||||
|
move_child(l, label_index)
|
||||||
|
|
||||||
|
l.canceled.connect(name_label.set_visible.bind(true))
|
||||||
|
|
||||||
|
l.text_submitted.connect(
|
||||||
|
func(new_text: String):
|
||||||
|
name_label.text = new_text
|
||||||
|
name_changed.emit(new_text)
|
||||||
|
|
||||||
|
name_label.visible = true
|
||||||
|
)
|
||||||
|
|
||||||
|
l.grab_focus()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_name_label_gui_input(event: InputEvent) -> void:
|
||||||
|
if event is InputEventMouseButton && \
|
||||||
|
(event as InputEventMouseButton).double_click && \
|
||||||
|
(event as InputEventMouseButton).button_index == MOUSE_BUTTON_LEFT:
|
||||||
|
get_viewport().set_input_as_handled()
|
||||||
|
setup_rename()
|
47
UI/Components/InstallItem.tscn
Normal file
47
UI/Components/InstallItem.tscn
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://duq208khfvm2t"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://UI/Components/InstallItem.gd" id="1_sh2ev"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://de57eeeobflp4" path="res://icon.svg" id="1_wwvlr"]
|
||||||
|
|
||||||
|
[node name="InstallItem" type="HBoxContainer"]
|
||||||
|
offset_right = 299.0
|
||||||
|
offset_bottom = 32.0
|
||||||
|
script = ExtResource("1_sh2ev")
|
||||||
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
|
[node name="Indent" type="MarginContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 6
|
||||||
|
|
||||||
|
[node name="ItemIcon" type="TextureRect" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("1_wwvlr")
|
||||||
|
expand_mode = 2
|
||||||
|
|
||||||
|
[node name="NameLabel" type="Label" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
mouse_filter = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="EditItemButton" type="Button" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "E"
|
||||||
|
|
||||||
|
[node name="DeleteItemButton" type="Button" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "X"
|
||||||
|
|
||||||
|
[node name="LaunchItemButton" type="Button" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = ">"
|
||||||
|
|
||||||
|
[node name="Indent2" type="MarginContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 6
|
@ -0,0 +1,35 @@
|
|||||||
|
extends VBoxContainer
|
||||||
|
class_name OverrideEditorSettingsMenu
|
||||||
|
|
||||||
|
const ITEM_SCENE := preload("res://UI/Components/OverrideEditorSettingsMenu/OverrideEditorSettingsMenuItem.tscn")
|
||||||
|
|
||||||
|
@onready var override_item_container: VBoxContainer = %OverrideItemContainer
|
||||||
|
@onready var new_override_button: Button = %NewOverrideButton
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
new_override_button.pressed.connect(
|
||||||
|
func():
|
||||||
|
add_item(ITEM_SCENE.instantiate())
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func add_item(item: OverrideEditorSettingsMenuItem) -> void:
|
||||||
|
override_item_container.add_child(item)
|
||||||
|
|
||||||
|
|
||||||
|
func get_overrides() -> Dictionary:
|
||||||
|
var res := {}
|
||||||
|
|
||||||
|
for item in override_item_container.get_children():
|
||||||
|
item = item as OverrideEditorSettingsMenuItem
|
||||||
|
res.merge(item.get_property())
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
func clear() -> void:
|
||||||
|
override_item_container.get_children().map(
|
||||||
|
func(c: OverrideEditorSettingsMenuItem):
|
||||||
|
c.queue_free()
|
||||||
|
)
|
@ -0,0 +1,25 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://ig4wkr1lxvbv"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://UI/Components/OverrideEditorSettingsMenu/OverrideEditorSettingsMenu.gd" id="1_ld5wi"]
|
||||||
|
|
||||||
|
[node name="OverrideEditorSettingsMenu" type="VBoxContainer"]
|
||||||
|
offset_right = 671.0
|
||||||
|
offset_bottom = 65.0
|
||||||
|
script = ExtResource("1_ld5wi")
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Editor Settings overrides"
|
||||||
|
|
||||||
|
[node name="OverrideItemContainer" type="VBoxContainer" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="NewOverrideButton" type="Button" parent="CenterContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "New override"
|
@ -0,0 +1,24 @@
|
|||||||
|
extends HBoxContainer
|
||||||
|
class_name OverrideEditorSettingsMenuItem
|
||||||
|
|
||||||
|
@onready var property_name_line_edit: LineEdit = %PropertyNameLineEdit
|
||||||
|
@onready var property_type_option_button: OptionButton = %PropertyTypeOptionButton
|
||||||
|
@onready var property_value_line_edit: LineEdit = %PropertyValueLineEdit
|
||||||
|
@onready var delete_item_button: Button = %DeleteItemButton
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
# for now, type is just a hint for the convert function.
|
||||||
|
# in the future, there will be custom editors for types, like godot's inspector.
|
||||||
|
# update: convert() is fucking broken.
|
||||||
|
# for type in TYPE_MAX:
|
||||||
|
# property_type_option_button.add_item(TYPE_NAMES[type])
|
||||||
|
|
||||||
|
delete_item_button.pressed.connect(queue_free)
|
||||||
|
|
||||||
|
|
||||||
|
func get_property() -> Dictionary:
|
||||||
|
var prop_name = property_name_line_edit.text
|
||||||
|
var value = str_to_var(prop_name)
|
||||||
|
|
||||||
|
return {prop_name: value}
|
@ -0,0 +1,33 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cbp55btxd5pmi"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://UI/Components/OverrideEditorSettingsMenu/OverrideEditorSettingsMenuItem.gd" id="1_gtb1r"]
|
||||||
|
|
||||||
|
[node name="OverrideEditorSettingsMenuItem" type="HBoxContainer"]
|
||||||
|
offset_right = 505.0
|
||||||
|
offset_bottom = 32.0
|
||||||
|
script = ExtResource("1_gtb1r")
|
||||||
|
|
||||||
|
[node name="PropertyNameLineEdit" type="LineEdit" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
placeholder_text = "Property name"
|
||||||
|
|
||||||
|
[node name="PropertyTypeOptionButton" type="OptionButton" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_stretch_ratio = 0.72
|
||||||
|
text_overrun_behavior = 3
|
||||||
|
|
||||||
|
[node name="PropertyValueLineEdit" type="LineEdit" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
placeholder_text = "Property value"
|
||||||
|
|
||||||
|
[node name="DeleteItemButton" type="Button" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "X"
|
25
UI/Dialogs/GroupEditDialog.gd
Normal file
25
UI/Dialogs/GroupEditDialog.gd
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
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()
|
||||||
|
|
||||||
|
return group_metadata
|
70
UI/Dialogs/GroupEditDialog.tscn
Normal file
70
UI/Dialogs/GroupEditDialog.tscn
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://du25gr7aoh34m"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://UI/Dialogs/GroupEditDialog.gd" id="1_ic3yh"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://ig4wkr1lxvbv" path="res://UI/Components/OverrideEditorSettingsMenu/OverrideEditorSettingsMenu.tscn" id="1_yeeya"]
|
||||||
|
|
||||||
|
[node name="GroupEditDialog" type="ConfirmationDialog"]
|
||||||
|
initial_position = 1
|
||||||
|
title = "Edit Group"
|
||||||
|
size = Vector2i(678, 411)
|
||||||
|
script = ExtResource("1_ic3yh")
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
offset_left = 8.0
|
||||||
|
offset_top = 8.0
|
||||||
|
offset_right = 670.0
|
||||||
|
offset_bottom = 362.0
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Name"
|
||||||
|
|
||||||
|
[node name="NameLineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Icon"
|
||||||
|
|
||||||
|
[node name="IconPathLineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
placeholder_text = "Optional"
|
||||||
|
|
||||||
|
[node name="OpenIconFileDialogButton" type="Button" parent="VBoxContainer/HBoxContainer2"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "F"
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="VBoxContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Description"
|
||||||
|
|
||||||
|
[node name="DescriptionTextEdit" type="TextEdit" parent="VBoxContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(0, 100)
|
||||||
|
layout_mode = 2
|
||||||
|
placeholder_text = "Optional"
|
||||||
|
|
||||||
|
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(0, 150)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
horizontal_scroll_mode = 0
|
||||||
|
|
||||||
|
[node name="OverrideEditorSettingsMenu" parent="VBoxContainer/ScrollContainer" instance=ExtResource("1_yeeya")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
35
UI/Main/GroupsView.gd
Normal file
35
UI/Main/GroupsView.gd
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
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()
|
@ -1,4 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://bf464y0q4l67h"]
|
[gd_scene load_steps=3 format=3 uid="uid://bf464y0q4l67h"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://UI/Main/GroupsView.gd" id="1_15bdc"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://du25gr7aoh34m" path="res://UI/Dialogs/GroupEditDialog.tscn" id="1_fqa62"]
|
||||||
|
|
||||||
[node name="GroupsView" type="VBoxContainer"]
|
[node name="GroupsView" type="VBoxContainer"]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@ -6,6 +9,8 @@ anchor_right = 1.0
|
|||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_15bdc")
|
||||||
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="Label" type="Label" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@ -21,6 +26,7 @@ layout_mode = 2
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
|
||||||
[node name="GroupMenusContainer" type="VBoxContainer" parent="PanelContainer/ScrollContainer"]
|
[node name="GroupMenusContainer" type="VBoxContainer" parent="PanelContainer/ScrollContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
@ -28,5 +34,9 @@ size_flags_horizontal = 3
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="NewGroupButton" type="Button" parent="CenterContainer"]
|
[node name="NewGroupButton" type="Button" parent="CenterContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "New Group"
|
text = "New Group"
|
||||||
|
|
||||||
|
[node name="GroupEditDialog" parent="." instance=ExtResource("1_fqa62")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
@ -15,6 +15,10 @@ config/features=PackedStringArray("4.0", "Forward Plus")
|
|||||||
run/low_processor_mode=true
|
run/low_processor_mode=true
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/subwindows/embed_subwindows=false
|
||||||
|
|
||||||
[editor]
|
[editor]
|
||||||
|
|
||||||
naming/scene_name_casing=1
|
naming/scene_name_casing=1
|
||||||
|
Loading…
Reference in New Issue
Block a user