From f28ec7a3a79735403e05e3eb58b8567999e887ee Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Mon, 21 Sep 2020 19:28:39 +0200 Subject: [PATCH] Round off more corners of UI elements :P --- main.tscn | 69 +++++++++++++++++++++++++---------------------- node.gd | 5 ++-- node.tscn | 27 +++++++++++++------ repository.gd | 10 ++++--- styles/theme.tres | 17 ++++++------ terminal.tscn | 4 +++ 6 files changed, 79 insertions(+), 53 deletions(-) diff --git a/main.tscn b/main.tscn index 8910bb0..1156781 100644 --- a/main.tscn +++ b/main.tscn @@ -32,11 +32,11 @@ __meta__ = { terminal_path = NodePath("HBoxContainer/RightSide/Terminal") goal_repository_path = NodePath("HBoxContainer/Repositories/GoalRepository") active_repository_path = NodePath("HBoxContainer/Repositories/ActiveRepository") -level_select_path = NodePath("HBoxContainer/RightSide/Menu/LevelSelect") -next_level_button_path = NodePath("HBoxContainer/RightSide/Menu/NextLevelButton") -level_name_path = NodePath("HBoxContainer/RightSide/LevelPanel/LevelName") -level_description_path = NodePath("HBoxContainer/RightSide/LevelPanel/Text/LevelDescription") -level_congrats_path = NodePath("HBoxContainer/RightSide/LevelPanel/Text/LevelCongrats") +level_select_path = NodePath("HBoxContainer/RightSide/TopStuff/Menu/LevelSelect") +next_level_button_path = NodePath("HBoxContainer/RightSide/TopStuff/Menu/NextLevelButton") +level_name_path = NodePath("HBoxContainer/RightSide/TopStuff/LevelPanel/LevelName") +level_description_path = NodePath("HBoxContainer/RightSide/TopStuff/LevelPanel/Text/LevelDescription") +level_congrats_path = NodePath("HBoxContainer/RightSide/TopStuff/LevelPanel/Text/LevelCongrats") [node name="Background" type="ColorRect" parent="."] anchor_right = 1.0 @@ -47,7 +47,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="HBoxContainer" type="HBoxContainer" parent="."] +[node name="HBoxContainer" type="HSplitContainer" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 5.0 @@ -60,7 +60,7 @@ __meta__ = { } [node name="Repositories" type="HBoxContainer" parent="HBoxContainer"] -margin_right = 1270.0 +margin_right = 1267.0 margin_bottom = 1070.0 mouse_filter = 2 size_flags_horizontal = 3 @@ -75,7 +75,7 @@ anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 0.0 margin_top = 0.0 -margin_right = 635.0 +margin_right = 633.0 margin_bottom = 1070.0 size_flags_horizontal = 3 size_flags_vertical = 3 @@ -84,25 +84,30 @@ label = "Goal" [node name="ActiveRepository" parent="HBoxContainer/Repositories" instance=ExtResource( 3 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 635.0 +margin_left = 633.0 margin_top = 0.0 -margin_right = 1270.0 +margin_right = 1267.0 margin_bottom = 1070.0 size_flags_horizontal = 3 size_flags_vertical = 3 label = "Your repository" -[node name="RightSide" type="VBoxContainer" parent="HBoxContainer"] -margin_left = 1275.0 +[node name="RightSide" type="VSplitContainer" parent="HBoxContainer"] +margin_left = 1279.0 margin_right = 1910.0 margin_bottom = 1070.0 size_flags_horizontal = 3 -[node name="Menu" type="HBoxContainer" parent="HBoxContainer/RightSide"] -margin_right = 635.0 +[node name="TopStuff" type="VBoxContainer" parent="HBoxContainer/RightSide"] +margin_right = 631.0 +margin_bottom = 529.0 +size_flags_vertical = 3 + +[node name="Menu" type="HBoxContainer" parent="HBoxContainer/RightSide/TopStuff"] +margin_right = 631.0 margin_bottom = 35.0 -[node name="LevelSelect" type="MenuButton" parent="HBoxContainer/RightSide/Menu"] +[node name="LevelSelect" type="MenuButton" parent="HBoxContainer/RightSide/TopStuff/Menu"] margin_right = 130.0 margin_bottom = 35.0 text = "Select level..." @@ -111,7 +116,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="ReloadButton" type="Button" parent="HBoxContainer/RightSide/Menu"] +[node name="ReloadButton" type="Button" parent="HBoxContainer/RightSide/TopStuff/Menu"] margin_left = 135.0 margin_right = 214.0 margin_bottom = 35.0 @@ -122,7 +127,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="NextLevelButton" type="Button" parent="HBoxContainer/RightSide/Menu"] +[node name="NextLevelButton" type="Button" parent="HBoxContainer/RightSide/TopStuff/Menu"] margin_left = 219.0 margin_right = 329.0 margin_bottom = 35.0 @@ -135,14 +140,14 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="LevelPanel" type="VBoxContainer" parent="HBoxContainer/RightSide"] +[node name="LevelPanel" type="VBoxContainer" parent="HBoxContainer/RightSide/TopStuff"] margin_top = 40.0 -margin_right = 635.0 -margin_bottom = 552.0 +margin_right = 631.0 +margin_bottom = 529.0 size_flags_vertical = 3 -[node name="LevelName" type="RichTextLabel" parent="HBoxContainer/RightSide/LevelPanel"] -margin_right = 635.0 +[node name="LevelName" type="RichTextLabel" parent="HBoxContainer/RightSide/TopStuff/LevelPanel"] +margin_right = 631.0 margin_bottom = 60.0 rect_min_size = Vector2( 0, 60 ) custom_fonts/normal_font = ExtResource( 7 ) @@ -151,13 +156,13 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Text" type="Control" parent="HBoxContainer/RightSide/LevelPanel"] +[node name="Text" type="Control" parent="HBoxContainer/RightSide/TopStuff/LevelPanel"] margin_top = 65.0 -margin_right = 635.0 -margin_bottom = 512.0 +margin_right = 631.0 +margin_bottom = 489.0 size_flags_vertical = 3 -[node name="LevelDescription" type="RichTextLabel" parent="HBoxContainer/RightSide/LevelPanel/Text"] +[node name="LevelDescription" type="RichTextLabel" parent="HBoxContainer/RightSide/TopStuff/LevelPanel/Text"] anchor_right = 1.0 anchor_bottom = 1.0 size_flags_vertical = 3 @@ -168,7 +173,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="LevelCongrats" type="RichTextLabel" parent="HBoxContainer/RightSide/LevelPanel/Text"] +[node name="LevelCongrats" type="RichTextLabel" parent="HBoxContainer/RightSide/TopStuff/LevelPanel/Text"] visible = false anchor_right = 1.0 anchor_bottom = 1.0 @@ -183,8 +188,8 @@ __meta__ = { [node name="Terminal" parent="HBoxContainer/RightSide" instance=ExtResource( 1 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 557.0 -margin_right = 635.0 +margin_top = 541.0 +margin_right = 631.0 margin_bottom = 1070.0 size_flags_vertical = 3 repository_path = NodePath("../../Repositories/ActiveRepository") @@ -206,8 +211,8 @@ caret_blink = true __meta__ = { "_edit_use_anchors_": false } -[connection signal="button_down" from="HBoxContainer/RightSide/Menu/LevelSelect" to="." method="repopulate_levels"] -[connection signal="pressed" from="HBoxContainer/RightSide/Menu/ReloadButton" to="." method="reload_level"] -[connection signal="pressed" from="HBoxContainer/RightSide/Menu/NextLevelButton" to="." method="load_next_level"] +[connection signal="button_down" from="HBoxContainer/RightSide/TopStuff/Menu/LevelSelect" to="." method="repopulate_levels"] +[connection signal="pressed" from="HBoxContainer/RightSide/TopStuff/Menu/ReloadButton" to="." method="reload_level"] +[connection signal="pressed" from="HBoxContainer/RightSide/TopStuff/Menu/NextLevelButton" to="." method="load_next_level"] [connection signal="data_received" from="Test/TCPServer" to="Test" method="data"] [connection signal="text_entered" from="Test/LineEdit" to="Test" method="send"] diff --git a/node.gd b/node.gd index 5709d1a..330dac8 100644 --- a/node.gd +++ b/node.gd @@ -86,8 +86,9 @@ func children_set(new_children): func _on_hover(): hovered = true - $Content.visible = true - $ID.visible = true + if not id_always_visible: + $Content.visible = true + $ID.visible = true func _on_unhover(): hovered = false diff --git a/node.tscn b/node.tscn index 585c7d0..9fdf821 100644 --- a/node.tscn +++ b/node.tscn @@ -1,9 +1,20 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://node.gd" type="Script" id=1] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2] -[sub_resource type="RectangleShape2D" id=1] +[sub_resource type="StyleBoxFlat" id=1] +content_margin_left = 5.0 +content_margin_right = 5.0 +content_margin_top = 5.0 +content_margin_bottom = 5.0 +bg_color = Color( 1, 1, 1, 0.0745098 ) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 + +[sub_resource type="RectangleShape2D" id=2] extents = Vector2( 30.4838, 29.9015 ) [node name="Node" type="Node2D"] @@ -36,13 +47,13 @@ __meta__ = { [node name="Content" type="Label" parent="."] visible = false -margin_left = -12.8299 -margin_top = 39.5639 -margin_right = 294.17 -margin_bottom = 248.564 +margin_left = -30.0 +margin_top = 37.0 +margin_right = -20.0 +margin_bottom = 72.0 +custom_styles/normal = SubResource( 1 ) custom_fonts/font = ExtResource( 2 ) custom_colors/font_color = Color( 1, 1, 1, 1 ) -text = "content" __meta__ = { "_edit_use_anchors_": false } @@ -50,7 +61,7 @@ __meta__ = { [node name="Area" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area"] -shape = SubResource( 1 ) +shape = SubResource( 2 ) [node name="Arrows" type="Node2D" parent="."] [connection signal="mouse_entered" from="Rect" to="." method="_on_hover"] diff --git a/repository.gd b/repository.gd index 3941f03..84cf4c9 100644 --- a/repository.gd +++ b/repository.gd @@ -24,9 +24,12 @@ func _input(event): $Nodes.rect_scale -= Vector2(0.05, 0.05) if event.is_action_pressed("zoom_in") and $Nodes.rect_scale.x < 2: $Nodes.rect_scale += Vector2(0.05, 0.05) - + +func there_is_a_git(): + return shell.run("test -d .git && echo yes || echo no") == "yes\n" + func update_everything(): - if shell.run("test -d .git && echo yes || echo no") == "yes\n": + if there_is_a_git(): update_head() update_refs() update_index() @@ -241,7 +244,8 @@ func simplify_view(pressed): if obj.type == "tree" or obj.type == "blob": obj.visible = not pressed - update_objects() + if there_is_a_git(): + update_objects() func remove_gone_stuff(): # FIXME: Cache the result of all_objects. diff --git a/styles/theme.tres b/styles/theme.tres index 491d8e2..a810a4c 100644 --- a/styles/theme.tres +++ b/styles/theme.tres @@ -102,7 +102,7 @@ bg_color = Color( 0.172549, 0.172549, 0.172549, 1 ) [sub_resource type="StyleBoxFlat" id=17] content_margin_left = 5.0 content_margin_right = 5.0 -content_margin_top = 5.0 +content_margin_top = 10.0 content_margin_bottom = 5.0 bg_color = Color( 0, 0, 0, 1 ) border_width_left = 2 @@ -110,9 +110,10 @@ border_width_top = 2 border_width_right = 2 border_width_bottom = 2 border_color = Color( 0.529412, 0.384314, 1, 1 ) -corner_radius_top_left = 5 -corner_radius_top_right = 5 -corner_radius_bottom_right = 5 +corner_radius_top_left = 10 +corner_radius_top_right = 10 +corner_radius_bottom_right = 10 +corner_radius_bottom_left = 10 [sub_resource type="StyleBoxFlat" id=18] content_margin_left = 5.0 @@ -120,10 +121,10 @@ content_margin_right = 5.0 content_margin_top = 5.0 content_margin_bottom = 5.0 bg_color = Color( 0, 0, 0, 1 ) -corner_radius_top_left = 5 -corner_radius_top_right = 5 -corner_radius_bottom_right = 5 -corner_radius_bottom_left = 5 +corner_radius_top_left = 10 +corner_radius_top_right = 10 +corner_radius_bottom_right = 10 +corner_radius_bottom_left = 10 [resource] default_font = ExtResource( 1 ) diff --git a/terminal.tscn b/terminal.tscn index 08dd826..499f901 100644 --- a/terminal.tscn +++ b/terminal.tscn @@ -12,6 +12,10 @@ content_margin_top = 5.0 content_margin_bottom = 5.0 bg_color = Color( 0, 0, 0, 1 ) border_color = Color( 0.415686, 0.333333, 1, 1 ) +corner_radius_top_left = 10 +corner_radius_top_right = 10 +corner_radius_bottom_right = 10 +corner_radius_bottom_left = 10 [node name="Terminal" type="Container"] anchor_right = 1.0