mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-01-18 14:55:38 +00:00
Tidying up
On branch feat/godot-configurator Changes to be committed: modified: tools/configurator/main.gd modified: tools/configurator/project.godot modified: tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres modified: tools/configurator/scripts/data_handler.gd deleted: tools/configurator/scripts/save_manager.gd
This commit is contained in:
parent
d20b4dbf5d
commit
a7bbe16884
|
@ -1,6 +1,5 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
var bios_type:int
|
var bios_type:int
|
||||||
var status_code_label: Label
|
var status_code_label: Label
|
||||||
var wrapper_command: String = "../../tools/retrodeck_function_wrapper.sh"
|
var wrapper_command: String = "../../tools/retrodeck_function_wrapper.sh"
|
||||||
|
@ -22,29 +21,9 @@ func _ready():
|
||||||
_get_nodes()
|
_get_nodes()
|
||||||
_connect_signals()
|
_connect_signals()
|
||||||
_play_main_animations()
|
_play_main_animations()
|
||||||
#print(save_manager.data["about_links"]["rd_web"]["name"], " ", save_manager.data["about_links"]["rd_web"]["url"])
|
|
||||||
#print(save_manager.data["emulators"]["mame"]["name"], " ", save_manager.data["emulators"]["mame"]["description"])
|
|
||||||
|
|
||||||
# Populate app_data with some test data
|
data_handler.add_emaultor()
|
||||||
var link = Link.new()
|
|
||||||
link.name = "Example Site"
|
|
||||||
link.url = "https://example.com"
|
|
||||||
link.description = "An example description."
|
|
||||||
app_data.about_links["example_site"] = link
|
|
||||||
|
|
||||||
var emulator = Emulator.new()
|
|
||||||
emulator.name = "Example Emulator"
|
|
||||||
emulator.description = "An example emulator."
|
|
||||||
var option = EmulatorOption.new()
|
|
||||||
option.resettable = true
|
|
||||||
emulator.options.append(option)
|
|
||||||
var property = EmulatorProperty.new()
|
|
||||||
property.standalone = true
|
|
||||||
property.abxy_button_status = false
|
|
||||||
emulator.properties.append(property)
|
|
||||||
app_data.emulators["example_emulator"] = emulator
|
|
||||||
|
|
||||||
data_handler.save_data(app_data)
|
|
||||||
# Example test cases for modifying data
|
# Example test cases for modifying data
|
||||||
data_handler.modify_link("example_site", "Updated Site", "https://updated-example.com", "Updated description.")
|
data_handler.modify_link("example_site", "Updated Site", "https://updated-example.com", "Updated description.")
|
||||||
|
|
||||||
|
@ -61,16 +40,15 @@ func _ready():
|
||||||
|
|
||||||
data_handler.modify_emulator("example_emulator", "Updated Emulator", "Updated description", new_options, new_properties)
|
data_handler.modify_emulator("example_emulator", "Updated Emulator", "Updated description", new_options, new_properties)
|
||||||
|
|
||||||
var app_data = data_handler.load_data()
|
app_data = data_handler.load_data()
|
||||||
if app_data:
|
if app_data:
|
||||||
var website_link = app_data.about_links["rd_web"]
|
var website_link = app_data.about_links["rd_web"]
|
||||||
print (website_link.name,"-",website_link.url,"-",website_link.description)
|
print (website_link.name,"-",website_link.url,"-",website_link.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")
|
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")
|
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)
|
||||||
var file_path = "res://data_list.json"
|
|
||||||
# set current startup tab to match IDE
|
# set current startup tab to match IDE
|
||||||
tab_container.current_tab = 3
|
tab_container.current_tab = 3
|
||||||
#add_child(class_functions) # Needed for threaded results Not need autoload?
|
#add_child(class_functions) # Needed for threaded results Not need autoload?
|
||||||
|
|
|
@ -20,7 +20,6 @@ config/icon="res://icon.svg"
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
class_functions="*res://scripts/class_functions.gd"
|
class_functions="*res://scripts/class_functions.gd"
|
||||||
save_manager="*res://scripts/save_manager.gd"
|
|
||||||
data_handler="*res://scripts/data_handler.gd"
|
data_handler="*res://scripts/data_handler.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -183,3 +183,25 @@ func modify_emulator(key: String, new_name: String, new_description: String, new
|
||||||
print("Emulator modified successfully")
|
print("Emulator modified successfully")
|
||||||
else:
|
else:
|
||||||
print("Emulator not found")
|
print("Emulator not found")
|
||||||
|
|
||||||
|
|
||||||
|
func add_emaultor() -> void:
|
||||||
|
var link = Link.new()
|
||||||
|
link.name = "Example Site"
|
||||||
|
link.url = "https://example.com"
|
||||||
|
link.description = "An example description."
|
||||||
|
app_data.about_links["example_site"] = link
|
||||||
|
|
||||||
|
var emulator = Emulator.new()
|
||||||
|
emulator.name = "Example Emulator"
|
||||||
|
emulator.description = "An example emulator."
|
||||||
|
var option = EmulatorOption.new()
|
||||||
|
option.resettable = true
|
||||||
|
emulator.options.append(option)
|
||||||
|
var property = EmulatorProperty.new()
|
||||||
|
property.standalone = true
|
||||||
|
property.abxy_button_status = false
|
||||||
|
emulator.properties.append(property)
|
||||||
|
app_data.emulators["example_emulator"] = emulator
|
||||||
|
data_handler.save_data(app_data)
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
extends Node
|
|
||||||
|
|
||||||
var json: JSON = JSON.new()
|
|
||||||
#var path: String = "res://data.json"
|
|
||||||
var path: String = "res://data_list.json"
|
|
||||||
|
|
||||||
var data = {}
|
|
||||||
|
|
||||||
func write_json(content):
|
|
||||||
var file = FileAccess.open(path, FileAccess.WRITE)
|
|
||||||
file.store_string(json.stringify(content))
|
|
||||||
file.close()
|
|
||||||
file = null
|
|
||||||
|
|
||||||
func read_json():
|
|
||||||
var file = FileAccess.open(path, FileAccess.READ)
|
|
||||||
var content = json.parse_string(file.get_as_text())
|
|
||||||
if data is Dictionary:
|
|
||||||
return content
|
|
||||||
else:
|
|
||||||
print ("Error")
|
|
||||||
|
|
||||||
func create_new_json_file():
|
|
||||||
var file = FileAccess.open("res://test.json",FileAccess.READ)
|
|
||||||
var content = json.parse_string(file.get_as_text())
|
|
||||||
data = content
|
|
||||||
write_json(content)
|
|
||||||
|
|
||||||
func _ready ():
|
|
||||||
data = read_json()
|
|
Loading…
Reference in a new issue