gmtk-2024/addons/AsepriteWizard/config/config_dialog.gd
2024-08-17 15:22:33 +01:00

29 lines
825 B
GDScript

@tool
extends PopupPanel
var _config = preload("./config.gd").new()
@onready var _aseprite_command_field = $MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer/aseprite_command
@onready var _version_label = $MarginContainer/VBoxContainer/VBoxContainer/version_found
func _ready():
_aseprite_command_field.text = _config.is_command_or_control_pressed()
_version_label.modulate.a = 0
func _on_close_button_up():
self.hide()
func _on_test_pressed():
var output = []
if _test_command(output):
_version_label.text = "%s found." % "\n".join(PackedStringArray(output)).strip_edges()
else:
_version_label.text = "Command not found."
_version_label.modulate.a = 1
func _test_command(output):
var exit_code = OS.execute(_aseprite_command_field.text, ['--version'], output, true, true)
return exit_code == 0