Added logging as a function.

Added github workflow to build configurator

 On branch feat/godot-configurator
 Changes to be committed:
	new file:   .github/workflows/build-configurator.yml
	new file:   tools/configurator/basic
	modified:   tools/configurator/components/bios_check/bios_check.gd
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres
	modified:   tools/configurator/scripts/class_functions.gd
This commit is contained in:
monkeyx-net 2024-07-28 16:09:37 +01:00
parent 30d87168e7
commit d9731c2ae1
7 changed files with 138 additions and 57 deletions

View file

@ -0,0 +1,40 @@
name: Configurator Build
on:
push:
branches: [feat/godot-uk]
tags:
- "v*-test"
pull_request:
branches: [feat/godot-uk]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.3.0
- name : exportGame
uses: firebelley/godot-export@v5.2.1
with:
cache: true
godot_executable_download_url: https://download.tuxfamily.org/godotengine/4.2.2/Godot_v4.2.2-stable_linux.x86_64.zip
godot_export_templates_download_url: https://download.tuxfamily.org/godotengine/4.2.2/Godot_v4.2.2-stable_export_templates.tpz
relative_project_path: ./tools/rd-config-test
relative_export_path: ./
archive_output: true
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: Linux Configurator
path: /home/runner/work/RetroDECK_UK/RetroDECK_UK/linux.zip
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: Windows Configurator
path: /home/runner/work/RetroDECK_UK/RetroDECK_UK/windows.zip

2
tools/configurator/basic Normal file
View file

@ -0,0 +1,2 @@
[2024-07-28 11:10:38.087] [INFO] Configurator: check_bios_files
[2024-07-28 11:11:04.473] [INFO] Configurator: check_bios_files

View file

@ -3,17 +3,20 @@ extends Control
var classFunctions: ClassFunctions
var file := FileAccess
var bios_tempfile : String
var command: String = "../../tools/retrodeck_function_wrapper.sh"
var console: bool = false
var BIOS_COLUMNS_BASIC := ["BIOS File Name", "System", "Found", "Hash Match", "Description"]
var BIOS_COLUMNS_EXPERT := ["BIOS File Name", "System", "Found", "Hash Match", "Description", "Subdirectory", "Hash"]
@onready var bios_type:int = get_tree().current_scene.bios_type
func _ready():
#Check if XDG_RUNTIME_DIR is set and choose temp file location
if OS.has_environment("XDG_RUNTIME_DIR"):
#bios_tempfile = OS.get_environment("XDG_RUNTIME_DIR") + "/godot_temp/godot_bios_files_checked.tmp"
bios_tempfile = "/var/config/retrodeck/godot/godot_bios_files_checked.tmp"
else:
bios_tempfile = "/var/config/retrodeck/godot_temp/godot_bios_files_checked.tmp"
bios_tempfile = "/var/config/retrodeck/godot/godot_bios_files_checked.tmp"
var table := $Table
classFunctions = ClassFunctions.new()
@ -33,17 +36,18 @@ func _ready():
if bios_type == 0: #Basic BIOS button pressed
#OS.execute("/app/tools/retrodeck_function_wrapper.sh",["check_bios_files", "basic"])
var command = "../../tools/retrodeck_function_wrapper.sh"
var parameters = ["log", "i", "Configurator: " + "check_bios_files"]
var console = false
var result: Dictionary = classFunctions.execute_command(command, parameters, false)
parameters = ["check_bios_files"]
#var parameters = ["log", "i", "Configurator: " + "check_bios_files"]
# classFunctions.execute_command(command, parameters, false)
var parameters = ["check_bios_files","basic"]
#result = classFunctions.execute_command(command, parameters, false)
#threaded
await run_thread_command(command, parameters, console)
else: #Assume advanced BIOS button pressed
OS.execute("/app/tools/retrodeck_function_wrapper.sh",["check_bios_files"])
var parameters = ["check_bios_files"]
classFunctions.execute_command(command, parameters, false)
await run_thread_command(command, parameters, console)
#OS.execute("/app/tools/retrodeck_function_wrapper.sh",["check_bios_files"])
if file.file_exists(bios_tempfile): #File to be removed after script is done
var bios_list := file.open(bios_tempfile, FileAccess.READ)

View file

@ -1,8 +1,18 @@
extends Control
var class_functions: ClassFunctions
var bios_type:int
var status_code_label: Label
var wrapper_command: String = "../../tools/retrodeck_function_wrapper.sh"
var log_text = "GD_Configurator: "
var log_parameters: Array = ["log", "i", log_text]
var log_results: Dictionary
func _ready():
class_functions = ClassFunctions.new()
_get_nodes()
add_child(class_functions) # Needed for threaded results
var children = findElements(self, "Control")
for n: Control in children: #iterate the children
if (n.focus_mode == FOCUS_ALL):
@ -11,6 +21,9 @@ func _ready():
n.self_modulate.a = 0.5 #make it half transparent
combine_tkeys()
func _get_nodes() -> void:
status_code_label = get_node("%status_code_label")
func _input(event):
if event.is_action_pressed("quit"):
_exit()
@ -36,22 +49,27 @@ func _on_quickresume_advanced_pressed():
func _on_bios_button_pressed():
bios_type = 0
log_parameters[2] += "Bios_Check"
log_results = class_functions.execute_command(wrapper_command, log_parameters, false)
load_popup("BIOS File Check", "res://components/bios_check/bios_popup_content.tscn")
status_code_label.text = str(log_results["exit_code"])
func _on_bios_button_expert_pressed():
bios_type = 1
log_parameters[2] += "Advanced_Bios_Check"
log_results = class_functions.execute_command(wrapper_command, log_parameters, false)
load_popup("BIOS File Check", "res://components/bios_check/bios_popup_content.tscn")
status_code_label.text = str(log_results["exit_code"])
func _on_exit_button_pressed():
log_parameters[2] += "Exited"
log_results = class_functions.execute_command(wrapper_command, log_parameters, false)
_exit()
func _exit():
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
get_tree().quit()
func _on_locale_selected(index):
match index:
0:

View file

@ -820,6 +820,23 @@ text = "RetroDECK
v0.8.0b"
scroll_active = false
[node name="status_label" type="Label" parent="Background/side_logo"]
unique_name_in_owner = true
layout_mode = 0
offset_left = -1.0
offset_top = 412.0
offset_right = 106.0
offset_bottom = 453.0
text = "Status:"
[node name="status_code_label" type="Label" parent="Background/side_logo/status_label"]
unique_name_in_owner = true
layout_mode = 0
offset_left = 91.0
offset_top = 2.0
offset_right = 148.0
offset_bottom = 34.0
[node name="exit_button" type="Button" parent="Background"]
layout_mode = 1
anchors_preset = -1

File diff suppressed because one or more lines are too long

View file

@ -11,7 +11,7 @@ func array_to_string(arr: Array) -> String:
func execute_command(command: String, parameters: Array, console: bool) -> Dictionary:
var result = {}
var output = []
var exit_code = OS.execute(command, parameters, output, console)
var exit_code = OS.execute(command, parameters, output, console) ## add if exit == 0 etc
result["output"] = array_to_string(output)
result["exit_code"] = exit_code
return result