Remove comments and unused files

This commit is contained in:
Sebastian Morr 2020-10-26 18:56:35 +01:00
parent 06063d5ee6
commit c330524f8e
15 changed files with 33 additions and 152 deletions

View file

@ -1,7 +1,5 @@
extends Node2D extends Node2D
var label = "label" setget label_set
var source: String var source: String
var target: String var target: String
@ -11,7 +9,6 @@ func _ready():
pass pass
func _process(_delta): func _process(_delta):
#position = -repository.objects[source].position
position = Vector2(0,0) position = Vector2(0,0)
if not (repository and repository.objects.has(source)): if not (repository and repository.objects.has(source)):
@ -27,7 +24,7 @@ func _process(_delta):
else: else:
$Target.text = target $Target.text = target
if $Target.text.substr(0, 5) != "refs/": if $Target.text.substr(0, 5) != "refs/":
$Target.text = ""#$Target.text.substr(0,8) $Target.text = ""
$Target.show() $Target.show()
$Line.hide() $Line.hide()
$Tip.hide() $Tip.hide()
@ -35,10 +32,5 @@ func _process(_delta):
$Line.points[1] = end - repository.objects[source].position $Line.points[1] = end - repository.objects[source].position
# Move the tip away from the object a bit. # Move the tip away from the object a bit.
$Line.points[1] -= $Line.points[1].normalized()*30 $Line.points[1] -= $Line.points[1].normalized()*30
#$Label.position = ($Line.points[0] + $Line.points[1])/1.3
$Tip.position = $Line.points[1] $Tip.position = $Line.points[1]
$Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1]) $Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1])
func label_set(new_label):
label = new_label
$Label/ID.text = label

View file

@ -1,7 +0,0 @@
extends Button
func _ready():
pass
func pressed():
$"../../..".send_command(text)

13
card.gd
View file

@ -35,19 +35,9 @@ func _process(delta):
if hovered and not dragged: if hovered and not dragged:
target_scale = 1.5 target_scale = 1.5
# if hovered:
# rotation = 0
# else:
# if _home_rotation:
# rotation_degrees = _home_rotation
var speed = 5 var speed = 5
scale = lerp(scale, Vector2(target_scale, target_scale), 10*delta) scale = lerp(scale, Vector2(target_scale, target_scale), 10*delta)
# if scale.x < target_scale:
# scale += speed*delta*Vector2(1, 1)
# elif scale.x > target_scale:
# scale -= speed*delta*Vector2(1, 1)
func _unhandled_input(event): func _unhandled_input(event):
if event is InputEventMouseButton: if event is InputEventMouseButton:
@ -99,9 +89,6 @@ func move_back():
func buuurn(): func buuurn():
move_back() move_back()
#queue_free()
#$"..".draw_rand_card()
#$"..".arrange_cards()
func dropped_on(other): func dropped_on(other):
var full_command = "" var full_command = ""

View file

@ -216,9 +216,7 @@ func redraw_all_cards():
for card in get_tree().get_nodes_in_group("cards"): for card in get_tree().get_nodes_in_group("cards"):
card.queue_free() card.queue_free()
# for i in range(7):
# draw_rand_card()
for card in cards: for card in cards:
draw_card(card) draw_card(card)

View file

@ -1,7 +1,6 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1]
[ext_resource path="res://drop_area.tscn" type="PackedScene" id=2]
[ext_resource path="res://repository.tscn" type="PackedScene" id=3] [ext_resource path="res://repository.tscn" type="PackedScene" id=3]
[ext_resource path="res://cardgame.gd" type="Script" id=4] [ext_resource path="res://cardgame.gd" type="Script" id=4]
[ext_resource path="res://terminal.tscn" type="PackedScene" id=5] [ext_resource path="res://terminal.tscn" type="PackedScene" id=5]
@ -32,8 +31,6 @@ margin_bottom = 744.0
label = "yours" label = "yours"
simplified_view = true simplified_view = true
[node name="DropArea" parent="." instance=ExtResource( 2 )]
[node name="Terminal" parent="." instance=ExtResource( 5 )] [node name="Terminal" parent="." instance=ExtResource( 5 )]
margin_left = 1488.0 margin_left = 1488.0
margin_top = 5.0 margin_top = 5.0

View file

@ -64,12 +64,6 @@ func load_level(level_id):
level_congrats.bbcode_text = level.congrats level_congrats.bbcode_text = level.congrats
level_name.text = level.title level_name.text = level.title
# var code_regex = RegEx.new()
# code_regex.compile("\\[code\\]([^\\[]*)\\[/code\\]")
# var matches = code_regex.search_all(level.description)
# for m in matches:
# cards.add_card(m.get_string(1))
for r in repositories_node.get_children(): for r in repositories_node.get_children():
r.queue_free() r.queue_free()
repositories = {} repositories = {}

