OverviewFilesCommitsIssuesDocsReleasesPeers

hypergodot commits / 4326811

Move source files, make responsive
4326811390e8aaf126508a87c9d74ecf8397df3c
by mauve <ranger@mauve.moe> · 2021-05-27T03:06:51.000Z

Changed files (6) +2 -195

GatewayRequest.gd +0 -36
……@@ -1,36 +0,0 @@
1extends HTTPRequest
2
3signal loaded_data(data)
4signal loading_data(url)
5signal failed_load(url, error)
6
7# Declare member variables here. Examples:
8# var a = 2
9# var b = "text"
10
11
12# Called when the node enters the scene tree for the first time.
13func _ready():
14 pass # Replace with function body.
15
16
17# Called every frame. 'delta' is the elapsed time since the previous frame.
18#func _process(delta):
19# pass
20
21func requestHyper(url):
22 var toload = url.replace("hyper://", "http://127.0.0.1:4973/hyper/")
23 print("Loading " + toload)
24 request(toload)
25 pass
26
27
28func _on_request_completed(result, response_code, headers, body):
29 print("Result", result)
30 print("Response Code", response_code)
31 if response_code != 200:
32 var message = body.get_string_from_utf8()
33 print("Error message:", message)
34 emit_signal("failed_load", result, message)
35 else: emit_signal("loaded_data", body.get_string_from_utf8())
36 pass # Replace with function body.
HyperLoad.tscn +0 -79
……@@ -1,79 +0,0 @@
1[gd_scene load_steps=5 format=2]
2
3[ext_resource path="res://GatewayRequest.gd" type="Script" id=1]
4[ext_resource path="res://Output.gd" type="Script" id=2]
5[ext_resource path="res://StatusLabel.gd" type="Script" id=3]
6[ext_resource path="res://URLBar.gd" type="Script" id=4]
7
8[node name="Control" type="Control"]
9anchor_right = 1.0
10anchor_bottom = 1.0
11__meta__ = {
12"_edit_use_anchors_": false
13}
14
15[node name="Title" type="Label" parent="."]
16margin_left = 210.512
17margin_top = 29.217
18margin_right = 490.512
19margin_bottom = 43.217
20text = "Enter your `hyper://` URL and press `Load`"
21__meta__ = {
22"_edit_use_anchors_": false
23}
24
25[node name="URLBar" type="LineEdit" parent="."]
26margin_left = 16.0
27margin_top = 68.0
28margin_right = 570.0
29margin_bottom = 92.0
30text = "hyper://blog.mauve.moe/"
31script = ExtResource( 4 )
32__meta__ = {
33"_edit_use_anchors_": false
34}
35
36[node name="LoadButton" type="Button" parent="."]
37margin_left = 585.838
38margin_top = 70.4204
39margin_right = 627.838
40margin_bottom = 90.4204
41text = "Load"
42__meta__ = {
43"_edit_use_anchors_": false
44}
45
46[node name="Output" type="Label" parent="."]
47margin_left = 24.0
48margin_top = 109.0
49margin_right = 639.0
50margin_bottom = 623.0
51autowrap = true
52clip_text = true
53script = ExtResource( 2 )
54__meta__ = {
55"_edit_use_anchors_": false
56}
57
58[node name="StatusLabel" type="Label" parent="."]
59margin_left = 33.2978
60margin_top = 636.226
61margin_right = 73.2978
62margin_bottom = 650.226
63text = "Status: Waiting"
64script = ExtResource( 3 )
65__meta__ = {
66"_edit_use_anchors_": false
67}
68
69[node name="HyperLoad" type="HTTPRequest" parent="."]
70script = ExtResource( 1 )
71
72[connection signal="text_entered" from="URLBar" to="URLBar" method="_on_URLBar_text_entered"]
73[connection signal="url" from="URLBar" to="HyperLoad" method="requestHyper"]
74[connection signal="pressed" from="LoadButton" to="URLBar" method="navigate"]
75[connection signal="failed_load" from="HyperLoad" to="StatusLabel" method="setError"]
76[connection signal="loaded_data" from="HyperLoad" to="StatusLabel" method="setLoaded"]
77[connection signal="loaded_data" from="HyperLoad" to="Output" method="setContent"]
78[connection signal="loading_data" from="HyperLoad" to="StatusLabel" method="setLoadingData"]
79[connection signal="request_completed" from="HyperLoad" to="HyperLoad" method="_on_request_completed"]
Output.gd +0 -21
……@@ -1,21 +0,0 @@
1extends Label
2
3
4# Declare member variables here. Examples:
5# var a = 2
6# var b = "text"
7
8
9# Called when the node enters the scene tree for the first time.
10func _ready():
11 pass # Replace with function body.
12
13
14# Called every frame. 'delta' is the elapsed time since the previous frame.
15#func _process(delta):
16# pass
17
18
19func setContent(data):
20 text = data
21 pass # Replace with function body.
StatusLabel.gd +0 -29
……@@ -1,29 +0,0 @@
1extends Label
2
3
4# Declare member variables here. Examples:
5# var a = 2
6# var b = "text"
7
8
9# Called when the node enters the scene tree for the first time.
10func _ready():
11 pass # Replace with function body.
12
13
14# Called every frame. 'delta' is the elapsed time since the previous frame.
15#func _process(delta):
16# pass
17
18func setLoaded(data):
19 text = "Status: Loaded"
20 pass # Replace with function body.
21
22func setLoading(url):
23 text = "Status: Loading " + url
24 pass # Replace with function body.
25
26
27func setError(url, error):
28 text = "Status: Failed Load" + error
29 pass # Replace with function body.
URLBar.gd +0 -29
……@@ -1,29 +0,0 @@
1extends LineEdit
2
3signal url(url)
4
5# Declare member variables here. Examples:
6# var a = 2
7# var b = "text"
8
9
10# Called when the node enters the scene tree for the first time.
11func _ready():
12 pass # Replace with function body.
13
14
15# Called every frame. 'delta' is the elapsed time since the previous frame.
16#func _process(delta):
17# pass
18
19
20func navigate():
21 var url = text
22 if url.begins_with("hyper://"):
23 emit_signal("url", url)
24 pass # Replace with function body.
25
26
27func _on_URLBar_text_entered(new_text):
28 navigate()
29 pass # Replace with function body.
project.godot +2 -1
……@@ -11,13 +11,14 @@ config_version=4
1111[application]
1212
1313config/name="HyperGodot"
14run/main_scene="res://HyperLoad.tscn"
14run/main_scene="res://src/HyperLoad.tscn"
1515config/icon="res://icon.png"
1616
1717[display]
1818
1919window/size/width=666
2020window/size/height=666
21window/dpi/allow_hidpi=true
2122
2223[physics]
2324