RetroDECK/tools/configurator/components/bios_check/bios_check.gd
XargonWan 3dc6b18833
Some checks failed
Build cooker / Building_RetroDECK (push) Has been cancelled
Feat/godot (#962)
* Table top mode

* Button Colour and tables columns

* Bob does regex

* Bob does regex2

* Updates from feedback

* Stuff

* Ensure funnction array being passed correctly

* Array to String needed afterall

* Cooker Test

* Test build

* Fixed Bios display issue

* Fixed dialogue logging

* Full Screen is back

* gGent Orange BIOS

* GDScript Logger POC

* Try to create log folder

* GDScript Logger POC (#956)

* GDScript Logger POC

* Try to create log folder

* Ensure all_systems array is empty every time build_preset_list_options() is run
- This prevents all_systems array from having multiple copies of all systems when run multiple times in the same session, which would cause make_preset_changes() to run build_preset_config() multiple times.

* logs2.0

* Parked up for the night

* Don't truncate the log file

* Timestamp, fix append

* Time for a break

* restore godot logger, default is still bash

* Added real milliseconds to log timestamp (thanks, monkeyx), typing fixes

* Time for a break

* Update godot.yml

* Update godot.yml

* Update godot.yml

* Update godot.yml

* Update godot.yml

* Update godot.yml

* Update godot.yml

* Translations with POT!

* Comment to test PR (#960)

Co-authored-by: Rekku <rekku@retrodeck.net>

---------

Co-authored-by: Rekku <rekku@retrodeck.net>
Co-authored-by: WallK <wallykrasiy@gmail.com>
Co-authored-by: MonkeyX <tim@monkeyx.net>
Co-authored-by: icenine451 <benjamin.r.shelton@protonmail.com>
2024-10-28 02:02:17 +01:00

55 lines
2.4 KiB
GDScript

extends Control
var bios_result: Dictionary
var console: bool = false
var BIOS_COLUMNS_BASIC := ["BIOS File Name", "System", "Found", "Hash\nMatch", "Description"]
var BIOS_COLUMNS_EXPERT := ["BIOS File Name", "System", "Found", "Hash\nMatch", "Description", "Sub\nFolder", "Hash"]
@onready var bios_type:int = get_tree().current_scene.bios_type
@onready var custom_theme: Theme = get_tree().current_scene.custom_theme
func _ready():
#var font_size = get_theme_font_size("font")
#custom_theme.default_font_size = 16
$".".theme = custom_theme
var table: Tree = %Table
if bios_type == 1: #Basic BIOS button pressed
table.columns = BIOS_COLUMNS_BASIC.size()
for i in BIOS_COLUMNS_BASIC.size():
table.set_column_custom_minimum_width(0, 150)
table.set_column_custom_minimum_width(1, 200)
table.set_column_custom_minimum_width(4, 350)
table.set_column_title(i, BIOS_COLUMNS_BASIC[i])
else: #Assume advanced BIOS button pressed
table.columns = BIOS_COLUMNS_EXPERT.size()
for i in BIOS_COLUMNS_EXPERT.size():
table.set_column_custom_minimum_width(0, 170)
table.set_column_custom_minimum_width(1, 200)
table.set_column_custom_minimum_width(4, 325)
table.set_column_custom_minimum_width(6, 225)
table.set_column_title(i, BIOS_COLUMNS_EXPERT[i])
var root = table.create_item()
table.hide_root = true
if bios_type == 1: #Basic BIOS button pressed
var parameters = ["check_bios_files","basic"]
bios_result = await class_functions.run_thread_command(class_functions.wrapper_command, parameters, console)
else: #Assume advanced BIOS button pressed
var parameters = ["check_bios_files"]
bios_result = await class_functions.run_thread_command(class_functions.wrapper_command, parameters, console)
var bios_list = bios_result["output"]
var bios_lines: Array = bios_list.split("\n")
for line in bios_lines:
var bios_line: Array = line.split("^")
var table_line: TreeItem = table.create_item(root)
for i in bios_line.size():
if bios_line.size() >= 5:
if bios_line[2] == "No":
table_line.set_custom_bg_color(i,Color(1,0,0,0.15))
elif bios_line[2] == "Yes" and bios_line[3] == "No":
table_line.set_custom_bg_color(i,Color(1,0.6,0,0.35))
elif bios_line[2] == "Yes":
table_line.set_custom_bg_color(i,Color(0,1,0,0.15))
table_line.set_text(i, bios_line[i])
#if table_line.get_index() % 2 == 1:
#table_line.set_custom_bg_color(i,Color(0.15, 0.15, 0.15, 1),false)
#table_line.set_custom_color(i,Color(1,1,1,1))