From beb5aff71d083d58eda8b09c6aa1b53ea75243fd Mon Sep 17 00:00:00 2001
From: monkeyx-net <tim@monkeyx.net>
Date: Fri, 2 Aug 2024 20:08:14 +0100
Subject: [PATCH]  On branch feat/godot-configurator  Changes to be committed: 
 modified:   tools/configurator/main.gd 	modified:  
 tools/configurator/main.tscn 	modified:  
 tools/configurator/scripts/data_handler.gd 	modified:  
 tools/configurator/tk_about.gd

---
 tools/configurator/main.gd                 | 11 ++-
 tools/configurator/main.tscn               | 78 +---------------------
 tools/configurator/scripts/data_handler.gd |  1 -
 tools/configurator/tk_about.gd             | 54 ++++++---------
 4 files changed, 27 insertions(+), 117 deletions(-)

diff --git a/tools/configurator/main.gd b/tools/configurator/main.gd
index 9658062f..4d9e2c24 100644
--- a/tools/configurator/main.gd
+++ b/tools/configurator/main.gd
@@ -14,7 +14,6 @@ var emu_pick_option: OptionButton
 var tab_container: TabContainer
 var anim_logo: AnimatedSprite2D
 var anim_rekku: AnimatedSprite2D
-#var data_handler: DataHandler
 
 var app_data = AppData.new()
 func _ready():
@@ -27,14 +26,15 @@ func _ready():
 	
 
 	app_data = data_handler.load_data()
+	
 	if app_data:
-		var website_link = app_data.about_links["rd_web"]
-		print (website_link.name,"-",website_link.url,"-",website_link.description)
+		var website_data = app_data.about_links["rd_web"]
+		print (website_data.name,"-",website_data.url,"-",website_data.description)
 	
 	var emulator_list = class_functions.get_text_file_from_system_path("../../tools/configurator.sh","sed -n '/local emulator_list=(/,/)/{s/.*local emulator_list=\\(.*\\)/\\1/; /)/q; p}' ","emulist")
-	print (emulator_list)
+	#print (emulator_list)
 	var abxy_button_list = class_functions.get_text_file_from_system_path("/var/config/retrodeck/retrodeck.cfg","sed -n '/\\[abxy_button_swap\\]/,/^$/p' ","normal")
-	print(abxy_button_list)
+	#print(abxy_button_list)
 	# set current startup tab to match IDE
 	tab_container.current_tab = 3
 	#add_child(class_functions) # Needed for threaded results Not need autoload?
@@ -76,7 +76,6 @@ func _emu_pick(index: int) -> void:
 
 func _play_main_animations() -> void:
 	anim_logo.play()
-	anim_rekku.play()
 
 func _conf_theme(index: int) -> void: 
 	match index:
diff --git a/tools/configurator/main.tscn b/tools/configurator/main.tscn
index 1f5b834b..ff7733db 100644
--- a/tools/configurator/main.tscn
+++ b/tools/configurator/main.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=36 format=3 uid="uid://61f6m4r1mpan"]
+[gd_scene load_steps=26 format=3 uid="uid://61f6m4r1mpan"]
 
 [ext_resource type="Texture2D" uid="uid://bv6vh33cnfaw4" path="res://icon.svg" id="1_axfei"]
 [ext_resource type="Script" path="res://main.gd" id="1_obpq7"]
@@ -19,17 +19,9 @@
 [ext_resource type="Texture2D" uid="uid://bojog0xvms7hr" path="res://assets/graphics/retrodeck_base_shake3.png" id="8_l3t5c"]
 [ext_resource type="Texture2D" uid="uid://bns0ot5pbf03h" path="res://res/flags/sweden_32.png" id="8_lptln"]
 [ext_resource type="Texture2D" uid="uid://uko0ikrtjkj" path="res://assets/graphics/retrodeck_base_shake4.png" id="9_8eqo6"]
-[ext_resource type="Texture2D" uid="uid://cor8ep0fkqm08" path="res://res/Rekku/base.png" id="9_brsrf"]
 [ext_resource type="Texture2D" uid="uid://dhsorn3kcfdcv" path="res://res/flags/ukraine_32.png" id="9_dp7oa"]
 [ext_resource type="Texture2D" uid="uid://dtwjo7co226dw" path="res://res/flags/japan_32.png" id="10_e8mt0"]
-[ext_resource type="Texture2D" uid="uid://cavtn1rljc5oe" path="res://res/Rekku/eyes-open.png" id="10_y6gkh"]
-[ext_resource type="Texture2D" uid="uid://cv7nckloqhn5m" path="res://res/Rekku/blink1.png" id="11_6deod"]
 [ext_resource type="Texture2D" uid="uid://cbwhpqip43aei" path="res://res/flags/china_32.png" id="11_ri2fv"]
