Skip to content

Commit cb13687

Browse files
authored
Version 0.3 (#7)
* Update store_info.txt * Update store_info.txt * Update store_info.txt * Add files via upload * Add files via upload
1 parent 6bb94fb commit cb13687

File tree

6 files changed

+47
-24
lines changed

6 files changed

+47
-24
lines changed

Code/VariableStore/src/Extensions/VariableStore/Store/Entry/Entry.gd

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@ extends Panel
77
onready var ext_name = $Panel/HBoxContainer/VBoxContainer/Name
88
onready var ext_discription = $Panel/HBoxContainer/VBoxContainer/Description
99
onready var ext_picture = $Panel/HBoxContainer/Picture
10+
onready var down_button = $Panel/HBoxContainer/VBoxContainer/Download
1011

1112
var extension_container :VBoxContainer
1213
var thumbnail := ""
1314
var download_link := ""
1415
var download_path := ""
16+
var is_update = false # An update instead of download
1517

1618
onready var download_request = $DownloadRequest
1719

1820
func set_info(info: Array, extension_path: String) -> void:
19-
ext_name.text = info[0]
20-
ext_discription.text = info[1]
21-
thumbnail = info[2]
22-
download_link = info[3]
21+
ext_name.text = str(info[0], "-v", info[1]) # Name with version
22+
ext_discription.text = info[2] # Description
23+
thumbnail = info[-2] # Image link
24+
download_link = info[-1] # Download link
25+
2326
var dir := Directory.new()
2427
var _error = dir.make_dir_recursive(str(extension_path,"Download/"))
2528
download_path = str(extension_path,"Download/",info[0],".pck")
29+
set_if_updatable(info[0], info[1])
2630

2731
$RequestDelay.wait_time = randf() * 2 #to prevent sending bulk requests
2832
$RequestDelay.start()
@@ -51,9 +55,21 @@ func _on_ImageRequest_request_completed(_result, _response_code, _headers, body:
5155
ext_picture.texture = texture
5256

5357

54-
func _on_Button_pressed() -> void:
58+
func set_if_updatable(name: String, new_version: float):
59+
for extension in extension_container.extensions.keys():
60+
if extension_container.extensions[extension].file_name == name:
61+
var old_version = str2var(extension_container.extensions[extension].version)
62+
if typeof(old_version) == TYPE_REAL:
63+
if new_version > old_version:
64+
down_button.text = "Update"
65+
is_update == true
66+
elif new_version == old_version:
67+
down_button.text = "Re-Download"
68+
69+
70+
func _on_Download_pressed() -> void:
5571
# Download File
56-
$Panel/HBoxContainer/VBoxContainer/Button.disabled = true
72+
down_button.disabled = true
5773
download_request.download_file = download_path
5874
download_request.request(download_link)
5975

@@ -62,23 +78,26 @@ func _on_DownloadRequest_request_completed(result: int, _response_code, _headers
6278
if result == HTTPRequest.RESULT_SUCCESS:
6379
# Add extension
6480
extension_container.install_extension(download_path)
81+
if is_update:
82+
is_update = false
83+
$Alert/Text.text = str("Update Complete!!\nRestart Pixelorama to take effect").c_unescape()
84+
$Alert.popup_centered()
6585
announce_done(true)
6686
else:
67-
$Error.dialog_text = str("Unable to Download extension...\nHttp Code (",result,")").c_unescape()
68-
$Error.popup_centered()
87+
$Alert/Text.text = str("Unable to Download extension...\nHttp Code (",result,")").c_unescape()
88+
$Alert.popup_centered()
6989
announce_done(false)
7090
var dir := Directory.new()
7191
var _error = dir.remove(download_path)
7292

7393

7494
func announce_done(success: bool):
75-
$Panel/HBoxContainer/VBoxContainer/Button.disabled = false
95+
down_button.disabled = false
96+
down_button.text = "Re-Download"
7697
if success:
7798
$Panel/HBoxContainer/VBoxContainer/Done.visible = true
7899
$DoneDelay.start()
79100

80101

81102
func _on_DoneDelay_timeout() -> void:
82103
$Panel/HBoxContainer/VBoxContainer/Done.visible = false
83-
84-

Code/VariableStore/src/Extensions/VariableStore/Store/Entry/Entry.tscn

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ margin_bottom = 60.0
6767
text = "Done!!!"
6868
align = 1
6969

70-
[node name="Button" type="Button" parent="Panel/HBoxContainer/VBoxContainer"]
70+
[node name="Download" type="Button" parent="Panel/HBoxContainer/VBoxContainer"]
7171
margin_top = 104.0
7272
margin_right = 283.0
7373
margin_bottom = 124.0
@@ -84,11 +84,11 @@ autostart = true
8484
[node name="DoneDelay" type="Timer" parent="."]
8585
wait_time = 2.0
8686

87-
[node name="Error" type="AcceptDialog" parent="."]
87+
[node name="Alert" type="AcceptDialog" parent="."]
8888
margin_right = 242.0
8989
margin_bottom = 84.0
9090

91-
[node name="Text" type="Label" parent="Error"]
91+
[node name="Text" type="Label" parent="Alert"]
9292
anchor_right = 1.0
9393
anchor_bottom = 1.0
9494
margin_left = 8.0
@@ -98,7 +98,7 @@ margin_bottom = -36.0
9898
align = 1
9999
valign = 1
100100

101-
[connection signal="pressed" from="Panel/HBoxContainer/VBoxContainer/Button" to="." method="_on_Button_pressed"]
101+
[connection signal="pressed" from="Panel/HBoxContainer/VBoxContainer/Download" to="." method="_on_Download_pressed"]
102102
[connection signal="timeout" from="RequestDelay" to="." method="_on_RequestDelay_timeout"]
103103
[connection signal="request_completed" from="ImageRequest" to="." method="_on_ImageRequest_request_completed"]
104104
[connection signal="request_completed" from="DownloadRequest" to="." method="_on_DownloadRequest_request_completed"]

Code/VariableStore/src/Extensions/VariableStore/Store/Store.tscn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ margin_bottom = 20.0
88
text = "Variable Store"
99

1010
[node name="Store" type="WindowDialog" parent="."]
11-
visible = true
1211
margin_right = 428.0
1312
margin_bottom = 357.0
1413
rect_min_size = Vector2( 150, 150 )

Code/VariableStore/src/Extensions/VariableStore/extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"display_name": "Extension store by Variable-ind",
44
"description": "Store for Downloading extensions",
55
"author": "Variable",
6-
"version": "0.2",
6+
"version": "0.3",
77
"license": "MIT",
88
"nodes": [
99
"Main.tscn"

Extensions/VariableStore.pck

816 Bytes
Binary file not shown.

store_info.txt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
0.2
2-
# The Number above shows the Version of the store, the info about extensions are stored in ["Name", "Information", "Image", "Download Link"] format
1+
0.3
2+
# The Number above shows the Version of the store, the info about extensions is stored in ["Name", "Version", "Information", "Image", "Download Link"] format
33
["VariableStore", "A Store to download pixelorama extensions!! (Restart Pixelorama after update)", "https://user-images.githubusercontent.com/77773850/164515247-1e11123d-c071-42d4-9b4e-275de492dce6.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/VariableStore.pck"]
4-
["Example", "A Template/Tutorial Extension", "https://user-images.githubusercontent.com/77773850/164516526-227551c5-ca39-4491-b03a-76353f4879a5.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/Example.pck"]
5-
["AverageColor", "Sometimes you need to find average of 2 colors.. this extension does it for you!!", "https://user-images.githubusercontent.com/77773850/163723698-6879ff60-631e-4c4a-bbc1-1e3a8d36a3a0.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/AverageColor.pck"]
6-
["KeyDisplay", "Handy extension to display shortcuts for use in videos", "https://user-images.githubusercontent.com/77773850/163723707-698a74a1-b8d5-401c-bb70-74dc8b6f2e98.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/KeyDisplay.pck"]
7-
["SpritesheetPreview", "Lets you preview your frames as a spritesheet. Now you can immediately move them to the right places", "https://user-images.githubusercontent.com/77773850/164038514-6d741e4a-0ade-4823-8948-ef6917c70a38.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/SpritesheetPreview.pck"]
8-
#["zpix-font-ext", "A new Font for pixelorama from (https://github.com/SolidZORO/zpix-pixel-font)", "https://user-images.githubusercontent.com/77773850/163723711-d7d8520e-56c7-4763-a9a6-1e9dcec5cde8.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/zpix-font-ext.pck"]
4+
5+
["Example", 0.1, "A Template/Tutorial Extension", "https://user-images.githubusercontent.com/77773850/164516526-227551c5-ca39-4491-b03a-76353f4879a5.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/Example.pck"]
6+
7+
["AverageColor", 0.1, "Sometimes you need to find average of 2 colors.. this extension does it for you!!", "https://user-images.githubusercontent.com/77773850/163723698-6879ff60-631e-4c4a-bbc1-1e3a8d36a3a0.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/AverageColor.pck"]
8+
9+
["KeyDisplay", 0.1, "Handy extension to display shortcuts for use in videos", "https://user-images.githubusercontent.com/77773850/163723707-698a74a1-b8d5-401c-bb70-74dc8b6f2e98.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/KeyDisplay.pck"]
10+
11+
["SpritesheetPreview", 0.1, "Lets you preview your frames as a spritesheet. Now you can immediately move them to the right places", "https://user-images.githubusercontent.com/77773850/164038514-6d741e4a-0ade-4823-8948-ef6917c70a38.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/SpritesheetPreview.pck"]
12+
13+
#["zpix-font-ext", 0.1, "A new Font for pixelorama from (https://github.com/SolidZORO/zpix-pixel-font)", "https://user-images.githubusercontent.com/77773850/163723711-d7d8520e-56c7-4763-a9a6-1e9dcec5cde8.png", "https://github.com/Variable-ind/Pixelorama-Extensions/raw/master/Extensions/zpix-font-ext.pck"]

0 commit comments

Comments
 (0)