mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-15 19:04:57 +01:00
Add some shortcut buttons for fun
This commit is contained in:
parent
5161a8563e
commit
8ee7abbc82
4 changed files with 46 additions and 6 deletions
8
command_button.gd
Normal file
8
command_button.gd
Normal file
|
@ -0,0 +1,8 @@
|
|||
extends Button
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
|
||||
func pressed():
|
||||
$"..".send_command(text)
|
15
command_button.tscn
Normal file
15
command_button.tscn
Normal 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"]
|
4
main.gd
4
main.gd
|
@ -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
|
||||
|
|
25
main.tscn
25
main.tscn
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue