Skip to content

Commit

Permalink
Enable/disable Install button correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
qrrk committed Sep 9, 2021
1 parent d607ee8 commit 2c1eb94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scenes/Catapult.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]
Expand Down
9 changes: 8 additions & 1 deletion scripts/Catapult.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 2c1eb94

Please sign in to comment.