From e0b9de2f1cf773d001c73359eff0f0769c4d598b Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Tue, 14 Dec 2021 16:14:05 -0500 Subject: [PATCH 01/31] Skeleton work --- scenes/Catapult.tscn | 132 ++++++++++++++-------------------------- scenes/Changelog.tscn | 35 +++++++++++ scripts/Catapult.gd | 3 + scripts/Changelogger.gd | 20 ++++++ 4 files changed, 104 insertions(+), 86 deletions(-) create mode 100644 scenes/Changelog.tscn create mode 100644 scripts/Changelogger.gd diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 315fe537..6cbcae50 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -63,12 +63,7 @@ margin_right = 65.0 margin_bottom = 29.0 text = "Game: " -[node name="GamesList" type="OptionButton" parent="Main/GameChoice" groups=[ -"disable_during_mod_operations", -"disable_during_soundpack_operations", -"disable_while_fetching_releases", -"disable_while_installing_game", -]] +[node name="GamesList" type="OptionButton" parent="Main/GameChoice" groups=["disable_during_mod_operations", "disable_during_soundpack_operations", "disable_while_fetching_releases", "disable_while_installing_game"]] margin_left = 71.0 margin_right = 784.0 margin_bottom = 29.0 @@ -119,20 +114,14 @@ margin_top = 91.0 margin_right = 784.0 margin_bottom = 91.0 -[node name="Tabs" type="TabContainer" parent="Main" groups=[ -"disable_during_mod_operations", -"disable_during_soundpack_operations", -"disable_while_fetching_releases", -"disable_while_installing_game", -]] +[node name="Tabs" type="TabContainer" parent="Main" groups=["disable_during_mod_operations", "disable_during_soundpack_operations", "disable_while_fetching_releases", "disable_while_installing_game"]] margin_top = 97.0 margin_right = 784.0 -margin_bottom = 594.0 +margin_bottom = 458.0 tab_align = 0 script = ExtResource( 16 ) [node name="Game" type="VBoxContainer" parent="Main/Tabs"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -155,20 +144,14 @@ margin_top = 35.0 margin_right = 769.0 margin_bottom = 64.0 -[node name="RBtnStable" type="CheckBox" parent="Main/Tabs/Game/Channel/Group" groups=[ -"disable_while_fetching_releases", -"disable_while_installing_game", -]] +[node name="RBtnStable" type="CheckBox" parent="Main/Tabs/Game/Channel/Group" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] margin_right = 81.0 margin_bottom = 29.0 hint_tooltip = "Stable release channel (DDA only)." group = SubResource( 1 ) text = "Stable" -[node name="RBtnExperimental" type="CheckBox" parent="Main/Tabs/Game/Channel/Group" groups=[ -"disable_while_fetching_releases", -"disable_while_installing_game", -]] +[node name="RBtnExperimental" type="CheckBox" parent="Main/Tabs/Game/Channel/Group" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] margin_left = 87.0 margin_right = 221.0 margin_bottom = 29.0 @@ -187,10 +170,7 @@ margin_right = 133.0 margin_bottom = 29.0 text = "Available builds:" -[node name="BuildsList" type="OptionButton" parent="Main/Tabs/Game/Builds" groups=[ -"disable_while_fetching_releases", -"disable_while_installing_game", -]] +[node name="BuildsList" type="OptionButton" parent="Main/Tabs/Game/Builds" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] margin_left = 139.0 margin_right = 687.0 margin_bottom = 29.0 @@ -198,10 +178,7 @@ hint_tooltip = "Choose which release of the game to install or update to." size_flags_horizontal = 3 clip_text = true -[node name="BtnRefresh" type="Button" parent="Main/Tabs/Game/Builds" groups=[ -"disable_while_fetching_releases", -"disable_while_installing_game", -]] +[node name="BtnRefresh" type="Button" parent="Main/Tabs/Game/Builds" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] margin_left = 693.0 margin_right = 769.0 margin_bottom = 29.0 @@ -209,10 +186,7 @@ hint_tooltip = "Re-retrieve the list of available game releases from GitHub (only for experimental releases)." text = "Refresh" -[node name="BtnInstall" type="Button" parent="Main/Tabs/Game" groups=[ -"disable_while_fetching_releases", -"disable_while_installing_game", -]] +[node name="BtnInstall" type="Button" parent="Main/Tabs/Game" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] margin_left = 294.0 margin_top = 109.0 margin_right = 474.0 @@ -225,15 +199,28 @@ text = "Install Selected" icon = ExtResource( 2 ) expand_icon = true -[node name="HSeparator" type="HSeparator" parent="Main/Tabs/Game"] +[node name="BtnChangelog" type="Button" parent="Main/Tabs/Game"] +margin_left = 294.0 margin_top = 149.0 +margin_right = 474.0 +margin_bottom = 181.0 +rect_min_size = Vector2( 180, 32 ) +hint_tooltip = "Use the Github API to view a list of recent changes for the selected game. (Requires an internet connection)" +size_flags_horizontal = 4 +text = "View Recent Changes" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HSeparator" type="HSeparator" parent="Main/Tabs/Game"] +margin_top = 189.0 margin_right = 769.0 -margin_bottom = 157.0 +margin_bottom = 197.0 [node name="CurrentInstall" type="VBoxContainer" parent="Main/Tabs/Game"] -margin_top = 165.0 +margin_top = 205.0 margin_right = 769.0 -margin_bottom = 267.0 +margin_bottom = 307.0 [node name="Label" type="Label" parent="Main/Tabs/Game/CurrentInstall"] margin_right = 769.0 @@ -263,9 +250,7 @@ margin_bottom = 23.0 hint_tooltip = "Open game directory." texture_normal = ExtResource( 25 ) -[node name="BtnPlay" type="Button" parent="Main/Tabs/Game/CurrentInstall" groups=[ -"disable_while_installing_game", -]] +[node name="BtnPlay" type="Button" parent="Main/Tabs/Game/CurrentInstall" groups=["disable_while_installing_game"]] margin_left = 344.0 margin_top = 70.0 margin_right = 424.0 @@ -278,9 +263,9 @@ icon = ExtResource( 3 ) expand_icon = true [node name="Spacer" type="Control" parent="Main/Tabs/Game"] -margin_top = 275.0 +margin_top = 315.0 margin_right = 769.0 -margin_bottom = 275.0 +margin_bottom = 315.0 [node name="Mods" type="VBoxContainer" parent="Main/Tabs"] visible = false @@ -307,9 +292,7 @@ margin_bottom = 29.0 text = "Installed:" align = 1 -[node name="InstalledList" type="ItemList" parent="Main/Tabs/Mods/HBox/Installed" groups=[ -"disable_during_mod_operations", -]] +[node name="InstalledList" type="ItemList" parent="Main/Tabs/Mods/HBox/Installed" groups=["disable_during_mod_operations"]] margin_top = 35.0 margin_right = 374.0 margin_bottom = 235.0 @@ -321,9 +304,7 @@ allow_reselect = true same_column_width = true script = ExtResource( 17 ) -[node name="ShowStock" type="CheckBox" parent="Main/Tabs/Mods/HBox/Installed" groups=[ -"disable_during_mod_operations", -]] +[node name="ShowStock" type="CheckBox" parent="Main/Tabs/Mods/HBox/Installed" groups=["disable_during_mod_operations"]] margin_left = 127.0 margin_top = 241.0 margin_right = 246.0 @@ -332,9 +313,7 @@ hint_tooltip = "Show mods from data/mods on this list." size_flags_horizontal = 4 text = "Show stock" -[node name="BtnDelete" type="Button" parent="Main/Tabs/Mods/HBox/Installed" groups=[ -"disable_during_mod_operations", -]] +[node name="BtnDelete" type="Button" parent="Main/Tabs/Mods/HBox/Installed" groups=["disable_during_mod_operations"]] margin_left = 119.0 margin_top = 276.0 margin_right = 254.0 @@ -361,9 +340,7 @@ margin_bottom = 29.0 text = "Local repository:" align = 1 -[node name="AvailableList" type="ItemList" parent="Main/Tabs/Mods/HBox/Available" groups=[ -"disable_during_mod_operations", -]] +[node name="AvailableList" type="ItemList" parent="Main/Tabs/Mods/HBox/Available" groups=["disable_during_mod_operations"]] margin_top = 35.0 margin_right = 375.0 margin_bottom = 235.0 @@ -375,9 +352,7 @@ allow_reselect = true same_column_width = true script = ExtResource( 17 ) -[node name="ShowInstalled" type="CheckBox" parent="Main/Tabs/Mods/HBox/Available" groups=[ -"disable_during_mod_operations", -]] +[node name="ShowInstalled" type="CheckBox" parent="Main/Tabs/Mods/HBox/Available" groups=["disable_during_mod_operations"]] margin_left = 86.0 margin_top = 241.0 margin_right = 289.0 @@ -393,9 +368,7 @@ margin_right = 375.0 margin_bottom = 305.0 alignment = 1 -[node name="BtnAddSelectedMod" type="Button" parent="Main/Tabs/Mods/HBox/Available/VBox" groups=[ -"disable_during_mod_operations", -]] +[node name="BtnAddSelectedMod" type="Button" parent="Main/Tabs/Mods/HBox/Available/VBox" groups=["disable_during_mod_operations"]] margin_left = 91.0 margin_right = 207.0 margin_bottom = 29.0 @@ -403,18 +376,14 @@ hint_tooltip = "Add selected mods to your game installation." size_flags_horizontal = 4 text = "Add Selected" -[node name="BtnAddAllMods" type="Button" parent="Main/Tabs/Mods/HBox/Available/VBox" groups=[ -"disable_during_mod_operations", -]] +[node name="BtnAddAllMods" type="Button" parent="Main/Tabs/Mods/HBox/Available/VBox" groups=["disable_during_mod_operations"]] margin_left = 213.0 margin_right = 283.0 margin_bottom = 29.0 hint_tooltip = "Add all listed mods to your game installation." text = "Add All" -[node name="BtnDownloadKenan" type="Button" parent="Main/Tabs/Mods/HBox/Available" groups=[ -"disable_during_mod_operations", -]] +[node name="BtnDownloadKenan" type="Button" parent="Main/Tabs/Mods/HBox/Available" groups=["disable_during_mod_operations"]] margin_left = 102.0 margin_top = 311.0 margin_right = 272.0 @@ -434,11 +403,11 @@ margin_right = 769.0 margin_bottom = 480.0 rect_min_size = Vector2( 0, 120 ) focus_mode = 2 +custom_constants/line_separation = 4 custom_fonts/bold_italics_font = ExtResource( 24 ) custom_fonts/italics_font = ExtResource( 23 ) custom_fonts/bold_font = ExtResource( 22 ) custom_fonts/normal_font = ExtResource( 7 ) -custom_constants/line_separation = 4 bbcode_enabled = true bbcode_text = "Mod info will appear here." text = "Mod info will appear here." @@ -485,9 +454,7 @@ margin_bottom = 29.0 text = "Installed:" align = 1 -[node name="InstalledList" type="ItemList" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=[ -"disable_during_soundpack_operations", -]] +[node name="InstalledList" type="ItemList" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=["disable_during_soundpack_operations"]] margin_top = 35.0 margin_right = 374.0 margin_bottom = 235.0 @@ -497,9 +464,7 @@ items = [ "Item 0", null, false, "Item 1", null, false, "Item 2", null, false, " same_column_width = true script = ExtResource( 17 ) -[node name="ShowStock" type="CheckBox" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=[ -"disable_during_soundpack_operations", -]] +[node name="ShowStock" type="CheckBox" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=["disable_during_soundpack_operations"]] margin_left = 127.0 margin_top = 241.0 margin_right = 246.0 @@ -508,9 +473,7 @@ hint_tooltip = "Show soundpacks from data/sound on the list." size_flags_horizontal = 4 text = "Show stock" -[node name="BtnDelete" type="Button" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=[ -"disable_during_soundpack_operations", -]] +[node name="BtnDelete" type="Button" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=["disable_during_soundpack_operations"]] margin_left = 119.0 margin_top = 276.0 margin_right = 254.0 @@ -537,9 +500,7 @@ margin_bottom = 29.0 text = "Downloadable:" align = 1 -[node name="AvailableList" type="ItemList" parent="Main/Tabs/Soundpacks/HBox/Downloadable" groups=[ -"disable_during_soundpack_operations", -]] +[node name="AvailableList" type="ItemList" parent="Main/Tabs/Soundpacks/HBox/Downloadable" groups=["disable_during_soundpack_operations"]] margin_top = 35.0 margin_right = 375.0 margin_bottom = 235.0 @@ -549,9 +510,7 @@ items = [ "Item 0", null, false, "Item 1", null, false, "Item 2", null, false, " same_column_width = true script = ExtResource( 17 ) -[node name="BtnInstall" type="Button" parent="Main/Tabs/Soundpacks/HBox/Downloadable" groups=[ -"disable_during_soundpack_operations", -]] +[node name="BtnInstall" type="Button" parent="Main/Tabs/Soundpacks/HBox/Downloadable" groups=["disable_during_soundpack_operations"]] margin_left = 122.0 margin_top = 241.0 margin_right = 253.0 @@ -587,8 +546,8 @@ window_title = "Open a File" mode = 0 access = 2 filters = PoolStringArray( "*.zip" ) -current_dir = "/mnt/data/Godot/Catapult/Project" -current_path = "/mnt/data/Godot/Catapult/Project/" +current_dir = "/Catapult" +current_path = "/Catapult/" [node name="Fonts" type="VBoxContainer" parent="Main/Tabs"] visible = false @@ -871,6 +830,7 @@ margin_right = 769.0 margin_bottom = 539.0 [node name="Settings" type="VBoxContainer" parent="Main/Tabs"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -1164,7 +1124,7 @@ size_flags_horizontal = 4 text = "Test path resolution in PathHelper" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 600.0 +margin_top = 464.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 diff --git a/scenes/Changelog.tscn b/scenes/Changelog.tscn new file mode 100644 index 00000000..e91cd6bc --- /dev/null +++ b/scenes/Changelog.tscn @@ -0,0 +1,35 @@ +[gd_scene format=2] + +[node name="Panel" type="Panel"] +margin_right = 640.0 +margin_bottom = 480.0 +rect_min_size = Vector2( 640, 480 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="RichTextLabel" type="RichTextLabel" parent="."] +margin_left = 16.0 +margin_top = 16.0 +margin_right = 624.0 +margin_bottom = 400.0 +rect_min_size = Vector2( 608, 384 ) +bbcode_enabled = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Button" type="Button" parent="."] +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = -41.0 +margin_top = -58.0 +margin_right = 41.0 +margin_bottom = -21.0 +size_flags_horizontal = 4 +text = "Close" +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/scripts/Catapult.gd b/scripts/Catapult.gd index 134dee2a..8d82cdfe 100644 --- a/scripts/Catapult.gd +++ b/scripts/Catapult.gd @@ -22,6 +22,7 @@ onready var _tabs = $Main/Tabs onready var _mods = $Mods onready var _releases = $Releases onready var _fshelper = $FSHelper +onready var _changelogger = $Changelogger onready var _installer = $ReleaseInstaller onready var _btn_install = $Main/Tabs/Game/BtnInstall onready var _btn_refresh = $Main/Tabs/Game/Builds/BtnRefresh @@ -304,6 +305,8 @@ func _on_BtnInstall_pressed() -> void: var update = _settings.read("game") in _inst_probe.probe_installed_games() _installer.install_release(release, _settings.read("game"), update) +func _on_BtnChangelog_pressed() -> void: + var changesToCheck = _settings.read("game") func _get_release_key() -> String: # Compiles a string looking like "dda-stable" or "bn-experimental" diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd new file mode 100644 index 00000000..39cc012b --- /dev/null +++ b/scripts/Changelogger.gd @@ -0,0 +1,20 @@ +extends Node + + +onready var _settings = $"/root/SettingsManager" + +# Called when the node enters the scene tree for the first time. +func _ready(): + var game = _settings.read("game") + OS.set_window_title("Recent changes made to") + _log.text = "" + + var welcome_msg = "Welcome to Catapult!" + if _settings.read("print_tips_of_the_day"): + welcome_msg += "\n\n[u]Tip of the day:[/u]\n" + _totd.get_tip() + "\n" + print_msg(welcome_msg) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass From 2488ad179bb9965bd27317f3e8d879b274aac408 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Tue, 14 Dec 2021 16:55:30 -0500 Subject: [PATCH 02/31] More skeleton work --- fonts/OpenSans-Regular.tres | 1 + scenes/Catapult.tscn | 48 +++++++++++++++++++++++++++++-------- scenes/Changelog.tscn | 5 +++- scripts/Catapult.gd | 10 +++++++- scripts/Changelogger.gd | 7 ------ 5 files changed, 52 insertions(+), 19 deletions(-) diff --git a/fonts/OpenSans-Regular.tres b/fonts/OpenSans-Regular.tres index 14565f2f..ee88fd8b 100644 --- a/fonts/OpenSans-Regular.tres +++ b/fonts/OpenSans-Regular.tres @@ -3,6 +3,7 @@ [ext_resource path="res://fonts/OpenSans-Regular.ttf" type="DynamicFontData" id=1] [resource] +size = 10 extra_spacing_top = -3 extra_spacing_bottom = -3 font_data = ExtResource( 1 ) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 6cbcae50..8cef7435 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -76,17 +76,16 @@ selected = 0 [node name="GameInfo" type="HBoxContainer" parent="Main"] margin_top = 35.0 margin_right = 784.0 -margin_bottom = 85.0 +margin_bottom = 67.0 custom_constants/separation = 8 [node name="Spacer" type="Control" parent="Main/GameInfo"] -margin_bottom = 50.0 +margin_bottom = 32.0 [node name="Icon" type="TextureRect" parent="Main/GameInfo"] margin_left = 8.0 -margin_top = 9.0 margin_right = 40.0 -margin_bottom = 41.0 +margin_bottom = 32.0 rect_min_size = Vector2( 32, 32 ) size_flags_horizontal = 4 size_flags_vertical = 4 @@ -97,7 +96,7 @@ stretch_mode = 6 [node name="Description" type="RichTextLabel" parent="Main/GameInfo"] margin_left = 48.0 margin_right = 784.0 -margin_bottom = 50.0 +margin_bottom = 31.0 size_flags_horizontal = 3 size_flags_vertical = 4 custom_fonts/bold_italics_font = ExtResource( 24 ) @@ -110,14 +109,14 @@ text = "Game Title is a game in which... and other stuff about the game. This is fit_content_height = true [node name="Spacer" type="Control" parent="Main"] -margin_top = 91.0 +margin_top = 73.0 margin_right = 784.0 -margin_bottom = 91.0 +margin_bottom = 73.0 [node name="Tabs" type="TabContainer" parent="Main" groups=["disable_during_mod_operations", "disable_during_soundpack_operations", "disable_while_fetching_releases", "disable_while_installing_game"]] -margin_top = 97.0 +margin_top = 79.0 margin_right = 784.0 -margin_bottom = 458.0 +margin_bottom = 440.0 tab_align = 0 script = ExtResource( 16 ) @@ -1124,7 +1123,7 @@ size_flags_horizontal = 4 text = "Test path resolution in PathHelper" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 464.0 +margin_top = 446.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 @@ -1198,6 +1197,33 @@ __meta__ = { "_editor_description_": "The centralized location for all path resolutions in the launcher." } +[node name="ChangelogPopup" type="PopupDialog" parent="."] +visible = true +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -240.0 +margin_top = -160.0 +margin_right = 240.0 +margin_bottom = 160.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="BtnCloseChangelog" type="Button" parent="ChangelogPopup"] +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = -55.5 +margin_top = -32.0 +margin_right = 55.5 +text = "Close" +__meta__ = { +"_edit_use_anchors_": false +} + [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"] @@ -1206,6 +1232,7 @@ __meta__ = { [connection signal="item_selected" from="Main/Tabs/Game/Builds/BuildsList" to="." method="_on_BuildsList_item_selected"] [connection signal="pressed" from="Main/Tabs/Game/Builds/BtnRefresh" to="." method="_on_BtnRefresh_pressed"] [connection signal="pressed" from="Main/Tabs/Game/BtnInstall" to="." method="_on_BtnInstall_pressed"] +[connection signal="pressed" from="Main/Tabs/Game/BtnChangelog" to="." method="_on_BtnChangelog_pressed"] [connection signal="pressed" from="Main/Tabs/Game/CurrentInstall/Build/GameDir" to="." method="_on_GameDir_pressed"] [connection signal="pressed" from="Main/Tabs/Game/CurrentInstall/BtnPlay" to="." method="_on_BtnPlay_pressed"] [connection signal="status_message" from="Main/Tabs/Mods" to="." method="_on_status_message"] @@ -1293,3 +1320,4 @@ __meta__ = { [connection signal="status_message" from="Sound" to="." method="_on_status_message"] [connection signal="status_message" from="Fonts" to="." method="_on_status_message"] [connection signal="status_message" from="PathHelper" to="." method="_on_status_message"] +[connection signal="pressed" from="ChangelogPopup/BtnCloseChangelog" to="." method="_on_BtnCloseChangelog_pressed"] diff --git a/scenes/Changelog.tscn b/scenes/Changelog.tscn index e91cd6bc..e7906d71 100644 --- a/scenes/Changelog.tscn +++ b/scenes/Changelog.tscn @@ -1,4 +1,6 @@ -[gd_scene format=2] +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://fonts/OpenSans-Regular.tres" type="DynamicFont" id=1] [node name="Panel" type="Panel"] margin_right = 640.0 @@ -14,6 +16,7 @@ margin_top = 16.0 margin_right = 624.0 margin_bottom = 400.0 rect_min_size = Vector2( 608, 384 ) +custom_fonts/mono_font = ExtResource( 1 ) bbcode_enabled = true __meta__ = { "_edit_use_anchors_": false diff --git a/scripts/Catapult.gd b/scripts/Catapult.gd index 8d82cdfe..1f9eece9 100644 --- a/scripts/Catapult.gd +++ b/scripts/Catapult.gd @@ -22,10 +22,10 @@ onready var _tabs = $Main/Tabs onready var _mods = $Mods onready var _releases = $Releases onready var _fshelper = $FSHelper -onready var _changelogger = $Changelogger onready var _installer = $ReleaseInstaller onready var _btn_install = $Main/Tabs/Game/BtnInstall onready var _btn_refresh = $Main/Tabs/Game/Builds/BtnRefresh +onready var _btn_changelog = $Main/Tabs/Game/BtnChangelog onready var _btn_game_dir = $Main/Tabs/Game/CurrentInstall/Build/GameDir onready var _btn_play = $Main/Tabs/Game/CurrentInstall/BtnPlay onready var _lst_builds = $Main/Tabs/Game/Builds/BuildsList @@ -307,6 +307,11 @@ func _on_BtnInstall_pressed() -> void: func _on_BtnChangelog_pressed() -> void: var changesToCheck = _settings.read("game") + var _changelogger = $Changelogger + $ChangelogPopup.popup() + +func _on_BtnCloseChangelog_pressed(): + $ChangelogPanel.hide() func _get_release_key() -> String: # Compiles a string looking like "dda-stable" or "bn-experimental" @@ -369,8 +374,11 @@ func apply_game_choice() -> void: if channel == "stable": _rbtn_stable.pressed = true _btn_refresh.disabled = true + _btn_changelog.disabled = true else: _btn_refresh.disabled = false + _btn_changelog.disabled = false + "bn": _lst_games.select(1) _rbtn_exper.pressed = true diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 39cc012b..99c4c642 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -6,13 +6,6 @@ onready var _settings = $"/root/SettingsManager" # Called when the node enters the scene tree for the first time. func _ready(): var game = _settings.read("game") - OS.set_window_title("Recent changes made to") - _log.text = "" - - var welcome_msg = "Welcome to Catapult!" - if _settings.read("print_tips_of_the_day"): - welcome_msg += "\n\n[u]Tip of the day:[/u]\n" + _totd.get_tip() + "\n" - print_msg(welcome_msg) # Called every frame. 'delta' is the elapsed time since the previous frame. From e914e8bf1d017b3e62a633380fb0fdb4032c332a Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Tue, 14 Dec 2021 17:09:17 -0500 Subject: [PATCH 03/31] I have absolutely no idea what I am doing. --- scenes/Catapult.tscn | 28 ++++++++++++++++++++++++++-- scripts/Catapult.gd | 2 +- scripts/Changelogger.gd | 1 - 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 8cef7435..85683cad 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=33 format=2] +[gd_scene load_steps=34 format=2] [ext_resource path="res://icons/info.svg" type="Texture" id=1] [ext_resource path="res://icons/download.svg" type="Texture" id=2] @@ -31,6 +31,7 @@ [ext_resource path="res://scenes/FontSizeHelpDialog.tscn" type="PackedScene" id=29] [ext_resource path="res://icons/help.svg" type="Texture" id=30] [ext_resource path="res://scripts/PathHelper.gd" type="Script" id=31] +[ext_resource path="res://scripts/Changelogger.gd" type="Script" id=32] [sub_resource type="ButtonGroup" id=1] @@ -1217,13 +1218,36 @@ anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 margin_left = -55.5 -margin_top = -32.0 +margin_top = -36.0 margin_right = 55.5 +margin_bottom = -4.0 text = "Close" __meta__ = { "_edit_use_anchors_": false } +[node name="ChangelogText" type="RichTextLabel" parent="ChangelogPopup"] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -240.0 +margin_right = 240.0 +margin_bottom = 280.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/mono_font = ExtResource( 7 ) +bbcode_enabled = true +text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Changelogger" type="Node" parent="ChangelogPopup"] +script = ExtResource( 32 ) + +[node name="DDAPullRequests" type="HTTPRequest" parent="ChangelogPopup"] + +[node name="BNPullRequests" type="HTTPRequest" parent="ChangelogPopup"] + [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"] diff --git a/scripts/Catapult.gd b/scripts/Catapult.gd index 1f9eece9..5d676ecc 100644 --- a/scripts/Catapult.gd +++ b/scripts/Catapult.gd @@ -311,7 +311,7 @@ func _on_BtnChangelog_pressed() -> void: $ChangelogPopup.popup() func _on_BtnCloseChangelog_pressed(): - $ChangelogPanel.hide() + $ChangelogPopup.hide() func _get_release_key() -> String: # Compiles a string looking like "dda-stable" or "bn-experimental" diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 99c4c642..4ead485d 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -1,6 +1,5 @@ extends Node - onready var _settings = $"/root/SettingsManager" # Called when the node enters the scene tree for the first time. From 934c802011464ec3cfaac28fda0a515b280940e6 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Tue, 14 Dec 2021 17:34:55 -0500 Subject: [PATCH 04/31] More stuff Hey, I got the API calls working! --- scenes/Catapult.tscn | 6 ++++-- scripts/Catapult.gd | 4 ++-- scripts/Changelogger.gd | 21 ++++++++++++++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 85683cad..46094d8f 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -1244,9 +1244,9 @@ __meta__ = { [node name="Changelogger" type="Node" parent="ChangelogPopup"] script = ExtResource( 32 ) -[node name="DDAPullRequests" type="HTTPRequest" parent="ChangelogPopup"] +[node name="DDAPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] -[node name="BNPullRequests" type="HTTPRequest" parent="ChangelogPopup"] +[node name="BNPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] [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"] @@ -1345,3 +1345,5 @@ script = ExtResource( 32 ) [connection signal="status_message" from="Fonts" to="." method="_on_status_message"] [connection signal="status_message" from="PathHelper" to="." method="_on_status_message"] [connection signal="pressed" from="ChangelogPopup/BtnCloseChangelog" to="." method="_on_BtnCloseChangelog_pressed"] +[connection signal="request_completed" from="ChangelogPopup/Changelogger/DDAPullRequests" to="ChangelogPopup/Changelogger" method="_on_DDAPullRequests_request_completed"] +[connection signal="request_completed" from="ChangelogPopup/Changelogger/BNPullRequests" to="ChangelogPopup/Changelogger" method="_on_BNPullRequests_request_completed"] diff --git a/scripts/Catapult.gd b/scripts/Catapult.gd index 5d676ecc..9ff7fc86 100644 --- a/scripts/Catapult.gd +++ b/scripts/Catapult.gd @@ -33,7 +33,7 @@ onready var _lst_games = $Main/GameChoice/GamesList onready var _rbtn_stable = $Main/Tabs/Game/Channel/Group/RBtnStable onready var _rbtn_exper = $Main/Tabs/Game/Channel/Group/RBtnExperimental onready var _lbl_build = $Main/Tabs/Game/CurrentInstall/Build/Name - +onready var _changelogger = $ChangelogPopup/Changelogger var _disable_savestate = {} var _ui_staring_sizes = {} # For UI scaling on the fly @@ -307,8 +307,8 @@ func _on_BtnInstall_pressed() -> void: func _on_BtnChangelog_pressed() -> void: var changesToCheck = _settings.read("game") - var _changelogger = $Changelogger $ChangelogPopup.popup() + _changelogger.download_pull_requests() func _on_BtnCloseChangelog_pressed(): $ChangelogPopup.hide() diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 4ead485d..01ee04d4 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -1,12 +1,31 @@ extends Node onready var _settings = $"/root/SettingsManager" +onready var _ddaPullRequest = $DDAPullRequests +onready var _bnPullRequest = $BNPullRequests + +var _ddaPRUrl = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100&page=" +var _bnPRUrl = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100&page=" + +var _ddaPRData = null +var _bnPRData = null # Called when the node enters the scene tree for the first time. func _ready(): - var game = _settings.read("game") + pass +func download_pull_requests(): + _ddaPullRequest.request(_ddaPRUrl + str(1),["user-agent: GodotApp"]) + _bnPullRequest.request(_bnPRUrl + str(1),["user-agent: GodotApp"]) # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass + + +func _on_DDAPullRequests_request_completed(result, response_code, headers, body): + print(parse_json(body.get_string_from_utf8())) + + +func _on_BNPullRequests_request_completed(result, response_code, headers, body): + print(parse_json(body.get_string_from_utf8())) From 49c040ce53df78db76ce64f7590de5b2b31632f4 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Tue, 14 Dec 2021 17:46:09 -0500 Subject: [PATCH 05/31] Put the raw download in the text box Don't hit the rate limit you dummy! --- scenes/Catapult.tscn | 31 ++++++++++++++++--------------- scenes/ChangelogPopup.gd | 16 ++++++++++++++++ scripts/Changelogger.gd | 3 ++- 3 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 scenes/ChangelogPopup.gd diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 46094d8f..e774878b 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=34 format=2] +[gd_scene load_steps=35 format=2] [ext_resource path="res://icons/info.svg" type="Texture" id=1] [ext_resource path="res://icons/download.svg" type="Texture" id=2] @@ -32,6 +32,7 @@ [ext_resource path="res://icons/help.svg" type="Texture" id=30] [ext_resource path="res://scripts/PathHelper.gd" type="Script" id=31] [ext_resource path="res://scripts/Changelogger.gd" type="Script" id=32] +[ext_resource path="res://scenes/ChangelogPopup.gd" type="Script" id=33] [sub_resource type="ButtonGroup" id=1] @@ -1070,13 +1071,13 @@ autowrap = true [node name="Button" type="Button" parent="Main/Tabs/Debug"] margin_left = 273.0 margin_top = 56.0 -margin_right = 496.0 +margin_right = 495.0 margin_bottom = 85.0 size_flags_horizontal = 6 text = "Test mod directory parsing" [node name="Button2" type="Button" parent="Main/Tabs/Debug"] -margin_left = 266.0 +margin_left = 267.0 margin_top = 91.0 margin_right = 502.0 margin_bottom = 120.0 @@ -1084,7 +1085,7 @@ size_flags_horizontal = 6 text = "Test sound directory parsing" [node name="Button3" type="Button" parent="Main/Tabs/Debug"] -margin_left = 201.0 +margin_left = 202.0 margin_top = 126.0 margin_right = 567.0 margin_bottom = 155.0 @@ -1094,13 +1095,13 @@ text = "Test passing of arguments to shell commands" [node name="Button4" type="Button" parent="Main/Tabs/Debug"] margin_left = 228.0 margin_top = 161.0 -margin_right = 541.0 +margin_right = 540.0 margin_bottom = 190.0 size_flags_horizontal = 6 text = "Test different types of status messages" [node name="Button5" type="Button" parent="Main/Tabs/Debug"] -margin_left = 261.0 +margin_left = 262.0 margin_top = 196.0 margin_right = 507.0 margin_bottom = 225.0 @@ -1118,7 +1119,7 @@ text = "Print a random Tip of the Day" [node name="Button7" type="Button" parent="Main/Tabs/Debug"] margin_left = 245.0 margin_top = 266.0 -margin_right = 524.0 +margin_right = 523.0 margin_bottom = 295.0 size_flags_horizontal = 4 text = "Test path resolution in PathHelper" @@ -1199,7 +1200,6 @@ __meta__ = { } [node name="ChangelogPopup" type="PopupDialog" parent="."] -visible = true anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 @@ -1208,6 +1208,7 @@ margin_left = -240.0 margin_top = -160.0 margin_right = 240.0 margin_bottom = 160.0 +script = ExtResource( 33 ) __meta__ = { "_edit_use_anchors_": false } @@ -1226,6 +1227,13 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="Changelogger" type="Node" parent="ChangelogPopup"] +script = ExtResource( 32 ) + +[node name="DDAPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] + +[node name="BNPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] + [node name="ChangelogText" type="RichTextLabel" parent="ChangelogPopup"] anchor_left = 0.5 anchor_right = 0.5 @@ -1241,13 +1249,6 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Changelogger" type="Node" parent="ChangelogPopup"] -script = ExtResource( 32 ) - -[node name="DDAPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] - -[node name="BNPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] - [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"] diff --git a/scenes/ChangelogPopup.gd b/scenes/ChangelogPopup.gd new file mode 100644 index 00000000..8f3467d1 --- /dev/null +++ b/scenes/ChangelogPopup.gd @@ -0,0 +1,16 @@ +extends PopupDialog + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 01ee04d4..020936e7 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -3,6 +3,7 @@ extends Node onready var _settings = $"/root/SettingsManager" onready var _ddaPullRequest = $DDAPullRequests onready var _bnPullRequest = $BNPullRequests +onready var _changelogTextBox = $"../ChangelogText" var _ddaPRUrl = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100&page=" var _bnPRUrl = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100&page=" @@ -24,7 +25,7 @@ func download_pull_requests(): func _on_DDAPullRequests_request_completed(result, response_code, headers, body): - print(parse_json(body.get_string_from_utf8())) + _changelogTextBox.set_text(body.get_string_from_utf8()) func _on_BNPullRequests_request_completed(result, response_code, headers, body): From 874450f6e9a809ced7893b277f09d53ff99b4514 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Tue, 14 Dec 2021 17:58:56 -0500 Subject: [PATCH 06/31] Prepare to process data --- scripts/Changelogger.gd | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 020936e7..c426dd43 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -16,8 +16,10 @@ func _ready(): pass func download_pull_requests(): - _ddaPullRequest.request(_ddaPRUrl + str(1),["user-agent: GodotApp"]) - _bnPullRequest.request(_bnPRUrl + str(1),["user-agent: GodotApp"]) + if _ddaPRData == null: + _ddaPullRequest.request(_ddaPRUrl + str(1),["user-agent: GodotApp"]) + #if _bnPRData == null: + #_bnPullRequest.request(_bnPRUrl + str(1),["user-agent: GodotApp"]) # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): @@ -25,8 +27,14 @@ func download_pull_requests(): func _on_DDAPullRequests_request_completed(result, response_code, headers, body): - _changelogTextBox.set_text(body.get_string_from_utf8()) + _ddaPRData = process_pr_data(parse_json(body.get_string_from_utf8())) func _on_BNPullRequests_request_completed(result, response_code, headers, body): - print(parse_json(body.get_string_from_utf8())) + _bnPRData = process_pr_data(parse_json(body.get_string_from_utf8())) + +func process_pr_data(prData): + var currentDate = OS.get_datetime(true) + var rVal = "" + for json in prData: + pass From 11c7401b2a83d789bd9ef7abb757a910a433a030 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Tue, 14 Dec 2021 18:08:06 -0500 Subject: [PATCH 07/31] Getting ever closer --- scripts/Changelogger.gd | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index c426dd43..47f2cc3e 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -8,18 +8,24 @@ onready var _changelogTextBox = $"../ChangelogText" var _ddaPRUrl = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100&page=" var _bnPRUrl = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100&page=" -var _ddaPRData = null -var _bnPRData = null +var _ddaPRData = "Downloading recent DDA PRs. Please wait..." +var _bnPRData = "Downloading recent BN PRs. Please wait..." +var gameSelected = null # Called when the node enters the scene tree for the first time. func _ready(): pass func download_pull_requests(): - if _ddaPRData == null: + gameSelected = _settings.read("game") + if _ddaPRData == "Downloading recent DDA PRs. Please wait...": _ddaPullRequest.request(_ddaPRUrl + str(1),["user-agent: GodotApp"]) - #if _bnPRData == null: - #_bnPullRequest.request(_bnPRUrl + str(1),["user-agent: GodotApp"]) + if _bnPRData == "Downloading recent BN PRs. Please wait...": + _bnPullRequest.request(_bnPRUrl + str(1),["user-agent: GodotApp"]) + if gameSelected == "dda": + _changelogTextBox.set_text(_ddaPRData) + else: + _changelogTextBox.set_text(_bnPRData) # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): @@ -28,13 +34,18 @@ func download_pull_requests(): func _on_DDAPullRequests_request_completed(result, response_code, headers, body): _ddaPRData = process_pr_data(parse_json(body.get_string_from_utf8())) + _changelogTextBox.set_text(_ddaPRData) func _on_BNPullRequests_request_completed(result, response_code, headers, body): _bnPRData = process_pr_data(parse_json(body.get_string_from_utf8())) + _changelogTextBox.set_text(_bnPRData) func process_pr_data(prData): var currentDate = OS.get_datetime(true) var rVal = "" for json in prData: - pass + if json["merged_at"] == "null": + continue + + return rVal From 4a60e394d2f6b86a258f686a1215d35d1a965f10 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 16:33:47 -0500 Subject: [PATCH 08/31] Got basic changelog working --- scripts/Catapult.gd | 1 - scripts/Changelogger.gd | 151 +++++++++++++++++++++++++++++++++------- 2 files changed, 124 insertions(+), 28 deletions(-) diff --git a/scripts/Catapult.gd b/scripts/Catapult.gd index 9ff7fc86..a8631d31 100644 --- a/scripts/Catapult.gd +++ b/scripts/Catapult.gd @@ -306,7 +306,6 @@ func _on_BtnInstall_pressed() -> void: _installer.install_release(release, _settings.read("game"), update) func _on_BtnChangelog_pressed() -> void: - var changesToCheck = _settings.read("game") $ChangelogPopup.popup() _changelogger.download_pull_requests() diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 47f2cc3e..3f536016 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -1,31 +1,29 @@ extends Node onready var _settings = $"/root/SettingsManager" -onready var _ddaPullRequest = $DDAPullRequests -onready var _bnPullRequest = $BNPullRequests +onready var _ddaPullRequests = $DDAPullRequests +onready var _bnPullRequests = $BNPullRequests onready var _changelogTextBox = $"../ChangelogText" -var _ddaPRUrl = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100&page=" -var _bnPRUrl = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100&page=" - -var _ddaPRData = "Downloading recent DDA PRs. Please wait..." -var _bnPRData = "Downloading recent BN PRs. Please wait..." -var gameSelected = null +var _dda_pr_data = "Downloading recent DDA PRs. Please wait..." +var _bn_pr_data = "Downloading recent BN PRs. Please wait..." # Called when the node enters the scene tree for the first time. func _ready(): pass func download_pull_requests(): - gameSelected = _settings.read("game") - if _ddaPRData == "Downloading recent DDA PRs. Please wait...": - _ddaPullRequest.request(_ddaPRUrl + str(1),["user-agent: GodotApp"]) - if _bnPRData == "Downloading recent BN PRs. Please wait...": - _bnPullRequest.request(_bnPRUrl + str(1),["user-agent: GodotApp"]) - if gameSelected == "dda": - _changelogTextBox.set_text(_ddaPRData) + var game_selected = _settings.read("game") + var dda_pr_url = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100" + var bn_pr_url = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100" + if _dda_pr_data.length() < 45 and game_selected == "dda": + _ddaPullRequests.request(dda_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) + if _bn_pr_data.length() < 45 and game_selected == "bn": + _bnPullRequests.request(bn_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) + if game_selected == "dda": + _changelogTextBox.set_text(_dda_pr_data) else: - _changelogTextBox.set_text(_bnPRData) + _changelogTextBox.set_text(_bn_pr_data) # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): @@ -33,19 +31,118 @@ func download_pull_requests(): func _on_DDAPullRequests_request_completed(result, response_code, headers, body): - _ddaPRData = process_pr_data(parse_json(body.get_string_from_utf8())) - _changelogTextBox.set_text(_ddaPRData) + if response_code != 200: + _dda_pr_data = "Error retrieving data from the GitHub API." + else: + _dda_pr_data = process_pr_data(parse_json(body.get_string_from_utf8())) + _changelogTextBox.set_text(_dda_pr_data) func _on_BNPullRequests_request_completed(result, response_code, headers, body): - _bnPRData = process_pr_data(parse_json(body.get_string_from_utf8())) - _changelogTextBox.set_text(_bnPRData) - -func process_pr_data(prData): - var currentDate = OS.get_datetime(true) - var rVal = "" - for json in prData: - if json["merged_at"] == "null": + if response_code != 200: + _bn_pr_data = "Error retrieving data from the GitHub API." + else: + _bn_pr_data = process_pr_data(parse_json(body.get_string_from_utf8())) + _changelogTextBox.set_text(_bn_pr_data) + +func process_pr_data(pr_data): + var pr_array = [] + for json in pr_data: + if json["merged_at"] == null or json["merged_at"] == "null" : continue + var pr = PullRequest.pullrequest_from_datestring(json["merged_at"], json["title"], json["html_url"]) + pr_array.push_back(pr) + pr_array.sort_custom(PullRequest, "compare_to") + var now = OS.get_datetime(true) + var latest_year = now["year"] + var latest_month = now["month"] + var latest_day = now["day"] + var r_val = str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + ":\n" + for pr in pr_array: + var switch_date = false + switch_date = switch_date or (pr.get_year() < latest_year) + switch_date = switch_date or (pr.get_month() < latest_month) + switch_date = switch_date or (pr.get_day() < latest_day) + if switch_date: + latest_year = pr.get_year() + latest_month = pr.get_month() + latest_day = pr.get_day() + r_val = r_val + "\n" + str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + ":\n" + r_val = r_val + pr.get_summary() + "\n" + return r_val + +class PullRequest: + var year setget ,get_year + var month setget ,get_month + var day setget ,get_day + var hour setget ,get_hour + var minute setget ,get_minute + var second setget ,get_second + var summary setget ,get_summary + var link setget ,get_link + + func get_year(): + return year + + func get_month(): + return month + + func get_day(): + return day + + func get_hour(): + return hour + + func get_minute(): + return minute + + func get_second(): + return second + + func get_summary(): + return summary - return rVal + func get_link(): + return link + + #We just need to get Github API strings. Nothing else. + static func pullrequest_from_datestring(date, sum, link): + var r_val = PullRequest.new( + int(date.substr(0,4)), + int(date.substr(5,2)), + int(date.substr(8,2)), + int(date.substr(11,2)), + int(date.substr(14,2)), + int(date.substr(16,2)), + sum, + link) + return r_val + + # Sorts dates in descending order (that is, the latest date comes first). + static func compare_to(a, b): + if a.year < b.year: + return false + if a.month < b.month: + return false + if a.day < b.day: + return false + if a.hour < b.hour: + return false + if a.minute < b.minute: + return false + if a.second < b.second: + return false + return true + + func _init(y, mo, d, h, mi, s, sum, url): + year = y + month = mo + day = d + hour = h + minute = mi + second = s + summary = sum + link = url + + func print_date(): + return str(year) + "-" + str(month) + "-" + str(day) From 68926854979d5748647b59cf3c52d2204d84ac63 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 16:45:30 -0500 Subject: [PATCH 09/31] Now it looks nifty! --- scenes/Catapult.tscn | 5 ++--- scenes/ChangelogPopup.gd | 16 ---------------- scripts/Changelogger.gd | 36 ++++++++++++++++++------------------ 3 files changed, 20 insertions(+), 37 deletions(-) delete mode 100644 scenes/ChangelogPopup.gd diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index e774878b..60ca40bd 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=35 format=2] +[gd_scene load_steps=34 format=2] [ext_resource path="res://icons/info.svg" type="Texture" id=1] [ext_resource path="res://icons/download.svg" type="Texture" id=2] @@ -32,7 +32,6 @@ [ext_resource path="res://icons/help.svg" type="Texture" id=30] [ext_resource path="res://scripts/PathHelper.gd" type="Script" id=31] [ext_resource path="res://scripts/Changelogger.gd" type="Script" id=32] -[ext_resource path="res://scenes/ChangelogPopup.gd" type="Script" id=33] [sub_resource type="ButtonGroup" id=1] @@ -1208,7 +1207,6 @@ margin_left = -240.0 margin_top = -160.0 margin_right = 240.0 margin_bottom = 160.0 -script = ExtResource( 33 ) __meta__ = { "_edit_use_anchors_": false } @@ -1348,3 +1346,4 @@ __meta__ = { [connection signal="pressed" from="ChangelogPopup/BtnCloseChangelog" to="." method="_on_BtnCloseChangelog_pressed"] [connection signal="request_completed" from="ChangelogPopup/Changelogger/DDAPullRequests" to="ChangelogPopup/Changelogger" method="_on_DDAPullRequests_request_completed"] [connection signal="request_completed" from="ChangelogPopup/Changelogger/BNPullRequests" to="ChangelogPopup/Changelogger" method="_on_BNPullRequests_request_completed"] +[connection signal="meta_clicked" from="ChangelogPopup/ChangelogText" to="ChangelogPopup/Changelogger" method="_on_ChangelogText_meta_clicked"] diff --git a/scenes/ChangelogPopup.gd b/scenes/ChangelogPopup.gd deleted file mode 100644 index 8f3467d1..00000000 --- a/scenes/ChangelogPopup.gd +++ /dev/null @@ -1,16 +0,0 @@ -extends PopupDialog - - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 3f536016..4e93c099 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -17,34 +17,31 @@ func download_pull_requests(): var dda_pr_url = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100" var bn_pr_url = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100" if _dda_pr_data.length() < 45 and game_selected == "dda": - _ddaPullRequests.request(dda_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) + _ddaPullRequests.request(dda_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) if _bn_pr_data.length() < 45 and game_selected == "bn": - _bnPullRequests.request(bn_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) + _bnPullRequests.request(bn_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) + _changelogTextBox.clear() if game_selected == "dda": - _changelogTextBox.set_text(_dda_pr_data) + _changelogTextBox.append_bbcode(_dda_pr_data) else: - _changelogTextBox.set_text(_bn_pr_data) - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - + _changelogTextBox.append_bbcode(_bn_pr_data) func _on_DDAPullRequests_request_completed(result, response_code, headers, body): if response_code != 200: - _dda_pr_data = "Error retrieving data from the GitHub API." + _dda_pr_data = "Error retrieving data from the GitHub API. (Response code: " + str(response_code) + ")" else: _dda_pr_data = process_pr_data(parse_json(body.get_string_from_utf8())) - _changelogTextBox.set_text(_dda_pr_data) - + _changelogTextBox.clear() + _changelogTextBox.append_bbcode(_dda_pr_data) func _on_BNPullRequests_request_completed(result, response_code, headers, body): if response_code != 200: - _bn_pr_data = "Error retrieving data from the GitHub API." + _bn_pr_data = "Error retrieving data from the GitHub API. (Response code: " + str(response_code) + ")" else: _bn_pr_data = process_pr_data(parse_json(body.get_string_from_utf8())) - _changelogTextBox.set_text(_bn_pr_data) - + _changelogTextBox.clear() + _changelogTextBox.append_bbcode(_bn_pr_data) + func process_pr_data(pr_data): var pr_array = [] for json in pr_data: @@ -57,7 +54,7 @@ func process_pr_data(pr_data): var latest_year = now["year"] var latest_month = now["month"] var latest_day = now["day"] - var r_val = str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + ":\n" + var r_val ="--- " + str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + " ---\n" for pr in pr_array: var switch_date = false switch_date = switch_date or (pr.get_year() < latest_year) @@ -67,10 +64,13 @@ func process_pr_data(pr_data): latest_year = pr.get_year() latest_month = pr.get_month() latest_day = pr.get_day() - r_val = r_val + "\n" + str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + ":\n" - r_val = r_val + pr.get_summary() + "\n" + r_val = r_val + "\n--- " + str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + " ---\n" + r_val = r_val + " * [url=" + pr.get_link() + "]" + pr.get_summary() + "[/url]\n" return r_val +func _on_ChangelogText_meta_clicked(meta): + OS.shell_open(str(meta)) + class PullRequest: var year setget ,get_year var month setget ,get_month From 5761ed910fe0ae5de3d35f83bf747578fd2e895e Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 17:18:31 -0500 Subject: [PATCH 10/31] Fixed sorting and tooltips --- scenes/Catapult.tscn | 4 +++- scripts/Changelogger.gd | 52 ++++++++++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 60ca40bd..7a19a2a6 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -205,7 +205,9 @@ margin_top = 149.0 margin_right = 474.0 margin_bottom = 181.0 rect_min_size = Vector2( 180, 32 ) -hint_tooltip = "Use the Github API to view a list of recent changes for the selected game. (Requires an internet connection)" +hint_tooltip = "Use the Github API to view a list of +recent changes for the selected game. +(Requires an internet connection)" size_flags_horizontal = 4 text = "View Recent Changes" __meta__ = { diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 4e93c099..d8bd31d5 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -16,9 +16,9 @@ func download_pull_requests(): var game_selected = _settings.read("game") var dda_pr_url = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100" var bn_pr_url = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100" - if _dda_pr_data.length() < 45 and game_selected == "dda": + if _dda_pr_data.length() < 60 and game_selected == "dda": _ddaPullRequests.request(dda_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) - if _bn_pr_data.length() < 45 and game_selected == "bn": + if _bn_pr_data.length() < 60 and game_selected == "bn": _bnPullRequests.request(bn_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) _changelogTextBox.clear() if game_selected == "dda": @@ -54,8 +54,11 @@ func process_pr_data(pr_data): var latest_year = now["year"] var latest_month = now["month"] var latest_day = now["day"] + var mon_str = format_two_digit(str(latest_month)) + var day_str = format_two_digit(str(latest_day)) var r_val ="--- " + str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + " ---\n" for pr in pr_array: + #print(str(pr.get_year()) + "-" + str(pr.get_month()) + "-" + str(pr.get_day())) var switch_date = false switch_date = switch_date or (pr.get_year() < latest_year) switch_date = switch_date or (pr.get_month() < latest_month) @@ -64,10 +67,17 @@ func process_pr_data(pr_data): latest_year = pr.get_year() latest_month = pr.get_month() latest_day = pr.get_day() - r_val = r_val + "\n--- " + str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + " ---\n" + mon_str = format_two_digit(str(latest_month)) + day_str = format_two_digit(str(latest_day)) + r_val = r_val + "\n--- " + str(latest_year) + "-" + mon_str+ "-" + day_str + " ---\n" r_val = r_val + " * [url=" + pr.get_link() + "]" + pr.get_summary() + "[/url]\n" return r_val +func format_two_digit(time): + if (time.length() == 1): + return "0" + time + return time + func _on_ChangelogText_meta_clicked(meta): OS.shell_open(str(meta)) @@ -120,19 +130,16 @@ class PullRequest: # Sorts dates in descending order (that is, the latest date comes first). static func compare_to(a, b): - if a.year < b.year: - return false - if a.month < b.month: - return false - if a.day < b.day: - return false - if a.hour < b.hour: - return false - if a.minute < b.minute: - return false - if a.second < b.second: - return false - return true + var a_more_than_b = a.year > b.year + if a.year == b.year: + a_more_than_b = a.get_julian_date() > b.get_julian_date() + if a.get_julian_date() == b.get_julian_date(): + a_more_than_b = a.hour > b.hour + if a.hour == b.hour: + a_more_than_b = a.minute > b.minute + if a.minute == b.minute: + a_more_than_b = a.second > b.second + return a_more_than_b func _init(y, mo, d, h, mi, s, sum, url): year = y @@ -144,5 +151,18 @@ class PullRequest: summary = sum link = url + func get_julian_date(): + var days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + + #Yes, this will cause 2100 to be a leap year. We will deal with that when it becomes relevant. + if year % 4 == 0: + days_in_month[1] = 29 + if month == 1: + return day + var julian = day + for n in (month - 1): + julian = julian + days_in_month[n] + return julian + func print_date(): return str(year) + "-" + str(month) + "-" + str(day) From 6a36facbf6712299e53129fc9c5e1c71f5916d7f Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 17:28:53 -0500 Subject: [PATCH 11/31] No tokens then --- scripts/Changelogger.gd | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index d8bd31d5..c42f9e05 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -16,10 +16,16 @@ func download_pull_requests(): var game_selected = _settings.read("game") var dda_pr_url = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100" var bn_pr_url = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100" - if _dda_pr_data.length() < 60 and game_selected == "dda": - _ddaPullRequests.request(dda_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) - if _bn_pr_data.length() < 60 and game_selected == "bn": - _bnPullRequests.request(bn_pr_url,["Authorization: token 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", "user-agent: GodotApp"]) + if _dda_pr_data.length() < 65 and game_selected == "dda": + _dda_pr_data = "Downloading recent DDA PRs. Please wait..." + _ddaPullRequests.request(dda_pr_url,["user-agent: GodotApp"]) + _changelogTextBox.clear() + _changelogTextBox.append_bbcode(_dda_pr_data) + if _bn_pr_data.length() < 65 and game_selected == "bn": + _bn_pr_data = "Downloading recent BN PRs. Please wait..." + _bnPullRequests.request(bn_pr_url,["user-agent: GodotApp"]) + _changelogTextBox.clear() + _changelogTextBox.append_bbcode(_bn_pr_data) _changelogTextBox.clear() if game_selected == "dda": _changelogTextBox.append_bbcode(_dda_pr_data) From b4b9719f937459756d5214cadbb5ffcc22b91785 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 18:31:11 -0500 Subject: [PATCH 12/31] Cleaned up date comparisons --- scripts/Changelogger.gd | 58 ++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index c42f9e05..dfe57c81 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -60,8 +60,8 @@ func process_pr_data(pr_data): var latest_year = now["year"] var latest_month = now["month"] var latest_day = now["day"] - var mon_str = format_two_digit(str(latest_month)) - var day_str = format_two_digit(str(latest_day)) + var mon_str = PullRequest.format_two_digit(str(latest_month)) + var day_str = PullRequest.format_two_digit(str(latest_day)) var r_val ="--- " + str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + " ---\n" for pr in pr_array: #print(str(pr.get_year()) + "-" + str(pr.get_month()) + "-" + str(pr.get_day())) @@ -73,17 +73,12 @@ func process_pr_data(pr_data): latest_year = pr.get_year() latest_month = pr.get_month() latest_day = pr.get_day() - mon_str = format_two_digit(str(latest_month)) - day_str = format_two_digit(str(latest_day)) + mon_str = PullRequest.format_two_digit(str(latest_month)) + day_str = PullRequest.format_two_digit(str(latest_day)) r_val = r_val + "\n--- " + str(latest_year) + "-" + mon_str+ "-" + day_str + " ---\n" r_val = r_val + " * [url=" + pr.get_link() + "]" + pr.get_summary() + "[/url]\n" return r_val -func format_two_digit(time): - if (time.length() == 1): - return "0" + time - return time - func _on_ChangelogText_meta_clicked(meta): OS.shell_open(str(meta)) @@ -121,6 +116,25 @@ class PullRequest: func get_link(): return link + # A shortcut for comparison + func to_int(): + var r_val = str(year) + r_val += format_two_digit(month) + r_val += format_two_digit(day) + r_val += format_two_digit(hour) + r_val += format_two_digit(minute) + r_val += format_two_digit(second) + return int(r_val) + + static func format_two_digit(time): + if (str(time).length() == 1): + return "0" + str(time) + return str(time) + + # Sorts dates in descending order (that is, the latest date comes first). + static func compare_to(a, b): + return a.to_int() > b.to_int() + #We just need to get Github API strings. Nothing else. static func pullrequest_from_datestring(date, sum, link): var r_val = PullRequest.new( @@ -134,18 +148,7 @@ class PullRequest: link) return r_val - # Sorts dates in descending order (that is, the latest date comes first). - static func compare_to(a, b): - var a_more_than_b = a.year > b.year - if a.year == b.year: - a_more_than_b = a.get_julian_date() > b.get_julian_date() - if a.get_julian_date() == b.get_julian_date(): - a_more_than_b = a.hour > b.hour - if a.hour == b.hour: - a_more_than_b = a.minute > b.minute - if a.minute == b.minute: - a_more_than_b = a.second > b.second - return a_more_than_b + func _init(y, mo, d, h, mi, s, sum, url): year = y @@ -157,18 +160,7 @@ class PullRequest: summary = sum link = url - func get_julian_date(): - var days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - - #Yes, this will cause 2100 to be a leap year. We will deal with that when it becomes relevant. - if year % 4 == 0: - days_in_month[1] = 29 - if month == 1: - return day - var julian = day - for n in (month - 1): - julian = julian + days_in_month[n] - return julian + func print_date(): return str(year) + "-" + str(month) + "-" + str(day) From 428e9336126e6bc792bcfb3a40212986a9befe1b Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 18:43:16 -0500 Subject: [PATCH 13/31] Even cleaner date comparisons Thanks to the LRR discord. I feel really dumb for not knowing this. --- scripts/Changelogger.gd | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index dfe57c81..c067728c 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -83,6 +83,7 @@ func _on_ChangelogText_meta_clicked(meta): OS.shell_open(str(meta)) class PullRequest: + var timestring setget set_timestring,get_timestring var year setget ,get_year var month setget ,get_month var day setget ,get_day @@ -116,15 +117,11 @@ class PullRequest: func get_link(): return link - # A shortcut for comparison - func to_int(): - var r_val = str(year) - r_val += format_two_digit(month) - r_val += format_two_digit(day) - r_val += format_two_digit(hour) - r_val += format_two_digit(minute) - r_val += format_two_digit(second) - return int(r_val) + func set_timestring(t): + timestring = t + + func get_timestring(): + return timestring static func format_two_digit(time): if (str(time).length() == 1): @@ -133,7 +130,7 @@ class PullRequest: # Sorts dates in descending order (that is, the latest date comes first). static func compare_to(a, b): - return a.to_int() > b.to_int() + return a.timestring > b.timestring #We just need to get Github API strings. Nothing else. static func pullrequest_from_datestring(date, sum, link): @@ -146,6 +143,7 @@ class PullRequest: int(date.substr(16,2)), sum, link) + r_val.set_timestring(date) return r_val From 7e275eeab314bcc17e186ac63e45429c0adfdb7b Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 19:11:44 -0500 Subject: [PATCH 14/31] You can now provide your own Github PAT if you like. --- scenes/Catapult.tscn | 80 ++++++++++++++++++++++++++++++++----- scripts/Changelogger.gd | 18 +++++---- scripts/SettingsUI.gd | 11 +++++ scripts/settings_manager.gd | 2 + 4 files changed, 95 insertions(+), 16 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 7a19a2a6..53287024 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -117,11 +117,12 @@ margin_bottom = 73.0 [node name="Tabs" type="TabContainer" parent="Main" groups=["disable_during_mod_operations", "disable_during_soundpack_operations", "disable_while_fetching_releases", "disable_while_installing_game"]] margin_top = 79.0 margin_right = 784.0 -margin_bottom = 440.0 +margin_bottom = 674.0 tab_align = 0 script = ExtResource( 16 ) [node name="Game" type="VBoxContainer" parent="Main/Tabs"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -832,7 +833,6 @@ margin_right = 769.0 margin_bottom = 539.0 [node name="Settings" type="VBoxContainer" parent="Main/Tabs"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -923,10 +923,70 @@ min_value = 1.0 value = 30.0 rounded = true -[node name="ScaleOverride" type="HBoxContainer" parent="Main/Tabs/Settings"] +[node name="CLSeparatorTop" type="HSeparator" parent="Main/Tabs/Settings"] margin_top = 280.0 margin_right = 769.0 -margin_bottom = 309.0 +margin_bottom = 288.0 + +[node name="NumPrs" type="HBoxContainer" parent="Main/Tabs/Settings"] +margin_top = 294.0 +margin_right = 769.0 +margin_bottom = 323.0 +hint_tooltip = "How many latest releases will be requested +from GitHub after starting the launcher, choosing +the game or clicking Refresh." + +[node name="Label" type="Label" parent="Main/Tabs/Settings/NumPrs"] +margin_right = 429.0 +margin_bottom = 29.0 +text = "Number of pull requests to download in the changelog:" + +[node name="sbNumPRs" type="SpinBox" parent="Main/Tabs/Settings/NumPrs"] +margin_left = 639.0 +margin_right = 769.0 +margin_bottom = 29.0 +size_flags_horizontal = 10 +min_value = 10.0 +step = 10.0 +value = 100.0 +rounded = true + +[node name="GitPAT" type="HBoxContainer" parent="Main/Tabs/Settings"] +margin_top = 329.0 +margin_right = 769.0 +margin_bottom = 358.0 +hint_tooltip = "How many latest releases will be requested +from GitHub after starting the launcher, choosing +the game or clicking Refresh." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="PATLabel" type="Label" parent="Main/Tabs/Settings/GitPAT"] +margin_right = 204.0 +margin_bottom = 29.0 +text = "Github API PAT (optional):" + +[node name="lePATUse" type="LineEdit" parent="Main/Tabs/Settings/GitPAT"] +anchor_left = -0.0208062 +anchor_right = -0.0208062 +margin_left = 370.0 +margin_right = 769.0 +margin_bottom = 29.0 +size_flags_horizontal = 10 + +[node name="CLSeparatorBottom" type="HSeparator" parent="Main/Tabs/Settings"] +margin_top = 364.0 +margin_right = 769.0 +margin_bottom = 372.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ScaleOverride" type="HBoxContainer" parent="Main/Tabs/Settings"] +margin_top = 378.0 +margin_right = 769.0 +margin_bottom = 407.0 hint_tooltip = "Use this if the automatically inferred UI scale looks too large or too small on your system. (Automatic scale relies on system-reported @@ -963,14 +1023,14 @@ editable = false suffix = "%" [node name="HSeparator" type="HSeparator" parent="Main/Tabs/Settings"] -margin_top = 315.0 +margin_top = 413.0 margin_right = 769.0 -margin_bottom = 323.0 +margin_bottom = 421.0 [node name="Migration" type="VBoxContainer" parent="Main/Tabs/Settings"] -margin_top = 329.0 +margin_top = 427.0 margin_right = 769.0 -margin_bottom = 451.0 +margin_bottom = 549.0 hint_tooltip = "Choose which types of game data to carry over into the new game version when updating." @@ -1126,7 +1186,7 @@ size_flags_horizontal = 4 text = "Test path resolution in PathHelper" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 446.0 +margin_top = 680.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 @@ -1300,6 +1360,8 @@ __meta__ = { [connection signal="toggled" from="Main/Tabs/Settings/InstallArchivedMods" to="Main/Tabs/Settings" method="_on_InstallArchivedMods_toggled"] [connection signal="toggled" from="Main/Tabs/Settings/ShowDebug" to="Main/Tabs/Settings" method="_on_ShowDebug_toggled"] [connection signal="value_changed" from="Main/Tabs/Settings/NumReleases/sbNumReleases" to="Main/Tabs/Settings" method="_on_sbNumReleases_value_changed"] +[connection signal="value_changed" from="Main/Tabs/Settings/NumPrs/sbNumPRs" to="Main/Tabs/Settings" method="_on_sbNumReleases_value_changed"] +[connection signal="text_changed" from="Main/Tabs/Settings/GitPAT/lePATUse" to="Main/Tabs/Settings" method="_on_lePATUse_text_changed"] [connection signal="toggled" from="Main/Tabs/Settings/ScaleOverride/cbScaleOverrideEnable" to="Main/Tabs/Settings" method="_on_cbScaleOverrideEnable_toggled"] [connection signal="value_changed" from="Main/Tabs/Settings/ScaleOverride/sbScaleOverride" to="Main/Tabs/Settings" method="_on_sbScaleOverride_value_changed"] [connection signal="toggled" from="Main/Tabs/Settings/Migration/Grid/Savegames" to="Main/Tabs/Settings" method="_on_any_migration_checkbox_toggled"] diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index c067728c..bb79cb56 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -16,14 +16,18 @@ func download_pull_requests(): var game_selected = _settings.read("game") var dda_pr_url = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100" var bn_pr_url = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100" + var headers = ["user-agent: GodotApp"] + var pat = _settings.read("github_pat") + if (pat.length() == 40): + headers.push_back("Authorization: token " + pat) if _dda_pr_data.length() < 65 and game_selected == "dda": _dda_pr_data = "Downloading recent DDA PRs. Please wait..." - _ddaPullRequests.request(dda_pr_url,["user-agent: GodotApp"]) + _ddaPullRequests.request(dda_pr_url, headers) _changelogTextBox.clear() _changelogTextBox.append_bbcode(_dda_pr_data) if _bn_pr_data.length() < 65 and game_selected == "bn": _bn_pr_data = "Downloading recent BN PRs. Please wait..." - _bnPullRequests.request(bn_pr_url,["user-agent: GodotApp"]) + _bnPullRequests.request(bn_pr_url, headers) _changelogTextBox.clear() _changelogTextBox.append_bbcode(_bn_pr_data) _changelogTextBox.clear() @@ -57,12 +61,12 @@ func process_pr_data(pr_data): pr_array.push_back(pr) pr_array.sort_custom(PullRequest, "compare_to") var now = OS.get_datetime(true) - var latest_year = now["year"] + var latest_year = now["year"] + 1 var latest_month = now["month"] var latest_day = now["day"] var mon_str = PullRequest.format_two_digit(str(latest_month)) var day_str = PullRequest.format_two_digit(str(latest_day)) - var r_val ="--- " + str(latest_year) + "-" + str(latest_month) + "-" + str(latest_day) + " ---\n" + var r_val ="" for pr in pr_array: #print(str(pr.get_year()) + "-" + str(pr.get_month()) + "-" + str(pr.get_day())) var switch_date = false @@ -73,8 +77,8 @@ func process_pr_data(pr_data): latest_year = pr.get_year() latest_month = pr.get_month() latest_day = pr.get_day() - mon_str = PullRequest.format_two_digit(str(latest_month)) - day_str = PullRequest.format_two_digit(str(latest_day)) + mon_str = PullRequest.format_two_digit(latest_month) + day_str = PullRequest.format_two_digit(latest_day) r_val = r_val + "\n--- " + str(latest_year) + "-" + mon_str+ "-" + day_str + " ---\n" r_val = r_val + " * [url=" + pr.get_link() + "]" + pr.get_summary() + "[/url]\n" return r_val @@ -132,7 +136,7 @@ class PullRequest: static func compare_to(a, b): return a.timestring > b.timestring - #We just need to get Github API strings. Nothing else. + # We just need to get Github API strings. Nothing else. static func pullrequest_from_datestring(date, sum, link): var r_val = PullRequest.new( int(date.substr(0,4)), diff --git a/scripts/SettingsUI.gd b/scripts/SettingsUI.gd index 7186df78..fe440193 100644 --- a/scripts/SettingsUI.gd +++ b/scripts/SettingsUI.gd @@ -30,6 +30,8 @@ func _ready() -> void: $InstallArchivedMods.pressed = _settings.read("install_archived_mods") $ShowDebug.pressed = _settings.read("debug_mode") $NumReleases/sbNumReleases.value = _settings.read("num_releases_to_request") as int + $NumPrs/sbNumPRs.value = _settings.read("num_prs_to_request") as int + $GitPAT/lePATUse.text = _settings.read("github_pat") $ScaleOverride/cbScaleOverrideEnable.pressed = _settings.read("ui_scale_override_enabled") $ScaleOverride/sbScaleOverride.editable = _settings.read("ui_scale_override_enabled") @@ -87,6 +89,10 @@ func _on_sbNumReleases_value_changed(value: float) -> void: _settings.store("num_releases_to_request", str(value)) +func _on_sbNumPRs_value_changed(value: float) -> void: + + _settings.store("num_prs_to_request", str(value)) + func _on_cbScaleOverrideEnable_toggled(button_pressed: bool) -> void: @@ -116,3 +122,8 @@ func _on_any_migration_checkbox_toggled(_asdf: bool) -> void: data_types.append(type) _settings.store("game_data_to_migrate", data_types) + + +func _on_lePATUse_text_changed(new_text): + if (new_text.length() == 40 or new_text.length() == 0): + _settings.store("github_pat", new_text) diff --git a/scripts/settings_manager.gd b/scripts/settings_manager.gd index 467c46bd..74bc1818 100644 --- a/scripts/settings_manager.gd +++ b/scripts/settings_manager.gd @@ -13,6 +13,8 @@ const _HARDCODED_DEFAULTS = { "update_to_same_build_allowed": false, "shorten_release_names": false, "num_releases_to_request": 10, + "num_prs_to_request": 100, + "github_pat": "", "ui_scale_override": 1.0, "ui_scale_override_enabled": false, "show_stock_mods": false, From 3db18389efe37ecf0eb351eee3ba4ad426dbe50b Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 19:16:54 -0500 Subject: [PATCH 15/31] Size flags --- scenes/Catapult.tscn | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 53287024..416e638e 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -963,17 +963,15 @@ __meta__ = { } [node name="PATLabel" type="Label" parent="Main/Tabs/Settings/GitPAT"] -margin_right = 204.0 +margin_right = 348.0 margin_bottom = 29.0 -text = "Github API PAT (optional):" +text = "Github API Personal Access Token (optional):" [node name="lePATUse" type="LineEdit" parent="Main/Tabs/Settings/GitPAT"] -anchor_left = -0.0208062 -anchor_right = -0.0208062 -margin_left = 370.0 +margin_left = 354.0 margin_right = 769.0 margin_bottom = 29.0 -size_flags_horizontal = 10 +size_flags_horizontal = 11 [node name="CLSeparatorBottom" type="HSeparator" parent="Main/Tabs/Settings"] margin_top = 364.0 From 351f9c15a56ceae98645bf2448ac1efbc1cb5836 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 19:21:50 -0500 Subject: [PATCH 16/31] Fixed a crossed wire --- scenes/Catapult.tscn | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 416e638e..e2c1bcb2 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -971,6 +971,10 @@ text = "Github API Personal Access Token (optional):" margin_left = 354.0 margin_right = 769.0 margin_bottom = 29.0 +hint_tooltip = "Unauthenticated requests against the +GitHub API are unreliable. Create a GitHub +Personal Access Token if you're getting +5xx errors when trying to view the changelog." size_flags_horizontal = 11 [node name="CLSeparatorBottom" type="HSeparator" parent="Main/Tabs/Settings"] @@ -1358,7 +1362,7 @@ __meta__ = { [connection signal="toggled" from="Main/Tabs/Settings/InstallArchivedMods" to="Main/Tabs/Settings" method="_on_InstallArchivedMods_toggled"] [connection signal="toggled" from="Main/Tabs/Settings/ShowDebug" to="Main/Tabs/Settings" method="_on_ShowDebug_toggled"] [connection signal="value_changed" from="Main/Tabs/Settings/NumReleases/sbNumReleases" to="Main/Tabs/Settings" method="_on_sbNumReleases_value_changed"] -[connection signal="value_changed" from="Main/Tabs/Settings/NumPrs/sbNumPRs" to="Main/Tabs/Settings" method="_on_sbNumReleases_value_changed"] +[connection signal="value_changed" from="Main/Tabs/Settings/NumPrs/sbNumPRs" to="Main/Tabs/Settings" method="_on_sbNumPRs_value_changed"] [connection signal="text_changed" from="Main/Tabs/Settings/GitPAT/lePATUse" to="Main/Tabs/Settings" method="_on_lePATUse_text_changed"] [connection signal="toggled" from="Main/Tabs/Settings/ScaleOverride/cbScaleOverrideEnable" to="Main/Tabs/Settings" method="_on_cbScaleOverrideEnable_toggled"] [connection signal="value_changed" from="Main/Tabs/Settings/ScaleOverride/sbScaleOverride" to="Main/Tabs/Settings" method="_on_sbScaleOverride_value_changed"] From 853ef1b40f06709da8fea63641c667196803fd89 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 19:36:10 -0500 Subject: [PATCH 17/31] Fixed a broken setting --- scripts/Changelogger.gd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index bb79cb56..99eed83e 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -14,8 +14,9 @@ func _ready(): func download_pull_requests(): var game_selected = _settings.read("game") - var dda_pr_url = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=100" - var bn_pr_url = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=100" + var prs = _settings.read("num_prs_to_request") + var dda_pr_url = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=" + prs + var bn_pr_url = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=" + prs var headers = ["user-agent: GodotApp"] var pat = _settings.read("github_pat") if (pat.length() == 40): From 6e4e87498ce41e68790b913edebeb8360a990dc0 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 19:37:39 -0500 Subject: [PATCH 18/31] Change default PR number to 50 for more reliability. --- scripts/settings_manager.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/settings_manager.gd b/scripts/settings_manager.gd index 74bc1818..fed4a64a 100644 --- a/scripts/settings_manager.gd +++ b/scripts/settings_manager.gd @@ -13,7 +13,7 @@ const _HARDCODED_DEFAULTS = { "update_to_same_build_allowed": false, "shorten_release_names": false, "num_releases_to_request": 10, - "num_prs_to_request": 100, + "num_prs_to_request": 50, "github_pat": "", "ui_scale_override": 1.0, "ui_scale_override_enabled": false, From 6921a0f5dacc021dce15e96c2f9baf1906c717e9 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 19:49:31 -0500 Subject: [PATCH 19/31] More descriptive user agent header --- scripts/Changelogger.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 99eed83e..f766f114 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -17,7 +17,7 @@ func download_pull_requests(): var prs = _settings.read("num_prs_to_request") var dda_pr_url = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=" + prs var bn_pr_url = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=" + prs - var headers = ["user-agent: GodotApp"] + var headers = ["user-agent: CatapultGodotApp"] var pat = _settings.read("github_pat") if (pat.length() == 40): headers.push_back("Authorization: token " + pat) From 9e035847ab9029b048749049868267af26cfeb02 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Wed, 15 Dec 2021 19:50:51 -0500 Subject: [PATCH 20/31] Reverted font change --- fonts/OpenSans-Regular.tres | 1 - 1 file changed, 1 deletion(-) diff --git a/fonts/OpenSans-Regular.tres b/fonts/OpenSans-Regular.tres index ee88fd8b..14565f2f 100644 --- a/fonts/OpenSans-Regular.tres +++ b/fonts/OpenSans-Regular.tres @@ -3,7 +3,6 @@ [ext_resource path="res://fonts/OpenSans-Regular.ttf" type="DynamicFontData" id=1] [resource] -size = 10 extra_spacing_top = -3 extra_spacing_bottom = -3 font_data = ExtResource( 1 ) From ec6f5e0613cf367f3be7fbc62f603f5242a2cc99 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Thu, 16 Dec 2021 08:29:56 -0500 Subject: [PATCH 21/31] Delete stray unused scene file --- scenes/Changelog.tscn | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 scenes/Changelog.tscn diff --git a/scenes/Changelog.tscn b/scenes/Changelog.tscn deleted file mode 100644 index e7906d71..00000000 --- a/scenes/Changelog.tscn +++ /dev/null @@ -1,38 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://fonts/OpenSans-Regular.tres" type="DynamicFont" id=1] - -[node name="Panel" type="Panel"] -margin_right = 640.0 -margin_bottom = 480.0 -rect_min_size = Vector2( 640, 480 ) -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="RichTextLabel" type="RichTextLabel" parent="."] -margin_left = 16.0 -margin_top = 16.0 -margin_right = 624.0 -margin_bottom = 400.0 -rect_min_size = Vector2( 608, 384 ) -custom_fonts/mono_font = ExtResource( 1 ) -bbcode_enabled = true -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Button" type="Button" parent="."] -anchor_left = 0.5 -anchor_top = 1.0 -anchor_right = 0.5 -anchor_bottom = 1.0 -margin_left = -41.0 -margin_top = -58.0 -margin_right = 41.0 -margin_bottom = -21.0 -size_flags_horizontal = 4 -text = "Close" -__meta__ = { -"_edit_use_anchors_": false -} From cae63f61184fced25fe957a12df9e5a15388f8e6 Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Thu, 16 Dec 2021 19:30:08 +0300 Subject: [PATCH 22/31] Prettify changelog window --- scenes/Catapult.tscn | 193 +++++++++++++++++++++++---------- scenes/FontSizeHelpDialog.tscn | 6 +- scripts/Catapult.gd | 4 +- scripts/Changelogger.gd | 2 +- 4 files changed, 140 insertions(+), 65 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index e2c1bcb2..fd5e2549 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -64,7 +64,12 @@ margin_right = 65.0 margin_bottom = 29.0 text = "Game: " -[node name="GamesList" type="OptionButton" parent="Main/GameChoice" groups=["disable_during_mod_operations", "disable_during_soundpack_operations", "disable_while_fetching_releases", "disable_while_installing_game"]] +[node name="GamesList" type="OptionButton" parent="Main/GameChoice" groups=[ +"disable_during_mod_operations", +"disable_during_soundpack_operations", +"disable_while_fetching_releases", +"disable_while_installing_game", +]] margin_left = 71.0 margin_right = 784.0 margin_bottom = 29.0 @@ -77,16 +82,17 @@ selected = 0 [node name="GameInfo" type="HBoxContainer" parent="Main"] margin_top = 35.0 margin_right = 784.0 -margin_bottom = 67.0 +margin_bottom = 85.0 custom_constants/separation = 8 [node name="Spacer" type="Control" parent="Main/GameInfo"] -margin_bottom = 32.0 +margin_bottom = 50.0 [node name="Icon" type="TextureRect" parent="Main/GameInfo"] margin_left = 8.0 +margin_top = 9.0 margin_right = 40.0 -margin_bottom = 32.0 +margin_bottom = 41.0 rect_min_size = Vector2( 32, 32 ) size_flags_horizontal = 4 size_flags_vertical = 4 @@ -97,7 +103,7 @@ stretch_mode = 6 [node name="Description" type="RichTextLabel" parent="Main/GameInfo"] margin_left = 48.0 margin_right = 784.0 -margin_bottom = 31.0 +margin_bottom = 50.0 size_flags_horizontal = 3 size_flags_vertical = 4 custom_fonts/bold_italics_font = ExtResource( 24 ) @@ -110,19 +116,23 @@ text = "Game Title is a game in which... and other stuff about the game. This is fit_content_height = true [node name="Spacer" type="Control" parent="Main"] -margin_top = 73.0 +margin_top = 91.0 margin_right = 784.0 -margin_bottom = 73.0 - -[node name="Tabs" type="TabContainer" parent="Main" groups=["disable_during_mod_operations", "disable_during_soundpack_operations", "disable_while_fetching_releases", "disable_while_installing_game"]] -margin_top = 79.0 +margin_bottom = 91.0 + +[node name="Tabs" type="TabContainer" parent="Main" groups=[ +"disable_during_mod_operations", +"disable_during_soundpack_operations", +"disable_while_fetching_releases", +"disable_while_installing_game", +]] +margin_top = 97.0 margin_right = 784.0 -margin_bottom = 674.0 +margin_bottom = 458.0 tab_align = 0 script = ExtResource( 16 ) [node name="Game" type="VBoxContainer" parent="Main/Tabs"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -145,14 +155,20 @@ margin_top = 35.0 margin_right = 769.0 margin_bottom = 64.0 -[node name="RBtnStable" type="CheckBox" parent="Main/Tabs/Game/Channel/Group" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] +[node name="RBtnStable" type="CheckBox" parent="Main/Tabs/Game/Channel/Group" groups=[ +"disable_while_fetching_releases", +"disable_while_installing_game", +]] margin_right = 81.0 margin_bottom = 29.0 hint_tooltip = "Stable release channel (DDA only)." group = SubResource( 1 ) text = "Stable" -[node name="RBtnExperimental" type="CheckBox" parent="Main/Tabs/Game/Channel/Group" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] +[node name="RBtnExperimental" type="CheckBox" parent="Main/Tabs/Game/Channel/Group" groups=[ +"disable_while_fetching_releases", +"disable_while_installing_game", +]] margin_left = 87.0 margin_right = 221.0 margin_bottom = 29.0 @@ -171,7 +187,10 @@ margin_right = 133.0 margin_bottom = 29.0 text = "Available builds:" -[node name="BuildsList" type="OptionButton" parent="Main/Tabs/Game/Builds" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] +[node name="BuildsList" type="OptionButton" parent="Main/Tabs/Game/Builds" groups=[ +"disable_while_fetching_releases", +"disable_while_installing_game", +]] margin_left = 139.0 margin_right = 687.0 margin_bottom = 29.0 @@ -179,7 +198,10 @@ hint_tooltip = "Choose which release of the game to install or update to." size_flags_horizontal = 3 clip_text = true -[node name="BtnRefresh" type="Button" parent="Main/Tabs/Game/Builds" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] +[node name="BtnRefresh" type="Button" parent="Main/Tabs/Game/Builds" groups=[ +"disable_while_fetching_releases", +"disable_while_installing_game", +]] margin_left = 693.0 margin_right = 769.0 margin_bottom = 29.0 @@ -187,7 +209,10 @@ hint_tooltip = "Re-retrieve the list of available game releases from GitHub (only for experimental releases)." text = "Refresh" -[node name="BtnInstall" type="Button" parent="Main/Tabs/Game" groups=["disable_while_fetching_releases", "disable_while_installing_game"]] +[node name="BtnInstall" type="Button" parent="Main/Tabs/Game" groups=[ +"disable_while_fetching_releases", +"disable_while_installing_game", +]] margin_left = 294.0 margin_top = 109.0 margin_right = 474.0 @@ -253,7 +278,9 @@ margin_bottom = 23.0 hint_tooltip = "Open game directory." texture_normal = ExtResource( 25 ) -[node name="BtnPlay" type="Button" parent="Main/Tabs/Game/CurrentInstall" groups=["disable_while_installing_game"]] +[node name="BtnPlay" type="Button" parent="Main/Tabs/Game/CurrentInstall" groups=[ +"disable_while_installing_game", +]] margin_left = 344.0 margin_top = 70.0 margin_right = 424.0 @@ -295,7 +322,9 @@ margin_bottom = 29.0 text = "Installed:" align = 1 -[node name="InstalledList" type="ItemList" parent="Main/Tabs/Mods/HBox/Installed" groups=["disable_during_mod_operations"]] +[node name="InstalledList" type="ItemList" parent="Main/Tabs/Mods/HBox/Installed" groups=[ +"disable_during_mod_operations", +]] margin_top = 35.0 margin_right = 374.0 margin_bottom = 235.0 @@ -307,7 +336,9 @@ allow_reselect = true same_column_width = true script = ExtResource( 17 ) -[node name="ShowStock" type="CheckBox" parent="Main/Tabs/Mods/HBox/Installed" groups=["disable_during_mod_operations"]] +[node name="ShowStock" type="CheckBox" parent="Main/Tabs/Mods/HBox/Installed" groups=[ +"disable_during_mod_operations", +]] margin_left = 127.0 margin_top = 241.0 margin_right = 246.0 @@ -316,7 +347,9 @@ hint_tooltip = "Show mods from data/mods on this list." size_flags_horizontal = 4 text = "Show stock" -[node name="BtnDelete" type="Button" parent="Main/Tabs/Mods/HBox/Installed" groups=["disable_during_mod_operations"]] +[node name="BtnDelete" type="Button" parent="Main/Tabs/Mods/HBox/Installed" groups=[ +"disable_during_mod_operations", +]] margin_left = 119.0 margin_top = 276.0 margin_right = 254.0 @@ -343,7 +376,9 @@ margin_bottom = 29.0 text = "Local repository:" align = 1 -[node name="AvailableList" type="ItemList" parent="Main/Tabs/Mods/HBox/Available" groups=["disable_during_mod_operations"]] +[node name="AvailableList" type="ItemList" parent="Main/Tabs/Mods/HBox/Available" groups=[ +"disable_during_mod_operations", +]] margin_top = 35.0 margin_right = 375.0 margin_bottom = 235.0 @@ -355,7 +390,9 @@ allow_reselect = true same_column_width = true script = ExtResource( 17 ) -[node name="ShowInstalled" type="CheckBox" parent="Main/Tabs/Mods/HBox/Available" groups=["disable_during_mod_operations"]] +[node name="ShowInstalled" type="CheckBox" parent="Main/Tabs/Mods/HBox/Available" groups=[ +"disable_during_mod_operations", +]] margin_left = 86.0 margin_top = 241.0 margin_right = 289.0 @@ -371,7 +408,9 @@ margin_right = 375.0 margin_bottom = 305.0 alignment = 1 -[node name="BtnAddSelectedMod" type="Button" parent="Main/Tabs/Mods/HBox/Available/VBox" groups=["disable_during_mod_operations"]] +[node name="BtnAddSelectedMod" type="Button" parent="Main/Tabs/Mods/HBox/Available/VBox" groups=[ +"disable_during_mod_operations", +]] margin_left = 91.0 margin_right = 207.0 margin_bottom = 29.0 @@ -379,14 +418,18 @@ hint_tooltip = "Add selected mods to your game installation." size_flags_horizontal = 4 text = "Add Selected" -[node name="BtnAddAllMods" type="Button" parent="Main/Tabs/Mods/HBox/Available/VBox" groups=["disable_during_mod_operations"]] +[node name="BtnAddAllMods" type="Button" parent="Main/Tabs/Mods/HBox/Available/VBox" groups=[ +"disable_during_mod_operations", +]] margin_left = 213.0 margin_right = 283.0 margin_bottom = 29.0 hint_tooltip = "Add all listed mods to your game installation." text = "Add All" -[node name="BtnDownloadKenan" type="Button" parent="Main/Tabs/Mods/HBox/Available" groups=["disable_during_mod_operations"]] +[node name="BtnDownloadKenan" type="Button" parent="Main/Tabs/Mods/HBox/Available" groups=[ +"disable_during_mod_operations", +]] margin_left = 102.0 margin_top = 311.0 margin_right = 272.0 @@ -406,11 +449,11 @@ margin_right = 769.0 margin_bottom = 480.0 rect_min_size = Vector2( 0, 120 ) focus_mode = 2 -custom_constants/line_separation = 4 custom_fonts/bold_italics_font = ExtResource( 24 ) custom_fonts/italics_font = ExtResource( 23 ) custom_fonts/bold_font = ExtResource( 22 ) custom_fonts/normal_font = ExtResource( 7 ) +custom_constants/line_separation = 4 bbcode_enabled = true bbcode_text = "Mod info will appear here." text = "Mod info will appear here." @@ -457,7 +500,9 @@ margin_bottom = 29.0 text = "Installed:" align = 1 -[node name="InstalledList" type="ItemList" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=["disable_during_soundpack_operations"]] +[node name="InstalledList" type="ItemList" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=[ +"disable_during_soundpack_operations", +]] margin_top = 35.0 margin_right = 374.0 margin_bottom = 235.0 @@ -467,7 +512,9 @@ items = [ "Item 0", null, false, "Item 1", null, false, "Item 2", null, false, " same_column_width = true script = ExtResource( 17 ) -[node name="ShowStock" type="CheckBox" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=["disable_during_soundpack_operations"]] +[node name="ShowStock" type="CheckBox" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=[ +"disable_during_soundpack_operations", +]] margin_left = 127.0 margin_top = 241.0 margin_right = 246.0 @@ -476,7 +523,9 @@ hint_tooltip = "Show soundpacks from data/sound on the list." size_flags_horizontal = 4 text = "Show stock" -[node name="BtnDelete" type="Button" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=["disable_during_soundpack_operations"]] +[node name="BtnDelete" type="Button" parent="Main/Tabs/Soundpacks/HBox/Installed" groups=[ +"disable_during_soundpack_operations", +]] margin_left = 119.0 margin_top = 276.0 margin_right = 254.0 @@ -503,7 +552,9 @@ margin_bottom = 29.0 text = "Downloadable:" align = 1 -[node name="AvailableList" type="ItemList" parent="Main/Tabs/Soundpacks/HBox/Downloadable" groups=["disable_during_soundpack_operations"]] +[node name="AvailableList" type="ItemList" parent="Main/Tabs/Soundpacks/HBox/Downloadable" groups=[ +"disable_during_soundpack_operations", +]] margin_top = 35.0 margin_right = 375.0 margin_bottom = 235.0 @@ -513,7 +564,9 @@ items = [ "Item 0", null, false, "Item 1", null, false, "Item 2", null, false, " same_column_width = true script = ExtResource( 17 ) -[node name="BtnInstall" type="Button" parent="Main/Tabs/Soundpacks/HBox/Downloadable" groups=["disable_during_soundpack_operations"]] +[node name="BtnInstall" type="Button" parent="Main/Tabs/Soundpacks/HBox/Downloadable" groups=[ +"disable_during_soundpack_operations", +]] margin_left = 122.0 margin_top = 241.0 margin_right = 253.0 @@ -549,8 +602,8 @@ window_title = "Open a File" mode = 0 access = 2 filters = PoolStringArray( "*.zip" ) -current_dir = "/Catapult" -current_path = "/Catapult/" +current_dir = "/mnt/data/Godot/Catapult/Changelog" +current_path = "/mnt/data/Godot/Catapult/Changelog/" [node name="Fonts" type="VBoxContainer" parent="Main/Tabs"] visible = false @@ -833,6 +886,7 @@ margin_right = 769.0 margin_bottom = 539.0 [node name="Settings" type="VBoxContainer" parent="Main/Tabs"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -1188,7 +1242,7 @@ size_flags_horizontal = 4 text = "Test path resolution in PathHelper" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 680.0 +margin_top = 464.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 @@ -1262,7 +1316,8 @@ __meta__ = { "_editor_description_": "The centralized location for all path resolutions in the launcher." } -[node name="ChangelogPopup" type="PopupDialog" parent="."] +[node name="ChangelogPopup" type="WindowDialog" parent="."] +visible = true anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 @@ -1271,37 +1326,37 @@ margin_left = -240.0 margin_top = -160.0 margin_right = 240.0 margin_bottom = 160.0 + +[node name="Panel" type="PanelContainer" parent="ChangelogPopup"] +anchor_right = 1.0 +anchor_bottom = 1.0 __meta__ = { "_edit_use_anchors_": false } -[node name="BtnCloseChangelog" type="Button" parent="ChangelogPopup"] -anchor_left = 0.5 -anchor_top = 1.0 -anchor_right = 0.5 -anchor_bottom = 1.0 -margin_left = -55.5 -margin_top = -36.0 -margin_right = 55.5 -margin_bottom = -4.0 -text = "Close" +[node name="Margin" type="MarginContainer" parent="ChangelogPopup/Panel"] +margin_left = 9.0 +margin_top = 6.0 +margin_right = 471.0 +margin_bottom = 314.0 +custom_constants/margin_top = 8 +custom_constants/margin_bottom = 8 __meta__ = { "_edit_use_anchors_": false } -[node name="Changelogger" type="Node" parent="ChangelogPopup"] -script = ExtResource( 32 ) - -[node name="DDAPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] - -[node name="BNPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] +[node name="VBox" type="VBoxContainer" parent="ChangelogPopup/Panel/Margin"] +margin_top = 8.0 +margin_right = 462.0 +margin_bottom = 300.0 +custom_constants/separation = 8 +__meta__ = { +"_edit_use_anchors_": false +} -[node name="ChangelogText" type="RichTextLabel" parent="ChangelogPopup"] -anchor_left = 0.5 -anchor_right = 0.5 -margin_left = -240.0 -margin_right = 240.0 -margin_bottom = 280.0 +[node name="ChangelogText" type="RichTextLabel" parent="ChangelogPopup/Panel/Margin/VBox"] +margin_right = 462.0 +margin_bottom = 255.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_fonts/mono_font = ExtResource( 7 ) @@ -1311,6 +1366,24 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="BtnCloseChangelog" type="Button" parent="ChangelogPopup/Panel/Margin/VBox"] +margin_left = 201.0 +margin_top = 263.0 +margin_right = 260.0 +margin_bottom = 292.0 +size_flags_horizontal = 4 +text = "Close" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Changelogger" type="Node" parent="ChangelogPopup"] +script = ExtResource( 32 ) + +[node name="DDAPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] + +[node name="BNPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] + [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"] @@ -1409,7 +1482,7 @@ __meta__ = { [connection signal="status_message" from="Sound" to="." method="_on_status_message"] [connection signal="status_message" from="Fonts" to="." method="_on_status_message"] [connection signal="status_message" from="PathHelper" to="." method="_on_status_message"] -[connection signal="pressed" from="ChangelogPopup/BtnCloseChangelog" to="." method="_on_BtnCloseChangelog_pressed"] +[connection signal="meta_clicked" from="ChangelogPopup/Panel/Margin/VBox/ChangelogText" to="ChangelogPopup/Changelogger" method="_on_ChangelogText_meta_clicked"] +[connection signal="pressed" from="ChangelogPopup/Panel/Margin/VBox/BtnCloseChangelog" to="." method="_on_BtnCloseChangelog_pressed"] [connection signal="request_completed" from="ChangelogPopup/Changelogger/DDAPullRequests" to="ChangelogPopup/Changelogger" method="_on_DDAPullRequests_request_completed"] [connection signal="request_completed" from="ChangelogPopup/Changelogger/BNPullRequests" to="ChangelogPopup/Changelogger" method="_on_BNPullRequests_request_completed"] -[connection signal="meta_clicked" from="ChangelogPopup/ChangelogText" to="ChangelogPopup/Changelogger" method="_on_ChangelogText_meta_clicked"] diff --git a/scenes/FontSizeHelpDialog.tscn b/scenes/FontSizeHelpDialog.tscn index 3644c632..13667e8c 100644 --- a/scenes/FontSizeHelpDialog.tscn +++ b/scenes/FontSizeHelpDialog.tscn @@ -37,7 +37,7 @@ custom_constants/separation = 16 [node name="Help" type="RichTextLabel" parent="Panel/Margin/VBox"] margin_right = 772.0 -margin_bottom = 919.0 +margin_bottom = 903.0 size_flags_vertical = 3 custom_fonts/bold_italics_font = ExtResource( 2 ) custom_fonts/italics_font = ExtResource( 3 ) @@ -87,9 +87,9 @@ It is also recommended to turn on Font Blending for smoother font rendering. [node name="BtnOK" type="Button" parent="Panel/Margin/VBox"] margin_left = 345.0 -margin_top = 935.0 +margin_top = 919.0 margin_right = 427.0 -margin_bottom = 972.0 +margin_bottom = 956.0 size_flags_horizontal = 4 text = "Close" diff --git a/scripts/Catapult.gd b/scripts/Catapult.gd index a8631d31..5f254401 100644 --- a/scripts/Catapult.gd +++ b/scripts/Catapult.gd @@ -306,7 +306,9 @@ func _on_BtnInstall_pressed() -> void: _installer.install_release(release, _settings.read("game"), update) func _on_BtnChangelog_pressed() -> void: - $ChangelogPopup.popup() + $ChangelogPopup.rect_min_size = get_tree().root.size * Vector2(0.9, 0.9) + $ChangelogPopup.set_as_minsize() + $ChangelogPopup.popup_centered() _changelogger.download_pull_requests() func _on_BtnCloseChangelog_pressed(): diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index f766f114..9492ee8f 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -3,7 +3,7 @@ extends Node onready var _settings = $"/root/SettingsManager" onready var _ddaPullRequests = $DDAPullRequests onready var _bnPullRequests = $BNPullRequests -onready var _changelogTextBox = $"../ChangelogText" +onready var _changelogTextBox = $"../Panel/Margin/VBox/ChangelogText" var _dda_pr_data = "Downloading recent DDA PRs. Please wait..." var _bn_pr_data = "Downloading recent BN PRs. Please wait..." From 7e5ecb870295a707faf511fa4365159c994e3948 Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Thu, 16 Dec 2021 22:35:15 +0300 Subject: [PATCH 23/31] Improve changelog formatting --- scenes/Catapult.tscn | 5 ++++- scripts/Changelogger.gd | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index fd5e2549..3ff29f17 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -1359,7 +1359,10 @@ margin_right = 462.0 margin_bottom = 255.0 size_flags_horizontal = 3 size_flags_vertical = 3 -custom_fonts/mono_font = ExtResource( 7 ) +custom_fonts/bold_italics_font = ExtResource( 24 ) +custom_fonts/italics_font = ExtResource( 23 ) +custom_fonts/bold_font = ExtResource( 22 ) +custom_fonts/normal_font = ExtResource( 7 ) bbcode_enabled = true text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." __meta__ = { diff --git a/scripts/Changelogger.gd b/scripts/Changelogger.gd index 9492ee8f..4d29a573 100644 --- a/scripts/Changelogger.gd +++ b/scripts/Changelogger.gd @@ -80,8 +80,8 @@ func process_pr_data(pr_data): latest_day = pr.get_day() mon_str = PullRequest.format_two_digit(latest_month) day_str = PullRequest.format_two_digit(latest_day) - r_val = r_val + "\n--- " + str(latest_year) + "-" + mon_str+ "-" + day_str + " ---\n" - r_val = r_val + " * [url=" + pr.get_link() + "]" + pr.get_summary() + "[/url]\n" + r_val = r_val + "\n[b]" + str(latest_year) + "-" + mon_str+ "-" + day_str + "[/b]\n" + r_val = r_val + "[indent]• [url=" + pr.get_link() + "]" + pr.get_summary() + "[/url][/indent]\n" return r_val func _on_ChangelogText_meta_clicked(meta): From 1c50fdfba987e8bd80d82a3124d5a9ae72305c14 Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Thu, 16 Dec 2021 22:39:38 +0300 Subject: [PATCH 24/31] Remove PAT from Settings tab --- scenes/Catapult.tscn | 63 ++++++++----------------------------------- scripts/SettingsUI.gd | 1 - 2 files changed, 11 insertions(+), 53 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 3ff29f17..7097d621 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -128,11 +128,12 @@ margin_bottom = 91.0 ]] margin_top = 97.0 margin_right = 784.0 -margin_bottom = 458.0 +margin_bottom = 629.0 tab_align = 0 script = ExtResource( 16 ) [node name="Game" type="VBoxContainer" parent="Main/Tabs"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -886,7 +887,6 @@ margin_right = 769.0 margin_bottom = 539.0 [node name="Settings" type="VBoxContainer" parent="Main/Tabs"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -977,15 +977,10 @@ min_value = 1.0 value = 30.0 rounded = true -[node name="CLSeparatorTop" type="HSeparator" parent="Main/Tabs/Settings"] -margin_top = 280.0 -margin_right = 769.0 -margin_bottom = 288.0 - [node name="NumPrs" type="HBoxContainer" parent="Main/Tabs/Settings"] -margin_top = 294.0 +margin_top = 280.0 margin_right = 769.0 -margin_bottom = 323.0 +margin_bottom = 309.0 hint_tooltip = "How many latest releases will be requested from GitHub after starting the launcher, choosing the game or clicking Refresh." @@ -1005,44 +1000,10 @@ step = 10.0 value = 100.0 rounded = true -[node name="GitPAT" type="HBoxContainer" parent="Main/Tabs/Settings"] -margin_top = 329.0 -margin_right = 769.0 -margin_bottom = 358.0 -hint_tooltip = "How many latest releases will be requested -from GitHub after starting the launcher, choosing -the game or clicking Refresh." -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="PATLabel" type="Label" parent="Main/Tabs/Settings/GitPAT"] -margin_right = 348.0 -margin_bottom = 29.0 -text = "Github API Personal Access Token (optional):" - -[node name="lePATUse" type="LineEdit" parent="Main/Tabs/Settings/GitPAT"] -margin_left = 354.0 -margin_right = 769.0 -margin_bottom = 29.0 -hint_tooltip = "Unauthenticated requests against the -GitHub API are unreliable. Create a GitHub -Personal Access Token if you're getting -5xx errors when trying to view the changelog." -size_flags_horizontal = 11 - -[node name="CLSeparatorBottom" type="HSeparator" parent="Main/Tabs/Settings"] -margin_top = 364.0 -margin_right = 769.0 -margin_bottom = 372.0 -__meta__ = { -"_edit_use_anchors_": false -} - [node name="ScaleOverride" type="HBoxContainer" parent="Main/Tabs/Settings"] -margin_top = 378.0 +margin_top = 315.0 margin_right = 769.0 -margin_bottom = 407.0 +margin_bottom = 344.0 hint_tooltip = "Use this if the automatically inferred UI scale looks too large or too small on your system. (Automatic scale relies on system-reported @@ -1079,14 +1040,14 @@ editable = false suffix = "%" [node name="HSeparator" type="HSeparator" parent="Main/Tabs/Settings"] -margin_top = 413.0 +margin_top = 350.0 margin_right = 769.0 -margin_bottom = 421.0 +margin_bottom = 358.0 [node name="Migration" type="VBoxContainer" parent="Main/Tabs/Settings"] -margin_top = 427.0 +margin_top = 364.0 margin_right = 769.0 -margin_bottom = 549.0 +margin_bottom = 486.0 hint_tooltip = "Choose which types of game data to carry over into the new game version when updating." @@ -1242,7 +1203,7 @@ size_flags_horizontal = 4 text = "Test path resolution in PathHelper" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 464.0 +margin_top = 635.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 @@ -1317,7 +1278,6 @@ __meta__ = { } [node name="ChangelogPopup" type="WindowDialog" parent="."] -visible = true anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 @@ -1439,7 +1399,6 @@ script = ExtResource( 32 ) [connection signal="toggled" from="Main/Tabs/Settings/ShowDebug" to="Main/Tabs/Settings" method="_on_ShowDebug_toggled"] [connection signal="value_changed" from="Main/Tabs/Settings/NumReleases/sbNumReleases" to="Main/Tabs/Settings" method="_on_sbNumReleases_value_changed"] [connection signal="value_changed" from="Main/Tabs/Settings/NumPrs/sbNumPRs" to="Main/Tabs/Settings" method="_on_sbNumPRs_value_changed"] -[connection signal="text_changed" from="Main/Tabs/Settings/GitPAT/lePATUse" to="Main/Tabs/Settings" method="_on_lePATUse_text_changed"] [connection signal="toggled" from="Main/Tabs/Settings/ScaleOverride/cbScaleOverrideEnable" to="Main/Tabs/Settings" method="_on_cbScaleOverrideEnable_toggled"] [connection signal="value_changed" from="Main/Tabs/Settings/ScaleOverride/sbScaleOverride" to="Main/Tabs/Settings" method="_on_sbScaleOverride_value_changed"] [connection signal="toggled" from="Main/Tabs/Settings/Migration/Grid/Savegames" to="Main/Tabs/Settings" method="_on_any_migration_checkbox_toggled"] diff --git a/scripts/SettingsUI.gd b/scripts/SettingsUI.gd index fe440193..7ed3f0cb 100644 --- a/scripts/SettingsUI.gd +++ b/scripts/SettingsUI.gd @@ -31,7 +31,6 @@ func _ready() -> void: $ShowDebug.pressed = _settings.read("debug_mode") $NumReleases/sbNumReleases.value = _settings.read("num_releases_to_request") as int $NumPrs/sbNumPRs.value = _settings.read("num_prs_to_request") as int - $GitPAT/lePATUse.text = _settings.read("github_pat") $ScaleOverride/cbScaleOverrideEnable.pressed = _settings.read("ui_scale_override_enabled") $ScaleOverride/sbScaleOverride.editable = _settings.read("ui_scale_override_enabled") From 2cd2df529f3e6572842f0e3c1bfb234999319f60 Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Thu, 16 Dec 2021 23:23:01 +0300 Subject: [PATCH 25/31] Make Changelog a separate scene --- scenes/Catapult.tscn | 85 ++----------------- scenes/ChangelogDialog.tscn | 82 ++++++++++++++++++ scripts/Catapult.gd | 11 +-- .../{Changelogger.gd => ChangelogDialod.gd} | 34 +++++--- 4 files changed, 115 insertions(+), 97 deletions(-) create mode 100644 scenes/ChangelogDialog.tscn rename scripts/{Changelogger.gd => ChangelogDialod.gd} (93%) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 7097d621..aab9c5d4 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -31,7 +31,7 @@ [ext_resource path="res://scenes/FontSizeHelpDialog.tscn" type="PackedScene" id=29] [ext_resource path="res://icons/help.svg" type="Texture" id=30] [ext_resource path="res://scripts/PathHelper.gd" type="Script" id=31] -[ext_resource path="res://scripts/Changelogger.gd" type="Script" id=32] +[ext_resource path="res://scenes/ChangelogDialog.tscn" type="PackedScene" id=32] [sub_resource type="ButtonGroup" id=1] @@ -128,12 +128,11 @@ margin_bottom = 91.0 ]] margin_top = 97.0 margin_right = 784.0 -margin_bottom = 629.0 +margin_bottom = 458.0 tab_align = 0 script = ExtResource( 16 ) [node name="Game" type="VBoxContainer" parent="Main/Tabs"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -298,6 +297,9 @@ margin_top = 315.0 margin_right = 769.0 margin_bottom = 315.0 +[node name="ChangelogDialog" parent="Main/Tabs/Game" instance=ExtResource( 32 )] +visible = false + [node name="Mods" type="VBoxContainer" parent="Main/Tabs"] visible = false anchor_right = 1.0 @@ -887,6 +889,7 @@ margin_right = 769.0 margin_bottom = 539.0 [node name="Settings" type="VBoxContainer" parent="Main/Tabs"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -1203,7 +1206,7 @@ size_flags_horizontal = 4 text = "Test path resolution in PathHelper" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 635.0 +margin_top = 464.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 @@ -1277,76 +1280,6 @@ __meta__ = { "_editor_description_": "The centralized location for all path resolutions in the launcher." } -[node name="ChangelogPopup" type="WindowDialog" parent="."] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -240.0 -margin_top = -160.0 -margin_right = 240.0 -margin_bottom = 160.0 - -[node name="Panel" type="PanelContainer" parent="ChangelogPopup"] -anchor_right = 1.0 -anchor_bottom = 1.0 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Margin" type="MarginContainer" parent="ChangelogPopup/Panel"] -margin_left = 9.0 -margin_top = 6.0 -margin_right = 471.0 -margin_bottom = 314.0 -custom_constants/margin_top = 8 -custom_constants/margin_bottom = 8 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="VBox" type="VBoxContainer" parent="ChangelogPopup/Panel/Margin"] -margin_top = 8.0 -margin_right = 462.0 -margin_bottom = 300.0 -custom_constants/separation = 8 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="ChangelogText" type="RichTextLabel" parent="ChangelogPopup/Panel/Margin/VBox"] -margin_right = 462.0 -margin_bottom = 255.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -custom_fonts/bold_italics_font = ExtResource( 24 ) -custom_fonts/italics_font = ExtResource( 23 ) -custom_fonts/bold_font = ExtResource( 22 ) -custom_fonts/normal_font = ExtResource( 7 ) -bbcode_enabled = true -text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="BtnCloseChangelog" type="Button" parent="ChangelogPopup/Panel/Margin/VBox"] -margin_left = 201.0 -margin_top = 263.0 -margin_right = 260.0 -margin_bottom = 292.0 -size_flags_horizontal = 4 -text = "Close" -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Changelogger" type="Node" parent="ChangelogPopup"] -script = ExtResource( 32 ) - -[node name="DDAPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] - -[node name="BNPullRequests" type="HTTPRequest" parent="ChangelogPopup/Changelogger"] - [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"] @@ -1444,7 +1377,3 @@ script = ExtResource( 32 ) [connection signal="status_message" from="Sound" to="." method="_on_status_message"] [connection signal="status_message" from="Fonts" to="." method="_on_status_message"] [connection signal="status_message" from="PathHelper" to="." method="_on_status_message"] -[connection signal="meta_clicked" from="ChangelogPopup/Panel/Margin/VBox/ChangelogText" to="ChangelogPopup/Changelogger" method="_on_ChangelogText_meta_clicked"] -[connection signal="pressed" from="ChangelogPopup/Panel/Margin/VBox/BtnCloseChangelog" to="." method="_on_BtnCloseChangelog_pressed"] -[connection signal="request_completed" from="ChangelogPopup/Changelogger/DDAPullRequests" to="ChangelogPopup/Changelogger" method="_on_DDAPullRequests_request_completed"] -[connection signal="request_completed" from="ChangelogPopup/Changelogger/BNPullRequests" to="ChangelogPopup/Changelogger" method="_on_BNPullRequests_request_completed"] diff --git a/scenes/ChangelogDialog.tscn b/scenes/ChangelogDialog.tscn new file mode 100644 index 00000000..efa88927 --- /dev/null +++ b/scenes/ChangelogDialog.tscn @@ -0,0 +1,82 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://scripts/ChangelogDialod.gd" type="Script" id=1] +[ext_resource path="res://fonts/OpenSans-SemiboldItalic.tres" type="DynamicFont" id=2] +[ext_resource path="res://fonts/OpenSans-Regular.tres" type="DynamicFont" id=3] +[ext_resource path="res://fonts/OpenSans-Italic.tres" type="DynamicFont" id=4] +[ext_resource path="res://fonts/OpenSans-Semibold.tres" type="DynamicFont" id=5] + +[node name="ChangelogDialog" type="WindowDialog"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -240.0 +margin_top = -160.0 +margin_right = 240.0 +margin_bottom = 160.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Panel" type="PanelContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Margin" type="MarginContainer" parent="Panel"] +margin_left = 9.0 +margin_top = 6.0 +margin_right = 471.0 +margin_bottom = 314.0 +custom_constants/margin_top = 8 +custom_constants/margin_bottom = 8 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBox" type="VBoxContainer" parent="Panel/Margin"] +margin_top = 8.0 +margin_right = 462.0 +margin_bottom = 300.0 +custom_constants/separation = 8 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ChangelogText" type="RichTextLabel" parent="Panel/Margin/VBox"] +margin_right = 462.0 +margin_bottom = 255.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/bold_italics_font = ExtResource( 2 ) +custom_fonts/italics_font = ExtResource( 4 ) +custom_fonts/bold_font = ExtResource( 5 ) +custom_fonts/normal_font = ExtResource( 3 ) +bbcode_enabled = true +text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="BtnCloseChangelog" type="Button" parent="Panel/Margin/VBox"] +margin_left = 201.0 +margin_top = 263.0 +margin_right = 260.0 +margin_bottom = 292.0 +size_flags_horizontal = 4 +text = "Close" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="DDAPullRequests" type="HTTPRequest" parent="."] + +[node name="BNPullRequests" type="HTTPRequest" parent="."] + +[connection signal="pressed" from="Panel/Margin/VBox/BtnCloseChangelog" to="." method="_on_BtnCloseChangelog_pressed"] +[connection signal="request_completed" from="DDAPullRequests" to="." method="_on_DDAPullRequests_request_completed"] +[connection signal="request_completed" from="BNPullRequests" to="." method="_on_BNPullRequests_request_completed"] diff --git a/scripts/Catapult.gd b/scripts/Catapult.gd index 5f254401..36a89e62 100644 --- a/scripts/Catapult.gd +++ b/scripts/Catapult.gd @@ -25,6 +25,7 @@ onready var _fshelper = $FSHelper onready var _installer = $ReleaseInstaller onready var _btn_install = $Main/Tabs/Game/BtnInstall onready var _btn_refresh = $Main/Tabs/Game/Builds/BtnRefresh +onready var changelog = $Main/Tabs/Game/ChangelogDialog onready var _btn_changelog = $Main/Tabs/Game/BtnChangelog onready var _btn_game_dir = $Main/Tabs/Game/CurrentInstall/Build/GameDir onready var _btn_play = $Main/Tabs/Game/CurrentInstall/BtnPlay @@ -33,7 +34,6 @@ onready var _lst_games = $Main/GameChoice/GamesList onready var _rbtn_stable = $Main/Tabs/Game/Channel/Group/RBtnStable onready var _rbtn_exper = $Main/Tabs/Game/Channel/Group/RBtnExperimental onready var _lbl_build = $Main/Tabs/Game/CurrentInstall/Build/Name -onready var _changelogger = $ChangelogPopup/Changelogger var _disable_savestate = {} var _ui_staring_sizes = {} # For UI scaling on the fly @@ -305,14 +305,11 @@ func _on_BtnInstall_pressed() -> void: var update = _settings.read("game") in _inst_probe.probe_installed_games() _installer.install_release(release, _settings.read("game"), update) + func _on_BtnChangelog_pressed() -> void: - $ChangelogPopup.rect_min_size = get_tree().root.size * Vector2(0.9, 0.9) - $ChangelogPopup.set_as_minsize() - $ChangelogPopup.popup_centered() - _changelogger.download_pull_requests() -func _on_BtnCloseChangelog_pressed(): - $ChangelogPopup.hide() + changelog.open() + func _get_release_key() -> String: # Compiles a string looking like "dda-stable" or "bn-experimental" diff --git a/scripts/Changelogger.gd b/scripts/ChangelogDialod.gd similarity index 93% rename from scripts/Changelogger.gd rename to scripts/ChangelogDialod.gd index 4d29a573..f099b3e7 100644 --- a/scripts/Changelogger.gd +++ b/scripts/ChangelogDialod.gd @@ -1,16 +1,21 @@ -extends Node +extends WindowDialog onready var _settings = $"/root/SettingsManager" onready var _ddaPullRequests = $DDAPullRequests onready var _bnPullRequests = $BNPullRequests -onready var _changelogTextBox = $"../Panel/Margin/VBox/ChangelogText" +onready var _changelogTextBox = $Panel/Margin/VBox/ChangelogText -var _dda_pr_data = "Downloading recent DDA PRs. Please wait..." -var _bn_pr_data = "Downloading recent BN PRs. Please wait..." +var _dda_pr_data = "" +var _bn_pr_data = "" + + +func open() -> void: + + download_pull_requests() + rect_min_size = get_tree().root.size * Vector2(0.9, 0.9) + set_as_minsize() + popup_centered() -# Called when the node enters the scene tree for the first time. -func _ready(): - pass func download_pull_requests(): var game_selected = _settings.read("game") @@ -37,6 +42,7 @@ func download_pull_requests(): else: _changelogTextBox.append_bbcode(_bn_pr_data) + func _on_DDAPullRequests_request_completed(result, response_code, headers, body): if response_code != 200: _dda_pr_data = "Error retrieving data from the GitHub API. (Response code: " + str(response_code) + ")" @@ -45,6 +51,7 @@ func _on_DDAPullRequests_request_completed(result, response_code, headers, body) _changelogTextBox.clear() _changelogTextBox.append_bbcode(_dda_pr_data) + func _on_BNPullRequests_request_completed(result, response_code, headers, body): if response_code != 200: _bn_pr_data = "Error retrieving data from the GitHub API. (Response code: " + str(response_code) + ")" @@ -53,6 +60,7 @@ func _on_BNPullRequests_request_completed(result, response_code, headers, body): _changelogTextBox.clear() _changelogTextBox.append_bbcode(_bn_pr_data) + func process_pr_data(pr_data): var pr_array = [] for json in pr_data: @@ -84,9 +92,11 @@ func process_pr_data(pr_data): r_val = r_val + "[indent]• [url=" + pr.get_link() + "]" + pr.get_summary() + "[/url][/indent]\n" return r_val + func _on_ChangelogText_meta_clicked(meta): OS.shell_open(str(meta)) + class PullRequest: var timestring setget set_timestring,get_timestring var year setget ,get_year @@ -150,9 +160,7 @@ class PullRequest: link) r_val.set_timestring(date) return r_val - - func _init(y, mo, d, h, mi, s, sum, url): year = y month = mo @@ -162,8 +170,10 @@ class PullRequest: second = s summary = sum link = url - - - + func print_date(): return str(year) + "-" + str(month) + "-" + str(day) + + +func _on_BtnCloseChangelog_pressed() -> void: + hide() From d537cb8611756585cabcf2e6884c68d33e04d020 Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Thu, 16 Dec 2021 23:37:14 +0300 Subject: [PATCH 26/31] Use single request node for both games --- scenes/ChangelogDialog.tscn | 7 ++--- scripts/ChangelogDialod.gd | 55 ++++++++++++++----------------------- 2 files changed, 23 insertions(+), 39 deletions(-) diff --git a/scenes/ChangelogDialog.tscn b/scenes/ChangelogDialog.tscn index efa88927..dc3f1539 100644 --- a/scenes/ChangelogDialog.tscn +++ b/scenes/ChangelogDialog.tscn @@ -73,10 +73,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="DDAPullRequests" type="HTTPRequest" parent="."] - -[node name="BNPullRequests" type="HTTPRequest" parent="."] +[node name="PullRequests" type="HTTPRequest" parent="."] [connection signal="pressed" from="Panel/Margin/VBox/BtnCloseChangelog" to="." method="_on_BtnCloseChangelog_pressed"] -[connection signal="request_completed" from="DDAPullRequests" to="." method="_on_DDAPullRequests_request_completed"] -[connection signal="request_completed" from="BNPullRequests" to="." method="_on_BNPullRequests_request_completed"] +[connection signal="request_completed" from="PullRequests" to="." method="_on_PullRequests_request_completed"] diff --git a/scripts/ChangelogDialod.gd b/scripts/ChangelogDialod.gd index f099b3e7..93cb4d28 100644 --- a/scripts/ChangelogDialod.gd +++ b/scripts/ChangelogDialod.gd @@ -1,12 +1,17 @@ extends WindowDialog + +const _PR_URL = { + "dda": "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls", + "bn": "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls", +} + + onready var _settings = $"/root/SettingsManager" -onready var _ddaPullRequests = $DDAPullRequests -onready var _bnPullRequests = $BNPullRequests +onready var _pullRequests = $PullRequests onready var _changelogTextBox = $Panel/Margin/VBox/ChangelogText -var _dda_pr_data = "" -var _bn_pr_data = "" +var _pr_data = "" func open() -> void: @@ -20,50 +25,32 @@ func open() -> void: func download_pull_requests(): var game_selected = _settings.read("game") var prs = _settings.read("num_prs_to_request") - var dda_pr_url = "https://api.github.com/repos/cleverraven/cataclysm-dda/pulls?state=closed&sort=updated&direction=desc&per_page=" + prs - var bn_pr_url = "https://api.github.com/repos/cataclysmbnteam/Cataclysm-BN/pulls?state=closed&sort=updated&direction=desc&per_page=" + prs + var url = _PR_URL[_settings.read("game")] + url += "?state=closed&sort=updated&direction=desc&per_page=" + prs var headers = ["user-agent: CatapultGodotApp"] var pat = _settings.read("github_pat") if (pat.length() == 40): headers.push_back("Authorization: token " + pat) - if _dda_pr_data.length() < 65 and game_selected == "dda": - _dda_pr_data = "Downloading recent DDA PRs. Please wait..." - _ddaPullRequests.request(dda_pr_url, headers) - _changelogTextBox.clear() - _changelogTextBox.append_bbcode(_dda_pr_data) - if _bn_pr_data.length() < 65 and game_selected == "bn": - _bn_pr_data = "Downloading recent BN PRs. Please wait..." - _bnPullRequests.request(bn_pr_url, headers) - _changelogTextBox.clear() - _changelogTextBox.append_bbcode(_bn_pr_data) + _pr_data = "Downloading recent PRs. Please wait..." + _pullRequests.request(url, headers) _changelogTextBox.clear() - if game_selected == "dda": - _changelogTextBox.append_bbcode(_dda_pr_data) - else: - _changelogTextBox.append_bbcode(_bn_pr_data) - - -func _on_DDAPullRequests_request_completed(result, response_code, headers, body): - if response_code != 200: - _dda_pr_data = "Error retrieving data from the GitHub API. (Response code: " + str(response_code) + ")" - else: - _dda_pr_data = process_pr_data(parse_json(body.get_string_from_utf8())) + _changelogTextBox.append_bbcode(_pr_data) _changelogTextBox.clear() - _changelogTextBox.append_bbcode(_dda_pr_data) + _changelogTextBox.append_bbcode(_pr_data) -func _on_BNPullRequests_request_completed(result, response_code, headers, body): +func _on_PullRequests_request_completed(result, response_code, headers, body): if response_code != 200: - _bn_pr_data = "Error retrieving data from the GitHub API. (Response code: " + str(response_code) + ")" + _pr_data = "Error retrieving data from the GitHub API. (Response code: " + str(response_code) + ")" else: - _bn_pr_data = process_pr_data(parse_json(body.get_string_from_utf8())) + _pr_data = process_pr_data(parse_json(body.get_string_from_utf8())) _changelogTextBox.clear() - _changelogTextBox.append_bbcode(_bn_pr_data) + _changelogTextBox.append_bbcode(_pr_data) -func process_pr_data(pr_data): +func process_pr_data(data): var pr_array = [] - for json in pr_data: + for json in data: if json["merged_at"] == null or json["merged_at"] == "null" : continue var pr = PullRequest.pullrequest_from_datestring(json["merged_at"], json["title"], json["html_url"]) From 83519d9de5ced8e75d135af57b89d7f16ddc2492 Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Thu, 16 Dec 2021 23:43:55 +0300 Subject: [PATCH 27/31] Improve changelog error message --- scripts/ChangelogDialod.gd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/ChangelogDialod.gd b/scripts/ChangelogDialod.gd index 93cb4d28..13b31c5b 100644 --- a/scripts/ChangelogDialod.gd +++ b/scripts/ChangelogDialod.gd @@ -40,10 +40,14 @@ func download_pull_requests(): func _on_PullRequests_request_completed(result, response_code, headers, body): + var json = parse_json(body.get_string_from_utf8()) if response_code != 200: - _pr_data = "Error retrieving data from the GitHub API. (Response code: " + str(response_code) + ")" + _pr_data = "Error retrieving data from GitHub API." + _pr_data += "\nHTTP response code: " + str(response_code) + if "message" in json: + _pr_data += "\nGitHub says: [i]%s[/i]" % json["message"] else: - _pr_data = process_pr_data(parse_json(body.get_string_from_utf8())) + _pr_data = process_pr_data(json) _changelogTextBox.clear() _changelogTextBox.append_bbcode(_pr_data) From 0917720ef17cf2b29673530f4ea26672a6444aa3 Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Thu, 16 Dec 2021 23:53:38 +0300 Subject: [PATCH 28/31] Open changelog via link in game description --- scenes/Catapult.tscn | 33 ++++++++------------------------- scripts/Catapult.gd | 19 +++++++------------ 2 files changed, 15 insertions(+), 37 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index aab9c5d4..834a9c40 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -128,7 +128,7 @@ margin_bottom = 91.0 ]] margin_top = 97.0 margin_right = 784.0 -margin_bottom = 458.0 +margin_bottom = 418.0 tab_align = 0 script = ExtResource( 16 ) @@ -225,30 +225,15 @@ text = "Install Selected" icon = ExtResource( 2 ) expand_icon = true -[node name="BtnChangelog" type="Button" parent="Main/Tabs/Game"] -margin_left = 294.0 -margin_top = 149.0 -margin_right = 474.0 -margin_bottom = 181.0 -rect_min_size = Vector2( 180, 32 ) -hint_tooltip = "Use the Github API to view a list of -recent changes for the selected game. -(Requires an internet connection)" -size_flags_horizontal = 4 -text = "View Recent Changes" -__meta__ = { -"_edit_use_anchors_": false -} - [node name="HSeparator" type="HSeparator" parent="Main/Tabs/Game"] -margin_top = 189.0 +margin_top = 149.0 margin_right = 769.0 -margin_bottom = 197.0 +margin_bottom = 157.0 [node name="CurrentInstall" type="VBoxContainer" parent="Main/Tabs/Game"] -margin_top = 205.0 +margin_top = 165.0 margin_right = 769.0 -margin_bottom = 307.0 +margin_bottom = 267.0 [node name="Label" type="Label" parent="Main/Tabs/Game/CurrentInstall"] margin_right = 769.0 @@ -293,12 +278,11 @@ icon = ExtResource( 3 ) expand_icon = true [node name="Spacer" type="Control" parent="Main/Tabs/Game"] -margin_top = 315.0 +margin_top = 275.0 margin_right = 769.0 -margin_bottom = 315.0 +margin_bottom = 275.0 [node name="ChangelogDialog" parent="Main/Tabs/Game" instance=ExtResource( 32 )] -visible = false [node name="Mods" type="VBoxContainer" parent="Main/Tabs"] visible = false @@ -1206,7 +1190,7 @@ size_flags_horizontal = 4 text = "Test path resolution in PathHelper" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 464.0 +margin_top = 424.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 @@ -1288,7 +1272,6 @@ __meta__ = { [connection signal="item_selected" from="Main/Tabs/Game/Builds/BuildsList" to="." method="_on_BuildsList_item_selected"] [connection signal="pressed" from="Main/Tabs/Game/Builds/BtnRefresh" to="." method="_on_BtnRefresh_pressed"] [connection signal="pressed" from="Main/Tabs/Game/BtnInstall" to="." method="_on_BtnInstall_pressed"] -[connection signal="pressed" from="Main/Tabs/Game/BtnChangelog" to="." method="_on_BtnChangelog_pressed"] [connection signal="pressed" from="Main/Tabs/Game/CurrentInstall/Build/GameDir" to="." method="_on_GameDir_pressed"] [connection signal="pressed" from="Main/Tabs/Game/CurrentInstall/BtnPlay" to="." method="_on_BtnPlay_pressed"] [connection signal="status_message" from="Main/Tabs/Mods" to="." method="_on_status_message"] diff --git a/scripts/Catapult.gd b/scripts/Catapult.gd index 36a89e62..6bafed3a 100644 --- a/scripts/Catapult.gd +++ b/scripts/Catapult.gd @@ -3,9 +3,9 @@ extends Node const _GAME_DESC = { "dda": - "[b]Cataclysm: Dark Days Ahead[/b] is a turn-based survival game set in a post-apocalyptic world. Scavenge, explore, craft, build, farm, repair and modify vehicles, install bionics, mutate, defend against [color=#009900]zombies[/color] and countless other monstrosities — all in a limitless, procedurally generated world!", + "[b]Cataclysm: Dark Days Ahead[/b] is a turn-based survival game set in a post-apocalyptic world. Scavenge, explore, craft, build, farm, repair and modify vehicles, install bionics, mutate, defend against [color=#009900]zombies[/color] and countless other monstrosities — all in a limitless, procedurally generated world! [color=#3b93f7][url=CHANGELOG]View Changelog[/url][/color]", "bn": - "[b]Cataclysm: Bright Nights[/b]. Reject pedantry, embrace [color=#ff3300]!!fun!![/color]. This fork takes the game back to its sci-fi roguelike roots and reverts many controversial changes by the DDA team (pockets, proficiencies, freezing, and [color=#3b93f7][url=https://github.com/cataclysmbnteam/Cataclysm-BN/wiki/Changes-so-far]more[/url][/color]). Special attention is paid to combat, game balance and pacing.", + "[b]Cataclysm: Bright Nights[/b]. Reject pedantry, embrace [color=#ff3300]!!fun!![/color]. This fork takes the game back to its sci-fi roguelike roots and reverts many controversial changes by the DDA team (pockets, proficiencies, freezing, and [color=#3b93f7][url=https://github.com/cataclysmbnteam/Cataclysm-BN/wiki/Changes-so-far]more[/url][/color]). Special attention is paid to combat, game balance and pacing. [color=#3b93f7][url=CHANGELOG]View Changelog[/url][/color]", } onready var _settings = $"/root/SettingsManager" @@ -25,8 +25,7 @@ onready var _fshelper = $FSHelper onready var _installer = $ReleaseInstaller onready var _btn_install = $Main/Tabs/Game/BtnInstall onready var _btn_refresh = $Main/Tabs/Game/Builds/BtnRefresh -onready var changelog = $Main/Tabs/Game/ChangelogDialog -onready var _btn_changelog = $Main/Tabs/Game/BtnChangelog +onready var _changelog = $Main/Tabs/Game/ChangelogDialog onready var _btn_game_dir = $Main/Tabs/Game/CurrentInstall/Build/GameDir onready var _btn_play = $Main/Tabs/Game/CurrentInstall/BtnPlay onready var _lst_builds = $Main/Tabs/Game/Builds/BuildsList @@ -272,7 +271,10 @@ func _on_soundpack_operation_finished() -> void: func _on_Description_meta_clicked(meta) -> void: - OS.shell_open(meta) + if meta == "CHANGELOG": + _changelog.open() + else: + OS.shell_open(meta) func _on_BtnRefresh_pressed() -> void: @@ -306,11 +308,6 @@ func _on_BtnInstall_pressed() -> void: _installer.install_release(release, _settings.read("game"), update) -func _on_BtnChangelog_pressed() -> void: - - changelog.open() - - func _get_release_key() -> String: # Compiles a string looking like "dda-stable" or "bn-experimental" # from settings. @@ -372,10 +369,8 @@ func apply_game_choice() -> void: if channel == "stable": _rbtn_stable.pressed = true _btn_refresh.disabled = true - _btn_changelog.disabled = true else: _btn_refresh.disabled = false - _btn_changelog.disabled = false "bn": _lst_games.select(1) From aa15693a8278833cb2b443f605b0665b52a02cd0 Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Fri, 17 Dec 2021 00:34:58 +0300 Subject: [PATCH 29/31] Changelog: accessibility pass --- scenes/Catapult.tscn | 16 ++++++++-------- scenes/ChangelogDialog.tscn | 2 ++ scripts/ChangelogDialod.gd | 22 +++++++++++++++++----- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 834a9c40..bf1afeae 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -128,11 +128,12 @@ margin_bottom = 91.0 ]] margin_top = 97.0 margin_right = 784.0 -margin_bottom = 418.0 +margin_bottom = 629.0 tab_align = 0 script = ExtResource( 16 ) [node name="Game" type="VBoxContainer" parent="Main/Tabs"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -873,7 +874,6 @@ margin_right = 769.0 margin_bottom = 539.0 [node name="Settings" type="VBoxContainer" parent="Main/Tabs"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -968,14 +968,14 @@ rounded = true margin_top = 280.0 margin_right = 769.0 margin_bottom = 309.0 -hint_tooltip = "How many latest releases will be requested -from GitHub after starting the launcher, choosing -the game or clicking Refresh." +hint_tooltip = "How many recent pull requests (code additions) +will be requested from GitHub to form the changelog. +High numbers may lead to slow responses and failures." [node name="Label" type="Label" parent="Main/Tabs/Settings/NumPrs"] -margin_right = 429.0 +margin_right = 390.0 margin_bottom = 29.0 -text = "Number of pull requests to download in the changelog:" +text = "Number of results to download for the changelog:" [node name="sbNumPRs" type="SpinBox" parent="Main/Tabs/Settings/NumPrs"] margin_left = 639.0 @@ -1190,7 +1190,7 @@ size_flags_horizontal = 4 text = "Test path resolution in PathHelper" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 424.0 +margin_top = 635.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 diff --git a/scenes/ChangelogDialog.tscn b/scenes/ChangelogDialog.tscn index dc3f1539..ca83bb2d 100644 --- a/scenes/ChangelogDialog.tscn +++ b/scenes/ChangelogDialog.tscn @@ -74,6 +74,8 @@ __meta__ = { } [node name="PullRequests" type="HTTPRequest" parent="."] +timeout = 20 +[connection signal="meta_clicked" from="Panel/Margin/VBox/ChangelogText" to="." method="_on_ChangelogText_meta_clicked"] [connection signal="pressed" from="Panel/Margin/VBox/BtnCloseChangelog" to="." method="_on_BtnCloseChangelog_pressed"] [connection signal="request_completed" from="PullRequests" to="." method="_on_PullRequests_request_completed"] diff --git a/scripts/ChangelogDialod.gd b/scripts/ChangelogDialod.gd index 13b31c5b..3b179aa3 100644 --- a/scripts/ChangelogDialod.gd +++ b/scripts/ChangelogDialod.gd @@ -31,7 +31,7 @@ func download_pull_requests(): var pat = _settings.read("github_pat") if (pat.length() == 40): headers.push_back("Authorization: token " + pat) - _pr_data = "Downloading recent PRs. Please wait..." + _pr_data = "Fetching recent changes from GitHub. Please wait..." _pullRequests.request(url, headers) _changelogTextBox.clear() _changelogTextBox.append_bbcode(_pr_data) @@ -43,9 +43,10 @@ func _on_PullRequests_request_completed(result, response_code, headers, body): var json = parse_json(body.get_string_from_utf8()) if response_code != 200: _pr_data = "Error retrieving data from GitHub API." - _pr_data += "\nHTTP response code: " + str(response_code) - if "message" in json: + _pr_data += "\n\nHTTP response code: " + str(response_code) + if (json) and ("message" in json): _pr_data += "\nGitHub says: [i]%s[/i]" % json["message"] + _pr_data += "\n\nIf you keep getting errors for no apparent reason, try reducing the number of results in the Settings." else: _pr_data = process_pr_data(json) _changelogTextBox.clear() @@ -66,9 +67,20 @@ func process_pr_data(data): var latest_day = now["day"] var mon_str = PullRequest.format_two_digit(str(latest_month)) var day_str = PullRequest.format_two_digit(str(latest_day)) - var r_val ="" + + var game_title = "" + match _settings.read("game"): + "dda": + game_title = "Cataclysm: Dark Days Ahead" + "bn": + game_title = "Cataclysm: Bright Nights" + _: + game_title = "{BUG!!}" + + var r_val = ("Showing the last [b]%s[/b] completed pull requests (code additions) to [b]%s[/b].\n\nThe chronology may be slightly off due to GitHub API limitations.\n\nYou can click on any item to view the corresponding PR on GitHub and learn more about the change.\n" + % [_settings.read("num_prs_to_request"), game_title]) + for pr in pr_array: - #print(str(pr.get_year()) + "-" + str(pr.get_month()) + "-" + str(pr.get_day())) var switch_date = false switch_date = switch_date or (pr.get_year() < latest_year) switch_date = switch_date or (pr.get_month() < latest_month) From 655b6b5d318d0e47ba3079f81b147ac75ff62864 Mon Sep 17 00:00:00 2001 From: qrrk <19731636+qrrk@users.noreply.github.com> Date: Fri, 17 Dec 2021 01:03:34 +0300 Subject: [PATCH 30/31] Changelog error message correction --- scenes/Catapult.tscn | 6 +++--- scripts/ChangelogDialod.gd | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index bf1afeae..099ea477 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -128,12 +128,11 @@ margin_bottom = 91.0 ]] margin_top = 97.0 margin_right = 784.0 -margin_bottom = 629.0 +margin_bottom = 418.0 tab_align = 0 script = ExtResource( 16 ) [node name="Game" type="VBoxContainer" parent="Main/Tabs"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -874,6 +873,7 @@ margin_right = 769.0 margin_bottom = 539.0 [node name="Settings" type="VBoxContainer" parent="Main/Tabs"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -1190,7 +1190,7 @@ size_flags_horizontal = 4 text = "Test path resolution in PathHelper" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 635.0 +margin_top = 424.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 diff --git a/scripts/ChangelogDialod.gd b/scripts/ChangelogDialod.gd index 3b179aa3..0a1ac7e3 100644 --- a/scripts/ChangelogDialod.gd +++ b/scripts/ChangelogDialod.gd @@ -46,7 +46,7 @@ func _on_PullRequests_request_completed(result, response_code, headers, body): _pr_data += "\n\nHTTP response code: " + str(response_code) if (json) and ("message" in json): _pr_data += "\nGitHub says: [i]%s[/i]" % json["message"] - _pr_data += "\n\nIf you keep getting errors for no apparent reason, try reducing the number of results in the Settings." + _pr_data += "\n\nSometimes, requests will fail repeatedly due to excessive load on the server, especially for DDA. This may depend on the time of day, your location, etc. There's little anyone can do about this. If you are registered on GitHub, you can add your PAT (Personal Access Token) to Catapult config file to increase the priority of your requests or bypass rate limits." else: _pr_data = process_pr_data(json) _changelogTextBox.clear() From 6e7974d6683910de0cd554ce4c221d617b30f545 Mon Sep 17 00:00:00 2001 From: Inglonias <2125926+Inglonias@users.noreply.github.com> Date: Thu, 16 Dec 2021 17:34:02 -0500 Subject: [PATCH 31/31] Added a link with instructions for creating a PAT --- scripts/ChangelogDialod.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ChangelogDialod.gd b/scripts/ChangelogDialod.gd index 0a1ac7e3..9902da34 100644 --- a/scripts/ChangelogDialod.gd +++ b/scripts/ChangelogDialod.gd @@ -46,7 +46,7 @@ func _on_PullRequests_request_completed(result, response_code, headers, body): _pr_data += "\n\nHTTP response code: " + str(response_code) if (json) and ("message" in json): _pr_data += "\nGitHub says: [i]%s[/i]" % json["message"] - _pr_data += "\n\nSometimes, requests will fail repeatedly due to excessive load on the server, especially for DDA. This may depend on the time of day, your location, etc. There's little anyone can do about this. If you are registered on GitHub, you can add your PAT (Personal Access Token) to Catapult config file to increase the priority of your requests or bypass rate limits." + _pr_data += "\n\nSometimes, requests will fail repeatedly due to excessive load on the server, especially for DDA. This may depend on the time of day, your location, etc. There's little anyone can do about this. If you are registered on GitHub, you can add your [url=https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token]PAT (Personal Access Token)[/url] to Catapult config file to increase the priority of your requests or bypass rate limits." else: _pr_data = process_pr_data(json) _changelogTextBox.clear()