From 454520d3ae339d98db900ad2dfdb7c2b7c1374f0 Mon Sep 17 00:00:00 2001 From: bleeptrack Date: Tue, 27 Oct 2020 17:32:41 +0100 Subject: [PATCH] Working directory in RightSide --- scenes/file_browser.tscn | 1 + scenes/main.gd | 17 ++++++---- scenes/main.tscn | 71 +++++++++++++++++++++++++--------------- scenes/node.tscn | 8 ++--- scenes/repository.tscn | 4 ++- 5 files changed, 64 insertions(+), 37 deletions(-) diff --git a/scenes/file_browser.tscn b/scenes/file_browser.tscn index 4b32925..302ac7a 100644 --- a/scenes/file_browser.tscn +++ b/scenes/file_browser.tscn @@ -80,6 +80,7 @@ size_flags_horizontal = 3 size_flags_vertical = 3 custom_constants/vseparation = 16 custom_constants/hseparation = 16 +columns = 3 __meta__ = { "_edit_use_anchors_": false } diff --git a/scenes/main.gd b/scenes/main.gd index 6992038..a86f5ed 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -10,13 +10,14 @@ onready var input = terminal.input onready var output = terminal.output onready var repositories_node = $Rows/Columns/Repositories var repositories = {} -onready var level_select = $Rows/Columns/LevelInfo/Menu/LevelSelect -onready var chapter_select = $Rows/Columns/LevelInfo/Menu/ChapterSelect -onready var next_level_button = $Rows/Columns/LevelInfo/Menu/NextLevelButton -onready var level_name = $Rows/Columns/LevelInfo/LevelPanel/LevelName -onready var level_description = $Rows/Columns/LevelInfo/LevelPanel/Text/LevelDescription -onready var level_congrats = $Rows/Columns/LevelInfo/LevelPanel/Text/LevelCongrats +onready var level_select = $Rows/Columns/RightSide/LevelInfo/Menu/LevelSelect +onready var chapter_select = $Rows/Columns/RightSide/LevelInfo/Menu/ChapterSelect +onready var next_level_button = $Rows/Columns/RightSide/LevelInfo/Menu/NextLevelButton +onready var level_name = $Rows/Columns/RightSide/LevelInfo/LevelPanel/LevelName +onready var level_description = $Rows/Columns/RightSide/LevelInfo/LevelPanel/Text/LevelDescription +onready var level_congrats = $Rows/Columns/RightSide/LevelInfo/LevelPanel/Text/LevelCongrats onready var cards = $Rows/Controls/Cards +onready var file_browser = $Rows/Columns/RightSide/FileBrowser func _ready(): var args = helpers.parse_args() @@ -81,6 +82,9 @@ func load_level(level_id): new_repo.size_flags_vertical = SIZE_EXPAND_FILL if new_repo.label != "yours": new_repo.file_browser_active = false + else: + file_browser.shell = new_repo.shell + file_browser.update() repositories_node.add_child(new_repo) repositories[r] = new_repo @@ -131,6 +135,7 @@ func update_repos(): for r in repositories: var repo = repositories[r] repo.update_everything() + file_browser.update() if levels.chapters[current_chapter].levels[current_level].check_win(): show_win_status() diff --git a/scenes/main.tscn b/scenes/main.tscn index 143a65c..7b8207f 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://scenes/terminal.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/main.gd" type="Script" id=2] [ext_resource path="res://scenes/cards.tscn" type="PackedScene" id=3] [ext_resource path="res://styles/alert_button.tres" type="StyleBox" id=4] +[ext_resource path="res://scenes/file_browser.tscn" type="PackedScene" id=5] [ext_resource path="res://styles/theme.tres" type="Theme" id=6] [ext_resource path="res://fonts/big.tres" type="DynamicFont" id=7] [ext_resource path="res://sounds/success.wav" type="AudioStream" id=8] @@ -50,43 +51,51 @@ anchor_right = 1.0 anchor_bottom = 1.0 mouse_filter = 2 size_flags_vertical = 3 +custom_constants/separation = 8 __meta__ = { "_edit_use_anchors_": false } [node name="Columns" type="HBoxContainer" parent="Rows"] margin_right = 1904.0 -margin_bottom = 784.0 +margin_bottom = 782.0 mouse_filter = 2 size_flags_vertical = 3 [node name="Repositories" type="VBoxContainer" parent="Rows/Columns"] margin_right = 1266.0 -margin_bottom = 784.0 +margin_bottom = 782.0 mouse_filter = 2 size_flags_horizontal = 3 size_flags_stretch_ratio = 2.0 custom_constants/separation = 8 -[node name="LevelInfo" type="VBoxContainer" parent="Rows/Columns"] +[node name="RightSide" type="VBoxContainer" parent="Rows/Columns"] margin_left = 1271.0 margin_right = 1904.0 -margin_bottom = 784.0 +margin_bottom = 782.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/separation = 8 + +[node name="LevelInfo" type="VBoxContainer" parent="Rows/Columns/RightSide"] +margin_right = 633.0 +margin_bottom = 442.0 size_flags_horizontal = 3 size_flags_vertical = 3 -[node name="Menu" type="HBoxContainer" parent="Rows/Columns/LevelInfo"] +[node name="Menu" type="HBoxContainer" parent="Rows/Columns/RightSide/LevelInfo"] margin_right = 633.0 margin_bottom = 35.0 -[node name="ChapterSelect" type="OptionButton" parent="Rows/Columns/LevelInfo/Menu"] +[node name="ChapterSelect" type="OptionButton" parent="Rows/Columns/RightSide/LevelInfo/Menu"] margin_right = 168.0 margin_bottom = 35.0 focus_mode = 0 enabled_focus_mode = 0 text = "Select chapter..." -[node name="LevelSelect" type="OptionButton" parent="Rows/Columns/LevelInfo/Menu"] +[node name="LevelSelect" type="OptionButton" parent="Rows/Columns/RightSide/LevelInfo/Menu"] margin_left = 173.0 margin_right = 317.0 margin_bottom = 35.0 @@ -95,7 +104,7 @@ enabled_focus_mode = 0 text = "Select level..." expand_icon = true -[node name="ReloadButton" type="Button" parent="Rows/Columns/LevelInfo/Menu"] +[node name="ReloadButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"] margin_left = 322.0 margin_right = 401.0 margin_bottom = 35.0 @@ -106,7 +115,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="CardsButton" type="Button" parent="Rows/Columns/LevelInfo/Menu"] +[node name="CardsButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"] margin_left = 406.0 margin_right = 478.0 margin_bottom = 35.0 @@ -117,7 +126,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="NextLevelButton" type="Button" parent="Rows/Columns/LevelInfo/Menu"] +[node name="NextLevelButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"] margin_left = 483.0 margin_right = 593.0 margin_bottom = 35.0 @@ -130,13 +139,13 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="LevelPanel" type="VBoxContainer" parent="Rows/Columns/LevelInfo"] +[node name="LevelPanel" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo"] margin_top = 40.0 margin_right = 633.0 -margin_bottom = 784.0 +margin_bottom = 442.0 size_flags_vertical = 3 -[node name="LevelName" type="RichTextLabel" parent="Rows/Columns/LevelInfo/LevelPanel"] +[node name="LevelName" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"] margin_right = 633.0 margin_bottom = 60.0 rect_min_size = Vector2( 0, 60 ) @@ -146,13 +155,13 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Text" type="Control" parent="Rows/Columns/LevelInfo/LevelPanel"] +[node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"] margin_top = 65.0 margin_right = 633.0 -margin_bottom = 744.0 +margin_bottom = 402.0 size_flags_vertical = 3 -[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/LevelInfo/LevelPanel/Text"] +[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"] anchor_right = 1.0 anchor_bottom = 1.0 size_flags_vertical = 3 @@ -163,7 +172,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="LevelCongrats" type="RichTextLabel" parent="Rows/Columns/LevelInfo/LevelPanel/Text"] +[node name="LevelCongrats" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"] visible = false anchor_right = 1.0 anchor_bottom = 1.0 @@ -175,8 +184,18 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 450.0 +margin_right = 633.0 +margin_bottom = 782.0 +size_flags_vertical = 3 +size_flags_stretch_ratio = 0.75 +title = "Working directory" + [node name="Controls" type="HBoxContainer" parent="Rows"] -margin_top = 789.0 +margin_top = 790.0 margin_right = 1904.0 margin_bottom = 1064.0 mouse_filter = 2 @@ -187,7 +206,7 @@ size_flags_stretch_ratio = 0.35 anchor_right = 0.0 anchor_bottom = 0.0 margin_right = 1266.0 -margin_bottom = 275.0 +margin_bottom = 274.0 size_flags_horizontal = 3 size_flags_vertical = 3 size_flags_stretch_ratio = 2.0 @@ -197,15 +216,15 @@ anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 1271.0 margin_right = 1904.0 -margin_bottom = 275.0 +margin_bottom = 274.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="SuccessSound" type="AudioStreamPlayer" parent="."] stream = ExtResource( 8 ) -[connection signal="button_down" from="Rows/Columns/LevelInfo/Menu/ChapterSelect" to="." method="repopulate_chapters"] -[connection signal="button_down" from="Rows/Columns/LevelInfo/Menu/LevelSelect" to="." method="repopulate_levels"] -[connection signal="pressed" from="Rows/Columns/LevelInfo/Menu/ReloadButton" to="." method="reload_level"] -[connection signal="pressed" from="Rows/Columns/LevelInfo/Menu/CardsButton" to="." method="toggle_cards"] -[connection signal="pressed" from="Rows/Columns/LevelInfo/Menu/NextLevelButton" to="." method="load_next_level"] +[connection signal="button_down" from="Rows/Columns/RightSide/LevelInfo/Menu/ChapterSelect" to="." method="repopulate_chapters"] +[connection signal="button_down" from="Rows/Columns/RightSide/LevelInfo/Menu/LevelSelect" to="." method="repopulate_levels"] +[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/ReloadButton" to="." method="reload_level"] +[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/CardsButton" to="." method="toggle_cards"] +[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/NextLevelButton" to="." method="load_next_level"] [connection signal="command_done" from="Rows/Controls/Terminal" to="." method="update_repos"] diff --git a/scenes/node.tscn b/scenes/node.tscn index 6ec6644..d2eba9f 100644 --- a/scenes/node.tscn +++ b/scenes/node.tscn @@ -88,10 +88,10 @@ z_index = 2 visible = false anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = -23.2915 -margin_top = 30.6967 -margin_right = 404.709 -margin_bottom = 172.697 +margin_left = -23.0 +margin_top = 31.0 +margin_right = 574.0 +margin_bottom = 188.0 mouse_filter = 1 mode = 1 [connection signal="mouse_entered" from="Rect" to="." method="_on_hover"] diff --git a/scenes/repository.tscn b/scenes/repository.tscn index d4b62a0..00fd4b7 100644 --- a/scenes/repository.tscn +++ b/scenes/repository.tscn @@ -98,6 +98,7 @@ __meta__ = { } [node name="Browsers" type="VBoxContainer" parent="."] +visible = false anchor_left = 1.0 anchor_top = 1.0 anchor_right = 1.0 @@ -114,6 +115,7 @@ __meta__ = { } [node name="Index" parent="Browsers" instance=ExtResource( 4 )] +visible = false anchor_right = 0.0 anchor_bottom = 0.0 margin_right = 629.0 @@ -123,9 +125,9 @@ title = "Index" mode = 2 [node name="FileBrowser" parent="Browsers" instance=ExtResource( 4 )] +visible = false anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 178.0 margin_right = 629.0 margin_bottom = 351.0 size_flags_vertical = 3