Skip to content

Commit

Permalink
Version 1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Blockyheadman committed Jul 7, 2023
1 parent 0807ce1 commit 21eaaf2
Show file tree
Hide file tree
Showing 11 changed files with 378 additions and 39 deletions.
8 changes: 7 additions & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ _global_script_classes=[ {
"class": "BOSVersionButton",
"language": "GDScript",
"path": "res://scripts/BOSVersionButton.gd"
}, {
"base": "HBoxContainer",
"class": "InstalledAppButton",
"language": "GDScript",
"path": "res://scripts/InstalledAppButton.gd"
} ]
_global_script_class_icons={
"AppWindow": "",
"BOSVersionButton": ""
"BOSVersionButton": "",
"InstalledAppButton": ""
}

[application]
Expand Down
Binary file added resources/textures/Download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions resources/textures/Download.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Download.png-da9ffb85f7b74946aa5a88f7e7b71124.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://resources/textures/Download.png"
dest_files=[ "res://.import/Download.png-da9ffb85f7b74946aa5a88f7e7b71124.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
138 changes: 138 additions & 0 deletions scenes/AppInstaller.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
[gd_scene load_steps=7 format=2]

[ext_resource path="res://resources/fonts/ariblk.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://scripts/AppInstaller.gd" type="Script" id=2]
[ext_resource path="res://resources/presets/GeneralButton.tres" type="Theme" id=4]
[ext_resource path="res://resources/presets/FileDialog.tres" type="Theme" id=5]

[sub_resource type="DynamicFont" id=5]
size = 20
outline_size = 1
font_data = ExtResource( 1 )

[sub_resource type="DynamicFont" id=1]
size = 8
font_data = ExtResource( 1 )

[node name="AppInstaller" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )

[node name="BG" type="ColorRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0.74902, 0.74902, 0.74902, 1 )

[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_left = 0.012
anchor_top = 0.022
anchor_right = 0.987
anchor_bottom = 0.989
margin_left = 0.639999
margin_top = 0.16
margin_right = 0.640015
margin_bottom = -0.0800171
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
margin_right = 1248.0
margin_bottom = 696.0

[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer"]
margin_right = 1248.0
margin_bottom = 665.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer"]
margin_right = 1248.0
margin_bottom = 665.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="TitleCenter" type="CenterContainer" parent="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer"]
margin_right = 1248.0
margin_bottom = 30.0
size_flags_horizontal = 3

[node name="TitleLabel" type="Label" parent="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/TitleCenter"]
margin_left = 498.0
margin_right = 750.0
margin_bottom = 30.0
custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 )
custom_fonts/font = SubResource( 5 )
text = "Trying something new?"

[node name="MainContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer"]
margin_top = 34.0
margin_right = 1248.0
margin_bottom = 104.0
size_flags_horizontal = 3

[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/MainContainer"]
margin_left = 563.0
margin_right = 684.0
margin_bottom = 70.0

[node name="Apps" type="VBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/MainContainer/VBoxContainer"]
margin_right = 121.0
margin_bottom = 58.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="Install" type="Button" parent="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/MainContainer/VBoxContainer/Apps"]
margin_right = 121.0
margin_bottom = 27.0
theme = ExtResource( 4 )
text = "Install App(s)"

[node name="Refresh" type="Button" parent="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/MainContainer/VBoxContainer/Apps"]
margin_top = 31.0
margin_right = 121.0
margin_bottom = 58.0
theme = ExtResource( 4 )
text = "Refresh Apps"

[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/MainContainer/VBoxContainer"]
margin_top = 62.0
margin_right = 121.0
margin_bottom = 66.0

[node name="InstalledApps" type="VBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/MainContainer/VBoxContainer"]
margin_top = 70.0
margin_right = 121.0
margin_bottom = 70.0

[node name="DescriptionLabel" type="Label" parent="MarginContainer/VBoxContainer"]
margin_top = 669.0
margin_right = 1248.0
margin_bottom = 696.0
size_flags_horizontal = 3
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = SubResource( 1 )
text = "BlockyOS App Installer | Blockyheadman
Powered Pridefully by Godot Game Engine"
align = 1
autowrap = true

[node name="AppSelector" type="FileDialog" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -304.0
margin_top = -200.0
margin_right = 300.0
margin_bottom = 200.0
theme = ExtResource( 5 )
window_title = "Set Background Picture"
mode_overrides_title = false
mode = 1
access = 2
filters = PoolStringArray( "*.pck ; App Files" )

[connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/MainContainer/VBoxContainer/Apps/Install" to="." method="_on_Install_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/MainContainer/VBoxContainer/Apps/Refresh" to="." method="_on_Refresh_pressed"]
[connection signal="files_selected" from="AppSelector" to="." method="_on_AppSelector_files_selected"]
19 changes: 15 additions & 4 deletions scenes/Desktop.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]

[ext_resource path="res://resources/textures/Backgrounds/DefaultBackground.png" type="Texture" id=1]
[ext_resource path="res://scripts/Desktop.gd" type="Script" id=2]
[ext_resource path="res://resources/icons/BlockyOS.png" type="Texture" id=3]
[ext_resource path="res://resources/presets/GeneralButton.tres" type="Theme" id=4]
[ext_resource path="res://resources/presets/TransparentBlack.tres" type="StyleBox" id=5]
[ext_resource path="res://resources/textures/Download.png" type="Texture" id=6]
[ext_resource path="res://resources/textures/Settings.png" type="Texture" id=7]
[ext_resource path="res://resources/textures/Update.png" type="Texture" id=8]

Expand Down Expand Up @@ -54,18 +55,27 @@ __meta__ = {
margin_right = 224.0
margin_bottom = 220.0

[node name="UpdateDownloader" type="Button" parent="MenuBar/StartMenu/VBoxContainer"]
[node name="InstallApps" type="Button" parent="MenuBar/StartMenu/VBoxContainer"]
margin_right = 224.0
margin_bottom = 27.0
theme = ExtResource( 4 )
text = "Install Apps"
icon = ExtResource( 6 )
expand_icon = true

[node name="UpdateDownloader" type="Button" parent="MenuBar/StartMenu/VBoxContainer"]
margin_top = 31.0
margin_right = 224.0
margin_bottom = 58.0
theme = ExtResource( 4 )
text = "Update Downloader"
icon = ExtResource( 8 )
expand_icon = true

[node name="UpdateApps" type="Button" parent="MenuBar/StartMenu/VBoxContainer"]
margin_top = 31.0
margin_top = 62.0
margin_right = 224.0
margin_bottom = 58.0
margin_bottom = 89.0
theme = ExtResource( 4 )
text = "Update Apps List"

Expand Down Expand Up @@ -194,6 +204,7 @@ margin_bottom = 89.0
theme = ExtResource( 4 )
text = "[ empty ]"

[connection signal="pressed" from="MenuBar/StartMenu/VBoxContainer/InstallApps" to="." method="_on_InstallApps_pressed"]
[connection signal="pressed" from="MenuBar/StartMenu/VBoxContainer/UpdateDownloader" to="." method="_on_UpdateDownloader_pressed"]
[connection signal="pressed" from="MenuBar/StartMenu/VBoxContainer/UpdateApps" to="." method="_on_UpdateApps_pressed"]
[connection signal="pressed" from="MenuBar/StartMenu/VBoxContainer/Settings" to="." method="_on_Settings_pressed"]
Expand Down
45 changes: 45 additions & 0 deletions scenes/InstalledAppButton.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://scripts/InstalledAppButton.gd" type="Script" id=1]
[ext_resource path="res://resources/presets/GeneralButton.tres" type="Theme" id=2]
[ext_resource path="res://resources/icons/BlockyOS.png" type="Texture" id=3]

[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.160784, 0.160784, 0.160784, 1 )
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
expand_margin_left = 2.0
expand_margin_right = 2.0
expand_margin_top = 2.0
expand_margin_bottom = 2.0

[node name="BOSVersionButton" type="HBoxContainer"]
margin_right = 180.0
margin_bottom = 27.0
script = ExtResource( 1 )

[node name="Icon" type="TextureRect" parent="."]
margin_right = 48.0
margin_bottom = 48.0
rect_min_size = Vector2( 48, 48 )
texture = ExtResource( 3 )
expand = true

[node name="Label" type="Label" parent="."]
margin_left = 52.0
margin_top = 12.0
margin_right = 142.0
margin_bottom = 35.0
custom_styles/normal = SubResource( 1 )
text = "App Name"

[node name="Remove" type="Button" parent="."]
margin_left = 146.0
margin_right = 221.0
margin_bottom = 48.0
theme = ExtResource( 2 )
text = "Remove"

[connection signal="pressed" from="Remove" to="." method="_on_Remove_pressed"]
96 changes: 96 additions & 0 deletions scripts/AppInstaller.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
extends Control

var user_path := OS.get_user_data_dir()
var apps : Array
var app_button = preload("res://scenes/InstalledAppButton.tscn")

onready var installed_apps_list = $MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer/MainContainer/VBoxContainer/InstalledApps

func _ready():
var installed_apps = File.new()
var array_line = 0
installed_apps.open(user_path + "/apps/installed-apps.txt", File.READ)

while installed_apps.get_position() < installed_apps.get_len():
var app_name = installed_apps.get_line()
var app_dir = File.new()
if app_dir.file_exists(user_path + "/apps/" + app_name + ".pck"):
app_dir.close()
apps.append(app_name)
else:
printerr("App doesn't seem to be installed to the system. Redownload the app and retry.")
array_line = array_line + 1
installed_apps.close()

for i in apps.size():
var instance = app_button.instance()
instance.name = apps[i]
print("BUTTON NAME: " + str(instance.name))
instance.get_child(1).text = str(apps[i-1])
instance.connect("RemovePressed", self, "remove_button")
installed_apps_list.add_child(instance, true)

$AppSelector.current_dir = OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS)

func remove_button(button : String):
var rm_file = Directory.new()
rm_file.remove("user://apps/" + button + ".pck")
get_viewport().get_node("Desktop").update_apps()
installed_apps_list.get_node(button).queue_free()
_on_Refresh_pressed()

func _on_Install_pressed():
$AppSelector.popup_centered()

func _on_Refresh_pressed():
apps.clear()

var list : Array = installed_apps_list.get_children()
for i in list.size():
var button : Node = list[i]
button.disconnect("RemovePressed", self, "remove_button")
button.queue_free()
list.clear()

var installed_apps = File.new()
var array_line = 0
installed_apps.open(user_path + "/apps/installed-apps.txt", File.READ)

while installed_apps.get_position() < installed_apps.get_len():
var app_name = installed_apps.get_line()
var app_dir = File.new()
if app_dir.file_exists(user_path + "/apps/" + app_name + ".pck"):
app_dir.close()
apps.append(app_name)
else:
printerr("App doesn't seem to be installed to the system. Redownload the app and retry.")
array_line = array_line + 1
installed_apps.close()

for i in apps.size():
var instance = app_button.instance()
instance.name = apps[i]
print("BUTTON NAME: " + str(instance.name))
instance.get_child(1).text = str(apps[i-1])
instance.connect("RemovePressed", self, "remove_button")
installed_apps_list.add_child(instance, true)

func _on_AppSelector_files_selected(paths : PoolStringArray):
for i in paths:
print(i)
var file_name : String = i
var file_array := file_name.split("/")
file_name = file_array[file_array.size()-1]
file_name.erase(file_name.length()-4, 4)
print(file_name)

var file = File.new()
var new_file = File.new()
file.open(i, File.READ)
new_file.open("user://apps/" + file_name + ".pck", File.WRITE)
while file.get_position() < file.get_len():
new_file.store_64(file.get_64())
file.close()
new_file.close()
get_viewport().get_node("Desktop").update_apps()
_on_Refresh_pressed()
Loading

0 comments on commit 21eaaf2

Please sign in to comment.