-[ext_resource type="Texture2D" uid="uid://by0oj188x350g" path="res://res/Rekku/blink2.png" id="12_ro20g"]
-[ext_resource type="Texture2D" uid="uid://ciwghjy0ahxk6" path="res://res/Rekku/mouth-A.png" id="13_xj3b3"]
-[ext_resource type="Texture2D" uid="uid://kx8eypf4ffvu" path="res://res/Rekku/mouth-base.png" id="14_lnkoa"]
-[ext_resource type="Texture2D" uid="uid://b6gl8sltbak7v" path="res://res/Rekku/mouth-O.png" id="15_1sikj"]
-[ext_resource type="PackedScene" uid="uid://cb4fvsgnwsf4q" path="res://rekku_animated.tscn" id="29_uioq2"]
 
 [sub_resource type="SpriteFrames" id="SpriteFrames_lhf2y"]
 animations = [{
@@ -68,52 +60,6 @@ texture_margin_bottom = 6.0
 region_rect = Rect2(0, 8, 16, 16)
 modulate_color = Color(0.65098, 0.403922, 0.819608, 1)
 
-[sub_resource type="SpriteFrames" id="SpriteFrames_trwmf"]
-animations = [{
-"frames": [{
-"duration": 40.0,
-"texture": ExtResource("10_y6gkh")
-}, {
-"duration": 0.15,
-"texture": ExtResource("11_6deod")
-}, {
-"duration": 0.15,
-"texture": ExtResource("12_ro20g")
-}],
-"loop": true,
-"name": &"blink",
-"speed": 5.0
-}]
-
-[sub_resource type="SpriteFrames" id="SpriteFrames_p8gbs"]
-animations = [{
-"frames": [{
-"duration": 15.0,
-"texture": ExtResource("14_lnkoa")
-}, {
-"duration": 1.0,
-"texture": ExtResource("13_xj3b3")
-}, {
-"duration": 0.5,
-"texture": ExtResource("14_lnkoa")
-}, {
-"duration": 1.0,
-"texture": ExtResource("14_lnkoa")
-}, {
-"duration": 1.0,
-"texture": ExtResource("15_1sikj")
-}, {
-"duration": 1.0,
-"texture": ExtResource("13_xj3b3")
-}, {
-"duration": 1.0,
-"texture": ExtResource("14_lnkoa")
-}],
-"loop": true,
-"name": &"speech",
-"speed": 5.0
-}]
-
 [node name="Control" type="Control"]
 layout_mode = 3
 anchors_preset = 15
@@ -1066,28 +1012,6 @@ This is mot working on the following systems: Switch, WiiU."
 scroll_following = true
 script = ExtResource("5_cprkf")
 
-[node name="rekku_sprite" type="Sprite2D" parent="rekku"]
-position = Vector2(490, -194)
-scale = Vector2(0.292969, 0.292969)
-texture = ExtResource("9_brsrf")
-metadata/_edit_group_ = true
-
-[node name="blink_anim" type="AnimatedSprite2D" parent="rekku/rekku_sprite"]
-sprite_frames = SubResource("SpriteFrames_trwmf")
-animation = &"blink"
-autoplay = "blink"
-frame_progress = 0.299789
-
-[node name="speech_anim" type="AnimatedSprite2D" parent="rekku/rekku_sprite"]
-sprite_frames = SubResource("SpriteFrames_p8gbs")
-animation = &"speech"
-frame_progress = 0.664627
-
-[node name="rekku_animated" parent="." instance=ExtResource("29_uioq2")]
-unique_name_in_owner = true
-position = Vector2(1008.38, 450.938)
-scale = Vector2(0.165283, 0.175903)
-
 [connection signal="pressed" from="Background/MarginContainer/TabContainer/TK_SYSTEM/ScrollContainer/VBoxContainer/game_control_container/GridContainer/quick_resume_adv_button" to="." method="_on_quickresume_advanced_pressed"]
 [connection signal="pressed" from="Background/MarginContainer/TabContainer/TK_TOOLS/ScrollContainer/VBoxContainer/scan_container/bios_button" to="." method="_on_bios_button_pressed"]
 [connection signal="pressed" from="Background/MarginContainer/TabContainer/TK_TOOLS/ScrollContainer/VBoxContainer/scan_container/bios_button_expert" to="." method="_on_bios_button_expert_pressed"]
diff --git a/tools/configurator/scripts/data_handler.gd b/tools/configurator/scripts/data_handler.gd
index 8458daf9..f24fa750 100644
--- a/tools/configurator/scripts/data_handler.gd
+++ b/tools/configurator/scripts/data_handler.gd
@@ -55,7 +55,6 @@ func load_data() -> AppData:
 			var app_data = AppData.new()
 			app_data.about_links = about_links
 			app_data.emulators = emulators
-
 			return app_data
 		else:
 			print("Error parsing JSON")
diff --git a/tools/configurator/tk_about.gd b/tools/configurator/tk_about.gd
index 9aebf9c4..63eefc7f 100644
--- a/tools/configurator/tk_about.gd
+++ b/tools/configurator/tk_about.gd
@@ -9,44 +9,40 @@ var credits_button: Button
 var donate_button: Button
 var contactus_button: Button
 var licenses_button: Button
-var tk_about: Dictionary
+#var tk_about: Dictionary
 signal signal_theme_changed
+var app_data = AppData.new()
 
 func _ready():
-	#class_functions = ClassFunctions.new()
-	#tk_about = class_functions._import_data_lists("res://tk_about.txt")
-	
-	tk_about = class_functions.import_csv_data("res://tk_about.txt")
+	#tk_about = class_functions.import_csv_data("res://tk_about.txt")
+	app_data =  data_handler.load_data()
 	_get_nodes()
 	_connect_signals()
 	
-	for key in tk_about.keys():
-		#print("ID: " + key)
-		#print("URL: " + entry["URL"])
-		#print("Description: " + entry["Description"])
-		var entry = tk_about[key]
-		match key:
+	for id in app_data.about_links:
+		var web_data = app_data.about_links[id]
+		match id:
 			"rd_web":
-				%website_button.tooltip_text = entry["Description"]
-				%website_button.editor_description = entry["URL"] # hackish?
+				%website_button.tooltip_text = web_data.description
+				%website_button.editor_description = web_data.url
 			"rd_changelog":
-				%changelog_button.tooltip_text = entry["Description"]
-				%changelog_button.editor_description = entry["URL"]
+				%changelog_button.tooltip_text = web_data.description
+				%changelog_button.editor_description = web_data.url
 			"rd_wiki":
-				%wiki_button.tooltip_text = entry["Description"]
-				%wiki_button.editor_description = entry["URL"]
+				%wiki_button.tooltip_text = web_data.description
+				%wiki_button.editor_description = web_data.url
 			"rd_credits":
-				%credits_button.tooltip_text = entry["Description"]
-				%credits_button.editor_description = entry["URL"]
+				%credits_button.tooltip_text = web_data.description
+				%credits_button.editor_description = web_data.url
 			"rd_donate":
-				%donate_button.tooltip_text = entry["Description"]
-				%donate_button.editor_description = entry["URL"]
+				%donate_button.tooltip_text = web_data.description
+				%donate_button.editor_description = web_data.url
 			"rd_contactus":
-				%contactus_button.tooltip_text = entry["Description"]
-				%contactus_button.editor_description = entry["URL"]
+				%contactus_button.tooltip_text = web_data.description
+				%contactus_button.editor_description = web_data.url
 			"rd_licenses":
-				%licenses_button.tooltip_text = entry["Description"]
-				%licenses_button.editor_description = entry["URL"]
+				%licenses_button.tooltip_text = web_data.description
+				%licenses_button.editor_description = web_data.url
 
 
 func _get_nodes() -> void:
@@ -69,28 +65,20 @@ func _connect_signals() -> void:
 	licenses_button.pressed.connect(_about_button_pressed.bind("rd_licenses"))
 	
 func _about_button_pressed(id: String) -> void:
-	var entry: Dictionary 
 	match id:
 		"rd_web":
-			entry = tk_about[id] 
 			OS.shell_open(%website_button.editor_description)
 		"rd_changelog":
-			entry = tk_about[id]
 			OS.shell_open(%changelog_button.editor_description)
 		"rd_wiki":
-			entry = tk_about[id]
 			OS.shell_open(%wiki_button.editor_description)
 		"rd_credits":
-			entry = tk_about[id]
 			OS.shell_open(%credits_button.editor_description)
 		"rd_donate":
-			entry = tk_about[id]
 			OS.shell_open(%donate_button.editor_description)
 		"rd_contactus":
-			entry = tk_about[id]
 			OS.shell_open(%contactus_button.editor_description)
 		"rd_licenses":
-			entry = tk_about[id]
 			OS.shell_open(%licenses_button.editor_description)
 		_:
 			print ("ID not found")