yagvm/UI/Components/ReleaseItem.gd

48 lines
1.2 KiB
GDScript3
Raw Permalink Normal View History

2023-05-25 11:30:21 +00:00
extends HBoxContainer
class_name ReleaseItem
@onready var version_label: Label = %VersionLabel
@onready var install_button: Button = %InstallButton
@onready var install_templates_button: Button = %InstallTemplatesButton
var version: String
signal install_button_pressed(version)
signal install_templates_button_pressed(version)
2023-05-25 11:30:21 +00:00
func _ready() -> void:
install_button.pressed.connect(func(): install_button_pressed.emit(version))
install_templates_button.pressed.connect(func(): install_templates_button_pressed.emit(version))
2023-05-25 11:30:21 +00:00
func set_version(v: String) -> void:
version = v
version_label.text = "Godot v%s" % v
2023-05-25 11:30:21 +00:00
func set_install_button_disabled(d: bool) -> void:
install_button.disabled = d
func set_templates_button_disabled(d: bool) -> void:
install_templates_button.disabled = d
func _on_version_downloaded(p_version: String) -> void:
if p_version != version:
# this isn't us
return
set_install_button_disabled(true)
ReleasesManager.version_downloaded.disconnect(_on_version_downloaded)
func _on_export_templates_downloaded(p_version: String) -> void:
if p_version != version:
# this isn't us
return
set_templates_button_disabled(true)
ReleasesManager.export_templates_downloaded.disconnect(_on_export_templates_downloaded)