2024-08-29 16:37:17 +00:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
var command: String
|
|
|
|
var parameters: Array
|
2024-09-24 09:10:40 +00:00
|
|
|
@onready var custom_theme: Theme = get_tree().current_scene.custom_theme
|
2024-08-29 16:37:17 +00:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
$".".theme = custom_theme
|
2024-09-01 16:44:16 +00:00
|
|
|
var args = OS.get_cmdline_args()
|
|
|
|
for arg in range(args.size()):
|
2024-09-01 18:49:04 +00:00
|
|
|
if args[arg] == "--title" and arg + 1 < args.size():
|
2024-09-01 16:44:16 +00:00
|
|
|
%title_label.text = args[arg + 1]
|
|
|
|
elif args[arg] == "--content" and arg + 1 < args.size():
|
|
|
|
%content_rtl.text = args[arg + 1]
|
|
|
|
elif args[arg] == "--command" and arg + 1 < args.size():
|
|
|
|
command = args[arg + 1]
|
|
|
|
elif args[arg] == "--parameters" and arg + 1 < args.size():
|
|
|
|
parameters.append(args[arg + 1])
|
|
|
|
elif args[arg] == "--fullscreen" and arg + 1 < args.size():
|
|
|
|
DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_FULLSCREEN)
|
2024-08-29 16:37:17 +00:00
|
|
|
|
2024-09-01 16:44:16 +00:00
|
|
|
func _input(event):
|
2024-08-29 16:37:17 +00:00
|
|
|
if Input.is_action_pressed("back_button"):
|
|
|
|
get_tree().quit()
|
|
|
|
|
|
|
|
func _on_cancel_pressed():
|
2024-10-09 12:30:33 +00:00
|
|
|
class_functions.logger("d", "Exited dialogue")
|
2024-08-29 16:37:17 +00:00
|
|
|
get_tree().quit()
|
|
|
|
|
|
|
|
func _on_ok_button_pressed() -> void:
|
2024-10-09 12:30:33 +00:00
|
|
|
class_functions.logger("d", "Command to run " + command + " " + str(parameters))
|
2024-08-29 16:37:17 +00:00
|
|
|
var result = class_functions.execute_command(command,parameters , false)
|
2024-10-09 12:30:33 +00:00
|
|
|
class_functions.logger("d", "Exit code: " + str(result["exit_code"]))
|
2024-08-29 16:37:17 +00:00
|
|
|
%content_rtl.text = result["output"]
|
2024-10-09 12:30:33 +00:00
|
|
|
#get_tree().quit()
|
|
|
|
|