-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiple workspace and a menu to switch/rename them
- Loading branch information
Showing
6 changed files
with
175 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
extends Panel | ||
|
||
@onready var input = preload("res://lib/input.tscn") | ||
|
||
func _ready(): | ||
Globals.root_list = %List | ||
Globals.new_input(%List) | ||
Globals.load_tasks() | ||
Globals.menu = %Menu | ||
Globals.load_tasks(0) | ||
Globals.item_selected.emit(null) | ||
|
||
func _on_prev_workspace_pressed(): | ||
Globals.change_workspace.emit(-1) | ||
|
||
func _on_next_workspace_pressed(): | ||
Globals.change_workspace.emit(+1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
extends MarginContainer | ||
|
||
func _ready(): | ||
Globals.rename_workspace.connect(_rename_workspace) | ||
%WorkspaceTitle.show() | ||
%WorkspaceEdit.hide() | ||
|
||
func _rename_workspace(new_name): | ||
print_debug("Renaming to %s", new_name) | ||
if new_name: | ||
%WorkspaceTitle.text = new_name | ||
return | ||
else: | ||
%WorkspaceTitle.hide() | ||
%WorkspaceEdit.text = %WorkspaceTitle.text | ||
%WorkspaceEdit.show() | ||
%WorkspaceEdit.grab_focus() | ||
|
||
func _on_prev_workspace_pressed(): | ||
Globals.change_workspace.emit(-1) | ||
|
||
func _on_next_workspace_pressed(): | ||
Globals.change_workspace.emit(+1) | ||
|
||
func _on_workspace_edit_text_submitted(new_text): | ||
%WorkspaceEdit.hide() | ||
%WorkspaceTitle.text = %WorkspaceEdit.text | ||
%WorkspaceTitle.show() | ||
Globals.save_data.emit() | ||
|
||
func workspace_name() -> String: | ||
return %WorkspaceTitle.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[gd_scene load_steps=4 format=3 uid="uid://q08a5ojcfou7"] | ||
|
||
[ext_resource type="Script" path="res://lib/menu.gd" id="1_45qa4"] | ||
|
||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fcwat"] | ||
|
||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_h5oi5"] | ||
|
||
[node name="Menu" type="MarginContainer"] | ||
theme_override_constants/margin_left = 5 | ||
theme_override_constants/margin_top = 5 | ||
theme_override_constants/margin_right = 5 | ||
theme_override_constants/margin_bottom = 5 | ||
script = ExtResource("1_45qa4") | ||
|
||
[node name="Container" type="HBoxContainer" parent="."] | ||
custom_minimum_size = Vector2(0, 40) | ||
layout_mode = 2 | ||
|
||
[node name="PrevWorkspace" type="Button" parent="Container"] | ||
layout_mode = 2 | ||
theme_override_styles/focus = SubResource("StyleBoxEmpty_fcwat") | ||
text = "<" | ||
|
||
[node name="WorkspaceTitle" type="Label" parent="Container"] | ||
unique_name_in_owner = true | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
text = "Workspace 0" | ||
horizontal_alignment = 1 | ||
vertical_alignment = 1 | ||
|
||
[node name="WorkspaceEdit" type="LineEdit" parent="Container"] | ||
unique_name_in_owner = true | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
|
||
[node name="NextWorkspace" type="Button" parent="Container"] | ||
layout_mode = 2 | ||
theme_override_styles/focus = SubResource("StyleBoxEmpty_h5oi5") | ||
shortcut_feedback = false | ||
shortcut_in_tooltip = false | ||
text = ">" | ||
|
||
[connection signal="pressed" from="Container/PrevWorkspace" to="." method="_on_prev_workspace_pressed"] | ||
[connection signal="text_submitted" from="Container/WorkspaceEdit" to="." method="_on_workspace_edit_text_submitted"] | ||
[connection signal="pressed" from="Container/NextWorkspace" to="." method="_on_next_workspace_pressed"] |