Add some shortcut buttons for fun

This commit is contained in:
Sebastian Morr 2020-09-01 19:45:29 +02:00
parent 5161a8563e
commit 8ee7abbc82
4 changed files with 46 additions and 6 deletions

8
command_button.gd Normal file
View file

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

15
command_button.tscn Normal file
View file

@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://command_button.gd" type="Script" id=1]
[node name="Button" type="Button"]
margin_left = 1418.81
margin_top = 760.827
margin_right = 1672.81
margin_bottom = 780.827
text = "git commit --allow-empty -m \"emtpy\""
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="." to="." method="pressed"]

View file

@ -95,10 +95,10 @@ func _process(delta):
func read_commit_message():
$CommitMessage.show()
$Terminal/Input.editable = false
$CommitMessage.text = game.read_file("/tmp/githydragit/.git/COMMIT_EDITMSG")
$CommitMessage.text = game.read_file($ActiveRepository.path+"/.git/COMMIT_EDITMSG")
func save_commit_message():
game.write_file("/tmp/githydragit/.git/COMMIT_EDITMSG", $CommitMessage.text)
game.write_file($ActiveRepository.path+"/.git/COMMIT_EDITMSG", $CommitMessage.text)
print("disconnect")
client_connection.disconnect_from_host()
$Terminal/Input.editable = true

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://terminal.gd" type="Script" id=1]
[ext_resource path="res://main.gd" type="Script" id=2]
[ext_resource path="res://repository.tscn" type="PackedScene" id=3]
[ext_resource path="res://command_button.tscn" type="PackedScene" id=4]
[node name="Main" type="Node2D"]
script = ExtResource( 2 )
@ -12,10 +13,10 @@ z_index = 1
script = ExtResource( 1 )
[node name="Output" type="TextEdit" parent="Terminal"]
margin_left = 1416.1
margin_left = 1416.0
margin_top = 4.0
margin_right = 1915.1
margin_bottom = 1008.0
margin_right = 1915.0
margin_bottom = 737.0
readonly = true
__meta__ = {
"_edit_use_anchors_": false
@ -30,6 +31,22 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Button" parent="Terminal" instance=ExtResource( 4 )]
[node name="Button2" parent="Terminal" instance=ExtResource( 4 )]
margin_left = 1417.9
margin_top = 801.646
margin_right = 1671.9
margin_bottom = 821.646
text = "git switch -c $RANDOM"
[node name="Button3" parent="Terminal" instance=ExtResource( 4 )]
margin_left = 1417.45
margin_top = 846.547
margin_right = 1671.45
margin_bottom = 866.547
text = "git checkout HEAD^"
[node name="CommitMessage" type="TextEdit" parent="."]
visible = false
margin_left = 889.832