From 2c1eb941dd4dd2328452c9c72814a83cdb7984fd Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Fri, 10 Sep 2021 01:32:54 +0300 Subject: [PATCH] Enable/disable Install button correctly --- scenes/Catapult.tscn | 4 +++- scripts/Catapult.gd | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index f4181ce1..370e319d 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -615,7 +615,8 @@ margin_top = 140.0 margin_right = 769.0 margin_bottom = 169.0 hint_tooltip = "Shows the Debug tab with some testing functions -and enables debug messages in the status pane (useful for troubleshooting)." +and enables debug messages in the status pane +(useful for troubleshooting)." text = "Debug mode" [node name="NumReleases" type="HBoxContainer" parent="Main/Tabs/Settings"] @@ -896,6 +897,7 @@ __meta__ = { } [connection signal="meta_clicked" from="Main/GameInfo/Description" to="." method="_on_Description_meta_clicked"] +[connection signal="tab_changed" from="Main/Tabs" to="." method="_on_Tabs_tab_changed"] [connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Mods" method="_on_Tabs_tab_changed"] [connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Soundpacks" method="_on_Tabs_tab_changed"] [connection signal="item_selected" from="Main/Tabs/Game/Builds/BuildsList" to="." method="_on_BuildsList_item_selected"] diff --git a/scripts/Catapult.gd b/scripts/Catapult.gd index 6913286c..02844b19 100644 --- a/scripts/Catapult.gd +++ b/scripts/Catapult.gd @@ -153,6 +153,11 @@ func _is_selected_game_installed() -> bool: return (game in info) +func _on_Tabs_tab_changed(tab: int) -> void: + + _refresh_currently_installed() + + func _on_GamesList_item_selected(index: int) -> void: match index: @@ -193,6 +198,7 @@ func _on_Releases_done_fetching_releases() -> void: _smart_reenable_controls("disable_while_fetching_releases") reload_builds_list() + _refresh_currently_installed() func _on_ReleaseInstaller_installation_started() -> void: @@ -361,7 +367,8 @@ func _refresh_currently_installed() -> void: btn_install.text = "Update to Selected" btn_play.disabled = false if (list.selected != -1) and (list.selected < len(releases)): - btn_install.disabled = (releases[list.selected]["name"] == info[game]["name"]) + if not _settings.read("update_to_same_build_allowed"): + btn_install.disabled = (releases[list.selected]["name"] == info[game]["name"]) else: btn_install.disabled = true