48 lines
1.2 KiB
GDScript
48 lines
1.2 KiB
GDScript
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)
|
|
|
|
|
|
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))
|
|
|
|
|
|
func set_version(v: String) -> void:
|
|
version = v
|
|
version_label.text = "Godot v%s" % v
|
|
|
|
|
|
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)
|