mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-03 19:04:40 +01:00
Cleanup leftover file browsers
This commit is contained in:
parent
454520d3ae
commit
208ddd02c2
3 changed files with 2 additions and 60 deletions
|
@ -80,9 +80,7 @@ func load_level(level_id):
|
|||
new_repo.label = repo.slug
|
||||
new_repo.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
new_repo.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
if new_repo.label != "yours":
|
||||
new_repo.file_browser_active = false
|
||||
else:
|
||||
if new_repo.label == "yours":
|
||||
file_browser.shell = new_repo.shell
|
||||
file_browser.update()
|
||||
repositories_node.add_child(new_repo)
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
extends Control
|
||||
|
||||
onready var index = $Browsers/Index
|
||||
onready var nodes = $Rows/RepoVis/Nodes
|
||||
onready var file_browser = $Browsers/FileBrowser
|
||||
onready var label_node = $Rows/RepoVis/Label
|
||||
onready var path_node = $Rows/RepoVis/Path
|
||||
onready var simplify_checkbox = $Rows/RepoVis/SimplifyCheckbox
|
||||
|
||||
export var label: String setget set_label
|
||||
export var path: String setget set_path, get_path
|
||||
export var file_browser_active = true setget set_file_browser_active
|
||||
export var simplified_view = false setget set_simplified_view
|
||||
export var editable_path = false setget set_editable_path
|
||||
|
||||
|
@ -23,15 +20,12 @@ var mouse_inside = false
|
|||
var _commit_count = 0
|
||||
|
||||
func _ready():
|
||||
file_browser.shell = shell
|
||||
|
||||
# Trigger these again because nodes were not ready before.
|
||||
set_label(label)
|
||||
set_file_browser_active(file_browser_active)
|
||||
set_simplified_view(simplified_view)
|
||||
set_editable_path(editable_path)
|
||||
set_path(path)
|
||||
index.repository = self
|
||||
|
||||
update_everything()
|
||||
update_node_positions()
|
||||
|
@ -51,17 +45,12 @@ func there_is_a_git():
|
|||
return shell.run("test -d .git && echo yes || echo no") == "yes\n"
|
||||
|
||||
func update_everything():
|
||||
if file_browser:
|
||||
file_browser.update()
|
||||
if there_is_a_git():
|
||||
update_head()
|
||||
update_refs()
|
||||
update_index()
|
||||
update_objects()
|
||||
remove_gone_stuff()
|
||||
else:
|
||||
if index:
|
||||
index.clear()
|
||||
for o in objects:
|
||||
objects[o].queue_free()
|
||||
objects = {}
|
||||
|
@ -85,9 +74,6 @@ func set_label(new_label):
|
|||
label = new_label
|
||||
if label_node:
|
||||
label_node.text = new_label
|
||||
|
||||
func update_index():
|
||||
index.update()
|
||||
|
||||
func random_position():
|
||||
return Vector2(rand_range(0, rect_size.x), rand_range(0, rect_size.y))
|
||||
|
@ -334,11 +320,6 @@ func _on_mouse_entered():
|
|||
|
||||
func _on_mouse_exited():
|
||||
mouse_inside = false
|
||||
|
||||
func set_file_browser_active(active):
|
||||
file_browser_active = active
|
||||
if file_browser:
|
||||
file_browser.visible = active
|
||||
|
||||
func close_all_file_browsers():
|
||||
var all = all_objects()
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/repository.gd" type="Script" id=1]
|
||||
[ext_resource path="res://styles/theme.tres" type="Theme" id=2]
|
||||
[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://scenes/file_browser.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="Repository" type="Control"]
|
||||
anchor_right = 1.0
|
||||
|
@ -96,42 +95,6 @@ margin_bottom = 61.0
|
|||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Browsers" type="VBoxContainer" parent="."]
|
||||
visible = false
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 6.0
|
||||
margin_top = -356.0
|
||||
margin_right = 635.0
|
||||
margin_bottom = -5.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 0.2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Index" parent="Browsers" instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 629.0
|
||||
margin_bottom = 173.0
|
||||
size_flags_vertical = 3
|
||||
title = "Index"
|
||||
mode = 2
|
||||
|
||||
[node name="FileBrowser" parent="Browsers" instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 629.0
|
||||
margin_bottom = 351.0
|
||||
size_flags_vertical = 3
|
||||
title = "Working directory"
|
||||
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||
[connection signal="pressed" from="Rows/RepoVis/Button" to="." method="update_everything"]
|
||||
|
|
Loading…
Reference in a new issue