View file

@ -1,14 +1,12 @@
[gd_scene load_steps=11 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://terminal.tscn" type="PackedScene" id=1] [ext_resource path="res://terminal.tscn" type="PackedScene" id=1]
[ext_resource path="res://main.gd" type="Script" id=2] [ext_resource path="res://main.gd" type="Script" id=2]
[ext_resource path="res://cards.tscn" type="PackedScene" id=3] [ext_resource path="res://cards.tscn" type="PackedScene" id=3]
[ext_resource path="res://styles/alert_button.tres" type="StyleBox" id=4] [ext_resource path="res://styles/alert_button.tres" type="StyleBox" id=4]
[ext_resource path="res://tcp_server.tscn" type="PackedScene" id=5]
[ext_resource path="res://styles/theme.tres" type="Theme" id=6] [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://fonts/big.tres" type="DynamicFont" id=7]
[ext_resource path="res://sounds/success.wav" type="AudioStream" id=8] [ext_resource path="res://sounds/success.wav" type="AudioStream" id=8]
[ext_resource path="res://test.gd" type="Script" id=9]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 10.0 content_margin_left = 10.0
@ -204,22 +202,6 @@ margin_bottom = 1064.0
size_flags_vertical = 3 size_flags_vertical = 3
size_flags_stretch_ratio = 0.35 size_flags_stretch_ratio = 0.35
[node name="Test" type="Node2D" parent="."]
visible = false
script = ExtResource( 9 )
[node name="TCPServer" parent="Test" instance=ExtResource( 5 )]
[node name="LineEdit" type="LineEdit" parent="Test"]
margin_left = 720.526
margin_top = 691.052
margin_right = 1130.53
margin_bottom = 778.052
caret_blink = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="SuccessSound" type="AudioStreamPlayer" parent="."] [node name="SuccessSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 8 ) stream = ExtResource( 8 )
[connection signal="button_down" from="Rows/Columns/RightSide/TopStuff/Menu/ChapterSelect" to="." method="repopulate_chapters"] [connection signal="button_down" from="Rows/Columns/RightSide/TopStuff/Menu/ChapterSelect" to="." method="repopulate_chapters"]
@ -228,4 +210,3 @@ stream = ExtResource( 8 )
[connection signal="pressed" from="Rows/Columns/RightSide/TopStuff/Menu/CardsButton" to="." method="toggle_cards"] [connection signal="pressed" from="Rows/Columns/RightSide/TopStuff/Menu/CardsButton" to="." method="toggle_cards"]
[connection signal="pressed" from="Rows/Columns/RightSide/TopStuff/Menu/NextLevelButton" to="." method="load_next_level"] [connection signal="pressed" from="Rows/Columns/RightSide/TopStuff/Menu/NextLevelButton" to="." method="load_next_level"]
[connection signal="command_done" from="Rows/Columns/RightSide/Terminal" to="." method="update_repos"] [connection signal="command_done" from="Rows/Columns/RightSide/Terminal" to="." method="update_repos"]
[connection signal="text_entered" from="Test/LineEdit" to="Test" method="send"]

View file

@ -60,28 +60,20 @@ func type_set(new_type):
file_browser.title = "Commit" file_browser.title = "Commit"
if type != "ref": if type != "ref":
$ID.text = $ID.text.substr(0,8) $ID.text = $ID.text.substr(0,8)
#elif type == "ref":
#$ID.text = $ID.text.replace("refs/", "")
match new_type: match new_type:
"blob": "blob":
$Sprite.texture = preload("res://nodes/blob.svg") $Sprite.texture = preload("res://nodes/blob.svg")
#$Rect.color = Color("#333333")
"tree": "tree":
$Sprite.texture = preload("res://nodes/tree.svg") $Sprite.texture = preload("res://nodes/tree.svg")
#$Rect.color = Color.darkgreen
"commit": "commit":
$Sprite.texture = preload("res://nodes/commit.svg") $Sprite.texture = preload("res://nodes/commit.svg")
#$Rect.color = Color.orange
"tag": "tag":
$Sprite.texture = preload("res://nodes/blob.svg") $Sprite.texture = preload("res://nodes/blob.svg")
#$Rect.color = Color.blue
"ref": "ref":
$Sprite.texture = preload("res://nodes/ref.svg") $Sprite.texture = preload("res://nodes/ref.svg")
#$Rect.color = Color("#6680ff")
id_always_visible = true id_always_visible = true
"head": "head":
$Sprite.texture = preload("res://nodes/ref.svg") $Sprite.texture = preload("res://nodes/ref.svg")
#$Rect.color = Color.red
id_always_visible = true id_always_visible = true
if id_always_visible: if id_always_visible:
$ID.show() $ID.show()
@ -93,7 +85,6 @@ func children_set(new_children):
for c in new_children: for c in new_children:
if not children.has(c): if not children.has(c):
var a = arrow.instance() var a = arrow.instance()
a.label = new_children[c]
a.source = id a.source = id
a.target = c a.target = c
a.repository = repository a.repository = repository

View file

@ -1,11 +0,0 @@
extends KinematicBody2D
export var speed = 800
func _ready():
pass
func _process(delta):
var right = Input.get_action_strength("right") - Input.get_action_strength("left")
var down = Input.get_action_strength("down") - Input.get_action_strength("up")
move_and_slide(Vector2(right, down).normalized()*speed)

View file

@ -1,15 +1,27 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://player.gd" type="Script" id=1] [sub_resource type="GDScript" id=1]
script/source = "extends KinematicBody2D
[sub_resource type="RectangleShape2D" id=1] export var speed = 800
func _ready():
pass
func _process(delta):
var right = Input.get_action_strength(\"right\") - Input.get_action_strength(\"left\")
var down = Input.get_action_strength(\"down\") - Input.get_action_strength(\"up\")
move_and_slide(Vector2(right, down).normalized()*speed)
"
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 50, 50 ) extents = Vector2( 50, 50 )
[node name="Player" type="KinematicBody2D"] [node name="Player" type="KinematicBody2D"]
script = ExtResource( 1 ) script = SubResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 ) shape = SubResource( 2 )
[node name="Rect" type="ColorRect" parent="."] [node name="Rect" type="ColorRect" parent="."]
margin_left = -50.0 margin_left = -50.0

View file

@ -342,5 +342,3 @@ func set_file_browser_active(active):
file_browser_active = active file_browser_active = active
if file_browser: if file_browser:
file_browser.visible = active file_browser.visible = active

View file

@ -6,8 +6,6 @@ var exit_code
var _cwd var _cwd
var _os = OS.get_name() var _os = OS.get_name()
#signal output(text)
func _init(): func _init():
_cwd = game.tmp_prefix_inside _cwd = game.tmp_prefix_inside

View file

@ -12,9 +12,7 @@ var git_commands_help = []
onready var input = $Rows/InputLine/Input onready var input = $Rows/InputLine/Input
onready var output = $Rows/TopHalf/Output onready var output = $Rows/TopHalf/Output
onready var completions = $Rows/TopHalf/Completions onready var completions = $Rows/TopHalf/Completions
#export(NodePath) var repository_path
var repository var repository
onready var command_dropdown = $Rows/InputLine/CommandDropdown
onready var main = get_tree().get_root().get_node("Main") onready var main = get_tree().get_root().get_node("Main")
var premade_commands = [ var premade_commands = [
@ -24,28 +22,10 @@ var premade_commands = [
] ]
func _ready(): func _ready():
#repository.shell.connect("output", self, "receive_output")
for command in premade_commands:
command_dropdown.get_popup().add_item(command)
command_dropdown.get_popup().connect("id_pressed", self, "load_command")
var error = $TextEditor.connect("hide", self, "editor_closed") var error = $TextEditor.connect("hide", self, "editor_closed")
if error != OK: if error != OK:
helpers.crash("Could not connect TextEditor's hide signal") helpers.crash("Could not connect TextEditor's hide signal")
input.grab_focus() input.grab_focus()
# var all_git_commands = game.global_shell.run("git help -a | grep \"^ \\+[a-z-]\\+ \" -o")
# git_commands = Array(all_git_commands.split("\n"))
# for i in range(git_commands.size()):
# git_commands[i] = git_commands[i].strip_edges(true, true)
# git_commands.pop_back()
# var all_git_commands_help = game.global_shell.run("git help -a | grep \" [A-Z].\\+$\" -o")
# git_commands_help = Array(all_git_commands_help.split("\n"))
# for i in range(git_commands_help.size()):
# git_commands_help[i] = git_commands_help[i].strip_edges(true, true)
# git_commands_help.pop_back()
for subcommand in git_commands: for subcommand in git_commands:
git_commands_help.push_back("") git_commands_help.push_back("")
@ -83,16 +63,6 @@ func _input(event):
input.caret_position = idx+1 input.caret_position = idx+1
else: else:
input.text = "" + second_half input.text = "" + second_half
# Not currently used. :)
func description_for_subcommand(subcommand):
var manpage = game.global_shell.run("git help %s || true" % subcommand)
var description_regex = RegEx.new()
description_regex.compile("NAME\\n\\s+[^ ]+ - (.*)\\n")
var regex_match = description_regex.search(manpage)
if regex_match == null:
return "(No description available.)"
return regex_match.get_string(1)
func load_command(id): func load_command(id):
input.text = premade_commands[id] input.text = premade_commands[id]
@ -112,9 +82,7 @@ func send_command(command):
thread.start(self, "run_command_in_a_thread", command) thread.start(self, "run_command_in_a_thread", command)
func send_command_async(command): func send_command_async(command):
#output.text += "$ "+command+"\n"
input.text = "" input.text = ""
#repository.shell.run_async(command)
$TCPServer.send(command+"\n") $TCPServer.send(command+"\n")
func run_command_in_a_thread(command): func run_command_in_a_thread(command):
@ -136,7 +104,6 @@ func run_command_in_a_thread(command):
$Pager.popup() $Pager.popup()
emit_signal("command_done") emit_signal("command_done")
#repository.update_everything()
func receive_output(text): func receive_output(text):
output.text += text output.text += text
@ -175,9 +142,6 @@ func regenerate_completions_menu(new_text):
child.set_text(1, git_commands_help[idx]) child.set_text(1, git_commands_help[idx])
completions.margin_top = -min(filtered_comp.size() * 35 + 10, 210) completions.margin_top = -min(filtered_comp.size() * 35 + 10, 210)
func relevant_subcommands(): func relevant_subcommands():
var result = {} var result = {}

View file

@ -5,7 +5,6 @@
[ext_resource path="res://tcp_server.tscn" type="PackedScene" id=3] [ext_resource path="res://tcp_server.tscn" type="PackedScene" id=3]
[ext_resource path="res://fonts/monospace.tres" type="DynamicFont" id=4] [ext_resource path="res://fonts/monospace.tres" type="DynamicFont" id=4]
[ext_resource path="res://text_editor.tscn" type="PackedScene" id=5] [ext_resource path="res://text_editor.tscn" type="PackedScene" id=5]
[ext_resource path="res://button.gd" type="Script" id=6]
[ext_resource path="res://sounds/buzzer.wav" type="AudioStream" id=7] [ext_resource path="res://sounds/buzzer.wav" type="AudioStream" id=7]
[ext_resource path="res://sounds/typewriter_ding.wav" type="AudioStream" id=8] [ext_resource path="res://sounds/typewriter_ding.wav" type="AudioStream" id=8]
@ -21,6 +20,16 @@ corner_radius_top_right = 10
corner_radius_bottom_right = 10 corner_radius_bottom_right = 10
corner_radius_bottom_left = 10 corner_radius_bottom_left = 10
[sub_resource type="GDScript" id=2]
script/source = "extends Button
func _ready():
pass
func pressed():
$\"../../..\".send_command(text)
"
[node name="Terminal" type="Control"] [node name="Terminal" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -76,21 +85,21 @@ margin_bottom = 1052.0
margin_right = 1920.0 margin_right = 1920.0
margin_bottom = 20.0 margin_bottom = 20.0
text = "git commit --allow-empty -m \"$RANDOM\"" text = "git commit --allow-empty -m \"$RANDOM\""
script = ExtResource( 6 ) script = SubResource( 2 )
[node name="Button2" type="Button" parent="Rows/VBoxContainer"] [node name="Button2" type="Button" parent="Rows/VBoxContainer"]
margin_top = 24.0 margin_top = 24.0
margin_right = 1920.0 margin_right = 1920.0
margin_bottom = 44.0 margin_bottom = 44.0
text = "git checkout HEAD^" text = "git checkout HEAD^"
script = ExtResource( 6 ) script = SubResource( 2 )
[node name="Button3" type="Button" parent="Rows/VBoxContainer"] [node name="Button3" type="Button" parent="Rows/VBoxContainer"]
margin_top = 48.0 margin_top = 48.0
margin_right = 1920.0 margin_right = 1920.0
margin_bottom = 68.0 margin_bottom = 68.0
text = "git checkout -b \"$RANDOM\"" text = "git checkout -b \"$RANDOM\""
script = ExtResource( 6 ) script = SubResource( 2 )
[node name="InputLine" type="HBoxContainer" parent="Rows"] [node name="InputLine" type="HBoxContainer" parent="Rows"]
margin_top = 1056.0 margin_top = 1056.0
@ -106,16 +115,6 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="CommandDropdown" type="MenuButton" parent="Rows/InputLine"]
visible = false
margin_left = 1896.0
margin_right = 1920.0
margin_bottom = 31.0
custom_fonts/font = ExtResource( 1 )
text = "..."
flat = false
align = 0
[node name="ClearButton" type="Button" parent="."] [node name="ClearButton" type="Button" parent="."]
anchor_left = 1.0 anchor_left = 1.0
anchor_right = 1.0 anchor_right = 1.0

12
test.gd
View file

@ -1,12 +0,0 @@
extends Node
func _ready():
pass
func data(s):
print(s)
func send(new_text):
print("sending "+new_text)
$TCPServer.send(new_text)