RetroDECK/tools/configurator/scripts/TabContainer.gd
MonkeyX 61d1aeb88b
Cooker merged with feat/godot (#948)
* Log file refactor

* Log full path?

* Ooops!

* Reftactored logging and threading

* URL

* Desktop Mode

* Hide logo

* Godot Configurator (#940)

* Feat/godot (#929)

* On branch cooker
 Changes to be committed:
	modified:   ../config/retrodeck/reference_lists/features.json
	modified:   configurator.sh
	modified:   configurator/TabContainer.gd
	modified:   configurator/assets/themes/accesible_theme.tres
	modified:   configurator/assets/themes/modern_theme.tres
	modified:   configurator/assets/themes/retro_theme.tres
	modified:   configurator/main.tscn
	modified:   configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* Signal test

* s

* Oops Data Recovery

 On branch cooker
 Changes to be committed:
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* Sliding Rekku

 On branch cooker
 Changes to be committed:
	modified:   tools/configurator/Rekku.gd
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/main.tscn

* Using less tabs?

 On branch cooker
 Changes to be committed:
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* Generic Save experiment
 On branch cooker
 Changes to be committed:
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* Let it flow

 On branch feat/godot
 Changes to be committed:
	new file:   .github/workflows/build-godot.yml
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* On branch feat/godot
 Changes to be committed:
	modified:   .github/workflows/build-godot.yml

* FLow 2.0

* Flow 2.1

* Flow 2.2

* Flow 2.3

* Flow 2.4

* Flow 2.5

* Flow 2.6

* Flow 2.7

* Flow 2.8

* Flow 2.9

* Flow 2.9

* Flow 2.91

* Flow 2.92

* Emualtor==System

* FFS revert!

* Progress on Cores at last!

* Progress on Cores at lastgit add .!

* Functions

* Bios change

* Removed need for BIOS tmp file for Godot

* Rotten the core!

* Push TEst

* fixed duplicate

* fixed duplicate

* Tidied Bios reading

* Rekku assistant

* Icons and System Tab work

* Generic buttons please

* Generic buttons pleases

* Generic buttons please2

* Rekku gets the saw

* Dialogues

* Fixed link to json file

* Feat/godot (#927)

* Tidied parameter code

* Tricky bios dialogue!

* Mini change

* Tidying icons

* And then there were 5!

* Time to Cook

* INITOOL: added

* SET_SETTING_VALUE: edited to use initool

* Revert "SET_SETTING_VALUE: edited to use initool"

This reverts commit b56916c2b0.

* Revert "INITOOL: added"

This reverts commit 127bcdb6cd.

* POST_UPDATE: update_rd_conf to include steam_sync

* INJECT_FRAMEWORK: added force args [skip ci]

* Progress buttons

* Reset!

---------

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

---------

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

* Feedback changes and 16 bit icons

* Launch button change

* On branch feat/godot
 Changes to be committed:
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres
	modified:   tools/configurator/scripts/SystemTab.gd

* On branch feat/godot (#935)

Changes to be committed:
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres
	modified:   tools/configurator/scripts/SystemTab.gd

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

* Log file refactor

* Log full path?

* Ooops!

* Fix for functions wrapper (#937)

* On branch feat/godot
 Changes to be committed:
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres
	modified:   tools/configurator/scripts/SystemTab.gd

* Log file refactor

* Log full path?

* Ooops!

---------

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

* POST_UPDATE: even on PR [skip ci]

* RETRODECK: You know? till now we never quit retrodeck in the end! [skip ci]

* FRAMEWORK: added the possibility to run a game from cli

* RUN_GAME: system name prettyfied

* RUN_GAME: added retroarch cores

* FEATURES: added more launch args

* RUN_GAME: fixed retroarch

* RUN_GAME: various fixes, time up

* FEATURES: fixed libetro with libretro [skip ci]

* RUN_GAME: emulator and system can now be passed as optional arguments

* Reftactored logging and threading

* URL

* Desktop Mode

* Hide logo

---------

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

* Feat/godot (#942)

* Feat/godot (#929)

* On branch cooker
 Changes to be committed:
	modified:   ../config/retrodeck/reference_lists/features.json
	modified:   configurator.sh
	modified:   configurator/TabContainer.gd
	modified:   configurator/assets/themes/accesible_theme.tres
	modified:   configurator/assets/themes/modern_theme.tres
	modified:   configurator/assets/themes/retro_theme.tres
	modified:   configurator/main.tscn
	modified:   configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* Signal test

* s

* Oops Data Recovery

 On branch cooker
 Changes to be committed:
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* Sliding Rekku

 On branch cooker
 Changes to be committed:
	modified:   tools/configurator/Rekku.gd
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/main.tscn

* Using less tabs?

 On branch cooker
 Changes to be committed:
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* Generic Save experiment
 On branch cooker
 Changes to be committed:
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* Let it flow

 On branch feat/godot
 Changes to be committed:
	new file:   .github/workflows/build-godot.yml
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres

* On branch feat/godot
 Changes to be committed:
	modified:   .github/workflows/build-godot.yml

* FLow 2.0

* Flow 2.1

* Flow 2.2

* Flow 2.3

* Flow 2.4

* Flow 2.5

* Flow 2.6

* Flow 2.7

* Flow 2.8

* Flow 2.9

* Flow 2.9

* Flow 2.91

* Flow 2.92

* Emualtor==System

* FFS revert!

* Progress on Cores at last!

* Progress on Cores at lastgit add .!

* Functions

* Bios change

* Removed need for BIOS tmp file for Godot

* Rotten the core!

* Push TEst

* fixed duplicate

* fixed duplicate

* Tidied Bios reading

* Rekku assistant

* Icons and System Tab work

* Generic buttons please

* Generic buttons pleases

* Generic buttons please2

* Rekku gets the saw

* Dialogues

* Fixed link to json file

* Feat/godot (#927)

* Tidied parameter code

* Tricky bios dialogue!

* Mini change

* Tidying icons

* And then there were 5!

* Time to Cook

* INITOOL: added

* SET_SETTING_VALUE: edited to use initool

* Revert "SET_SETTING_VALUE: edited to use initool"

This reverts commit b56916c2b0.

* Revert "INITOOL: added"

This reverts commit 127bcdb6cd.

* POST_UPDATE: update_rd_conf to include steam_sync

* INJECT_FRAMEWORK: added force args [skip ci]

* Progress buttons

* Reset!

---------

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

---------

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

* Feedback changes and 16 bit icons

* Launch button change

* On branch feat/godot
 Changes to be committed:
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres
	modified:   tools/configurator/scripts/SystemTab.gd

* On branch feat/godot (#935)

Changes to be committed:
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres
	modified:   tools/configurator/scripts/SystemTab.gd

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

* Log file refactor

* Log full path?

* Ooops!

* Fix for functions wrapper (#937)

* On branch feat/godot
 Changes to be committed:
	modified:   tools/configurator/main.tscn
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres
	modified:   tools/configurator/scripts/SystemTab.gd

* Log file refactor

* Log full path?

* Ooops!

---------

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

* POST_UPDATE: even on PR [skip ci]

* RETRODECK: You know? till now we never quit retrodeck in the end! [skip ci]

* FRAMEWORK: added the possibility to run a game from cli

* RUN_GAME: system name prettyfied

* RUN_GAME: added retroarch cores

* FEATURES: added more launch args

* RUN_GAME: fixed retroarch

* RUN_GAME: various fixes, time up

* FEATURES: fixed libetro with libretro [skip ci]

* RUN_GAME: emulator and system can now be passed as optional arguments

* Reftactored logging and threading

* URL

* Desktop Mode

* Hide logo

---------

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

* Custom Buttons and firmware

* Gaming Mode?

* Settings

* Sounds

* Backup with progress

* Better buttons?

* cfg parser

* cfg parser update 1

* Beta Global setting

* Tidying Up

* What a state!

* Configs

* Font preferences

* Generic mulitples

* Reset Orange!

* Rage against the machine!

* What a state!

* State <> null

* State != null

* New State?

* Bored state

* Wine state

* Reset RD

* Gloabls TAB

* Pre merge

* Change to layout

* L and R chang. Fix faulty json

* META Rekku

* Dialogue or Dialog?

* Signals

* More Meta

* Fonts in all areas!

* More button fungit add .!

* Rekku says what about me!

---------

Co-authored-by: Rekku <rekku@retrodeck.net>
Co-authored-by: XargonWan <XargonWan@gmail.com>
2024-09-24 10:10:40 +01:00

86 lines
3.6 KiB
GDScript

extends TabContainer
var icon_width: int = 32
@onready var tcount: int = get_tab_count()-2
func _ready():
focusFirstFocusableChild() #grab focus on first element to enable controller focusing
#%TabContainer.add_theme_icon_override("decrement",ResourceLoader.load("res://assets/icons/kenney_input-prompts-pixel-16/Tiles/tile_0797.png"))
#%TabContainer.add_theme_icon_override("decrement_highlight",ResourceLoader.load("res://assets/icons/kenney_input-prompts-pixel-16/Tiles/tile_0763.png"))
#%TabContainer.add_theme_icon_override("increment",ResourceLoader.load("res://assets/icons/kenney_input-prompts-pixel-16/Tiles/tile_0798.png"))
#%TabContainer.add_theme_icon_override("increment_highlight",ResourceLoader.load("res://assets/icons/kenney_input-prompts-pixel-16/Tiles/tile_0764.png"))
if class_functions.font_select !=3:
%TabContainer.add_theme_font_size_override("font_size", class_functions.font_tab_size)
elif class_functions.font_select == 3:
%TabContainer.add_theme_font_size_override("font_size", 15)
else:
%TabContainer.add_theme_font_size_override("font_size", class_functions.font_tab_size)
set_tab_title(0, " GLOBALS ")
set_tab_title(1, " SYSTEM ")
set_tab_title(2, " TOOLS ")
set_tab_title(3, " SETTINGS ")
set_tab_title(4, " ABOUT ")
set_tab_hidden(5, true)
set_tab_icon(0, ResourceLoader.load("res://assets/icons/pixelitos/128/map-globe.png"))
set_tab_icon_max_width(0,icon_width)
set_tab_icon(1, ResourceLoader.load("res://assets/icons/pixelitos/128/preferences-system-windows.png"))
set_tab_icon_max_width(1,icon_width)
set_tab_icon(2, ResourceLoader.load("res://assets/icons/pixelitos/128/utilities-system-monitor.png"))
set_tab_icon_max_width(2,icon_width)
set_tab_icon(3, ResourceLoader.load("res://assets/icons/pixelitos/128/preferences-system-session-services.png"))
set_tab_icon_max_width(3,icon_width)
set_tab_icon(4, ResourceLoader.load("res://assets/icons/pixelitos/128/help-about.png"))
set_tab_icon_max_width(4,icon_width)
connect_focus_signals(self)
%volume_effects_slider.value = class_functions.volume_effects
func connect_focus_signals(node):
for child in node.get_children():
if child is Button:
child.focus_entered.connect(_on_button_focus_entered.bind(child))
child.focus_exited.connect(_on_button_focus_exited.bind())
elif child is Control:
connect_focus_signals(child)
func _on_button_focus_exited() -> void:
%pop_rtl.visible = false
func _on_button_focus_entered(button: Button):
if button and class_functions.sound_effects:
%AudioStreamPlayer2D.volume_db = class_functions.volume_effects
%AudioStreamPlayer2D.play()
if button and class_functions.rekku_state == false and button.has_meta("description"):
%pop_rtl.visible = true
%pop_rtl.text = button.get_meta("description")
elif class_functions.rekku_state == false:
%pop_rtl.visible = true
%pop_rtl.text = "Hey, there's no description"
func _input(event):
if (event.is_action_pressed("next_tab")):
if current_tab == tcount:
current_tab = 0
else:
self.select_next_available()
focusFirstFocusableChild()
if (event.is_action_pressed("previous_tab")):
if current_tab == 0:
current_tab = tcount
else:
self.select_previous_available()
focusFirstFocusableChild()
func focusFirstFocusableChild():
var children = findElements(get_current_tab_control(), "Control")
for n: Control in children:
if (n.focus_mode == FOCUS_ALL):
n.grab_focus.call_deferred()
break
func findElements(node: Node, className: String, result: Array = []) -> Array:
if node.is_class(className):
result.push_back(node)
for child in node.get_children():
result = findElements(child, className, result)
return result