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
|
|
|
|
|
2023-05-25 20:13:07 +00:00
|
|
|
signal install_button_pressed(version)
|
|
|
|
signal install_templates_button_pressed(version)
|
2023-05-25 11:30:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2023-05-25 20:13:07 +00:00
|
|
|
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
|
2023-05-25 20:13:07 +00:00
|
|
|
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
|
2023-05-25 20:13:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
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)
|