From 59974adb993d31ca9c5b90a487e0c88ce724bb4b Mon Sep 17 00:00:00 2001 From: Rikko Date: Sat, 17 Dec 2022 22:28:44 +0530 Subject: [PATCH 01/13] Play back press sound only once --- plugin_manager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin_manager.py b/plugin_manager.py index 51051ad..0b89e5e 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -1420,7 +1420,6 @@ class PluginManagerWindow(ba.Window): ) def _back(self) -> None: - play_sound() from bastd.ui.settings.allsettings import AllSettingsWindow ba.containerwidget(edit=self._root_widget, transition=self._transition_out) From 7a8e9d3155a6d4571503fa6cb19e1e22884a2ceb Mon Sep 17 00:00:00 2001 From: Sravan Kumar <42110198+kingsamurai123@users.noreply.github.com> Date: Wed, 21 Dec 2022 13:32:02 +0530 Subject: [PATCH 02/13] Add partition function Added the partition function to 'PluginWindow' class. This function inserts new line breaks, for a specific character offset count. --- plugin_manager.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugin_manager.py b/plugin_manager.py index 51051ad..6521b16 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -787,6 +787,23 @@ class PluginWindow(popup.PopupWindow): self.scale_origin = origin_widget.get_screen_space_center() loop = asyncio.get_event_loop() loop.create_task(self.draw_ui()) + + def partition(string, minimum_character_offset=40): + string_length = len(string) + + partitioned_string = "" + partitioned_string_length = len(partitioned_string) + + while partitioned_string_length != string_length: + next_empty_space = string[partitioned_string_length + minimum_character_offset:].find(" ") + next_word_end_position = partitioned_string_length + minimum_character_offset + max(0, next_empty_space) + partitioned_string += string[partitioned_string_length:next_word_end_position] + if next_empty_space != -1: + # Insert a line break here, there's still more partitioning to do. + partitioned_string += "\n" + partitioned_string_length = len(partitioned_string) + + return partitioned_string async def draw_ui(self): # print(ba.app.plugins.active_plugins) From 5caa5bdf2fced8b48013dc79cacc3a972bbfdecd Mon Sep 17 00:00:00 2001 From: kingsamurai123 Date: Wed, 21 Dec 2022 08:39:02 +0000 Subject: [PATCH 03/13] [ci] auto-format --- plugin_manager.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin_manager.py b/plugin_manager.py index 6521b16..db7fef6 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -787,7 +787,7 @@ class PluginWindow(popup.PopupWindow): self.scale_origin = origin_widget.get_screen_space_center() loop = asyncio.get_event_loop() loop.create_task(self.draw_ui()) - + def partition(string, minimum_character_offset=40): string_length = len(string) @@ -795,8 +795,10 @@ class PluginWindow(popup.PopupWindow): partitioned_string_length = len(partitioned_string) while partitioned_string_length != string_length: - next_empty_space = string[partitioned_string_length + minimum_character_offset:].find(" ") - next_word_end_position = partitioned_string_length + minimum_character_offset + max(0, next_empty_space) + next_empty_space = string[partitioned_string_length + + minimum_character_offset:].find(" ") + next_word_end_position = partitioned_string_length + \ + minimum_character_offset + max(0, next_empty_space) partitioned_string += string[partitioned_string_length:next_word_end_position] if next_empty_space != -1: # Insert a line break here, there's still more partitioning to do. From 2632086557964a2e7f778c574499ccfeb24c9c08 Mon Sep 17 00:00:00 2001 From: Sravan Kumar <42110198+kingsamurai123@users.noreply.github.com> Date: Wed, 21 Dec 2022 14:44:38 +0530 Subject: [PATCH 04/13] Remove line break characters. --- plugins/utilities.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/utilities.json b/plugins/utilities.json index fee7b87..d2db80c 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -482,7 +482,7 @@ } }, "pro_unlocker": { - "description": "Unlocks some pro-only features - custom colors, playlist maker, etc.\n(Please support the game developer if you can!)", + "description": "Unlocks some pro-only features - custom colors, playlist maker, etc. (Please support the game developer if you can!)", "external_url": "", "authors": [ { @@ -558,7 +558,7 @@ } }, "bomb_radius_visualizer": { - "description": "With this cutting edge technology, you precisely know\nhow close to the bomb you can tread.\nSupports modified blast radius values!", + "description": "With this cutting edge technology, you precisely know how close to the bomb you can tread. Supports modified blast radius values!", "external_url": "", "authors": [ { @@ -653,4 +653,4 @@ } } } -} \ No newline at end of file +} From de6a1b86cb1f93017fe9fa2548631ea37160f162 Mon Sep 17 00:00:00 2001 From: kingsamurai123 Date: Wed, 21 Dec 2022 09:15:09 +0000 Subject: [PATCH 05/13] [ci] apply-version-metadata --- plugins/utilities.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/utilities.json b/plugins/utilities.json index d2db80c..57a58b0 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -653,4 +653,4 @@ } } } -} +} \ No newline at end of file From a0bb69ddd7e814662f49c2d9f384511e6e17a402 Mon Sep 17 00:00:00 2001 From: Sravan Kumar <42110198+kingsamurai123@users.noreply.github.com> Date: Thu, 22 Dec 2022 17:06:27 +0530 Subject: [PATCH 06/13] Update for get_description function Changed the partition function to get_description function and moved inside the draw_ui to make it working. --- plugin_manager.py | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/plugin_manager.py b/plugin_manager.py index db7fef6..8854954 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -788,27 +788,29 @@ class PluginWindow(popup.PopupWindow): loop = asyncio.get_event_loop() loop.create_task(self.draw_ui()) - def partition(string, minimum_character_offset=40): - string_length = len(string) - - partitioned_string = "" - partitioned_string_length = len(partitioned_string) - - while partitioned_string_length != string_length: - next_empty_space = string[partitioned_string_length + - minimum_character_offset:].find(" ") - next_word_end_position = partitioned_string_length + \ - minimum_character_offset + max(0, next_empty_space) - partitioned_string += string[partitioned_string_length:next_word_end_position] - if next_empty_space != -1: - # Insert a line break here, there's still more partitioning to do. - partitioned_string += "\n" - partitioned_string_length = len(partitioned_string) - - return partitioned_string - async def draw_ui(self): # print(ba.app.plugins.active_plugins) + + def get_description(minimum_character_offset=40): + string = self.plugin.info["description"] + string_length = len(string) + + partitioned_string = "" + partitioned_string_length = len(partitioned_string) + + while partitioned_string_length != string_length: + next_empty_space = string[partitioned_string_length + + minimum_character_offset:].find(" ") + next_word_end_position = partitioned_string_length + \ + minimum_character_offset + max(0, next_empty_space) + partitioned_string += string[partitioned_string_length:next_word_end_position] + if next_empty_space != -1: + # Insert a line break here, there's still more partitioning to do. + partitioned_string += "\n" + partitioned_string_length = len(partitioned_string) + + return partitioned_string + play_sound() b_text_color = (0.75, 0.7, 0.8) s = 1.1 if _uiscale is ba.UIScale.SMALL else 1.27 if ba.UIScale.MEDIUM else 1.57 @@ -856,7 +858,7 @@ class PluginWindow(popup.PopupWindow): ba.textwidget(parent=self._root_widget, position=(width * 0.49, pos), size=(0, 0), h_align='center', v_align='center', - text=self.plugin.info["description"], + text=get_description(),#self.plugin.info["description"], scale=text_scale * 0.6, color=color, maxwidth=width * 0.95) b1_color = None From 23b4866435eeeaed5173e0eccac6bf0816c85a21 Mon Sep 17 00:00:00 2001 From: kingsamurai123 Date: Thu, 22 Dec 2022 11:36:54 +0000 Subject: [PATCH 07/13] [ci] auto-format --- plugin_manager.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin_manager.py b/plugin_manager.py index 8854954..246c29e 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -790,7 +790,7 @@ class PluginWindow(popup.PopupWindow): async def draw_ui(self): # print(ba.app.plugins.active_plugins) - + def get_description(minimum_character_offset=40): string = self.plugin.info["description"] string_length = len(string) @@ -810,7 +810,7 @@ class PluginWindow(popup.PopupWindow): partitioned_string_length = len(partitioned_string) return partitioned_string - + play_sound() b_text_color = (0.75, 0.7, 0.8) s = 1.1 if _uiscale is ba.UIScale.SMALL else 1.27 if ba.UIScale.MEDIUM else 1.57 @@ -858,7 +858,7 @@ class PluginWindow(popup.PopupWindow): ba.textwidget(parent=self._root_widget, position=(width * 0.49, pos), size=(0, 0), h_align='center', v_align='center', - text=get_description(),#self.plugin.info["description"], + text=get_description(), # self.plugin.info["description"], scale=text_scale * 0.6, color=color, maxwidth=width * 0.95) b1_color = None From e783e2bfa3b048681f19c9aa41dc9af53520182c Mon Sep 17 00:00:00 2001 From: Rikko Date: Wed, 18 Jan 2023 18:54:16 +0530 Subject: [PATCH 08/13] get_description as a class method --- plugin_manager.py | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/plugin_manager.py b/plugin_manager.py index 246c29e..11539bc 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -788,28 +788,33 @@ class PluginWindow(popup.PopupWindow): loop = asyncio.get_event_loop() loop.create_task(self.draw_ui()) - async def draw_ui(self): - # print(ba.app.plugins.active_plugins) - def get_description(minimum_character_offset=40): - string = self.plugin.info["description"] - string_length = len(string) + def get_description(self, minimum_character_offset=40): + """ + Splits the loong plugin description into multiple lines. + """ + string = self.plugin.info["description"] + string_length = len(string) - partitioned_string = "" + partitioned_string = "" + partitioned_string_length = len(partitioned_string) + + while partitioned_string_length != string_length: + next_empty_space = string[partitioned_string_length + + minimum_character_offset:].find(" ") + next_word_end_position = partitioned_string_length + \ + minimum_character_offset + max(0, next_empty_space) + partitioned_string += string[partitioned_string_length:next_word_end_position] + if next_empty_space != -1: + # Insert a line break here, there's still more partitioning to do. + partitioned_string += "\n" partitioned_string_length = len(partitioned_string) - while partitioned_string_length != string_length: - next_empty_space = string[partitioned_string_length + - minimum_character_offset:].find(" ") - next_word_end_position = partitioned_string_length + \ - minimum_character_offset + max(0, next_empty_space) - partitioned_string += string[partitioned_string_length:next_word_end_position] - if next_empty_space != -1: - # Insert a line break here, there's still more partitioning to do. - partitioned_string += "\n" - partitioned_string_length = len(partitioned_string) + return partitioned_string - return partitioned_string + + async def draw_ui(self): + # print(ba.app.plugins.active_plugins) play_sound() b_text_color = (0.75, 0.7, 0.8) @@ -858,7 +863,7 @@ class PluginWindow(popup.PopupWindow): ba.textwidget(parent=self._root_widget, position=(width * 0.49, pos), size=(0, 0), h_align='center', v_align='center', - text=get_description(), # self.plugin.info["description"], + text=self.get_description(), scale=text_scale * 0.6, color=color, maxwidth=width * 0.95) b1_color = None From 02b461d9215bf8164ff2f63f8ff59e05ab6b1c40 Mon Sep 17 00:00:00 2001 From: Rikko Date: Wed, 18 Jan 2023 18:54:58 +0530 Subject: [PATCH 09/13] Remove explicit line break in plugin description --- plugins/utilities.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/utilities.json b/plugins/utilities.json index 57a58b0..63ac428 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -615,7 +615,7 @@ } }, "autorun": { - "description": "Run without holding any buttons. Made for beginners or players on mobile.\nKeeps your character maneuverable. Start running as usual to override.", + "description": "Run without holding any buttons. Made for beginners or players on mobile. Keeps your character maneuverable. Start running as usual to override.", "external_url": "", "authors": [ { @@ -653,4 +653,4 @@ } } } -} \ No newline at end of file +} From f00a899a4ee53df660316c7c1b76f40800d99743 Mon Sep 17 00:00:00 2001 From: rikkolovescats Date: Wed, 18 Jan 2023 13:25:52 +0000 Subject: [PATCH 10/13] [ci] auto-format --- plugin_manager.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugin_manager.py b/plugin_manager.py index 11539bc..5c00c25 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -788,7 +788,6 @@ class PluginWindow(popup.PopupWindow): loop = asyncio.get_event_loop() loop.create_task(self.draw_ui()) - def get_description(self, minimum_character_offset=40): """ Splits the loong plugin description into multiple lines. @@ -812,7 +811,6 @@ class PluginWindow(popup.PopupWindow): return partitioned_string - async def draw_ui(self): # print(ba.app.plugins.active_plugins) From f9b4e3beaa6e52ee629cd9edc584a44248685c0c Mon Sep 17 00:00:00 2001 From: rikkolovescats Date: Wed, 18 Jan 2023 13:25:54 +0000 Subject: [PATCH 11/13] [ci] apply-version-metadata --- plugins/utilities.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/utilities.json b/plugins/utilities.json index 63ac428..ad3ad27 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -653,4 +653,4 @@ } } } -} +} \ No newline at end of file From 2672a5a4b01246a85cd4539a2a2d44b9b5fa7d02 Mon Sep 17 00:00:00 2001 From: Rikko Date: Wed, 18 Jan 2023 19:02:12 +0530 Subject: [PATCH 12/13] Bump to v0.2.2 --- CHANGELOG.md | 5 +++++ index.json | 3 ++- plugin_manager.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f87732c..d0c4781 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Plugin Manager (dd-mm-yyyy) +### 0.2.2 (18-01-2022) + +- Auto add new line breaks in long plugin descriptions. +- Fixed an issue where pressing back on the main plugin manager window would play the sound twice. + ### 0.2.1 (17-12-2022) - Add Google DNS as a fallback for Jio ISP DNS blocking resolution of raw.githubusercontent.com domain. diff --git a/index.json b/index.json index ae7beed..a0bafaa 100644 --- a/index.json +++ b/index.json @@ -1,6 +1,7 @@ { "plugin_manager_url": "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py", "versions": { + "0.2.2": null, "0.2.1": { "api_version": 7, "commit_sha": "8ac1032", @@ -62,4 +63,4 @@ "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugins/maps.json" ], "external_source_url": "https://github.com/{repository}/{content_type}/{tag}/category.json" -} \ No newline at end of file +} diff --git a/plugin_manager.py b/plugin_manager.py index c29f7f6..1650138 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -24,7 +24,7 @@ _env = _ba.env() _uiscale = ba.app.ui.uiscale -PLUGIN_MANAGER_VERSION = "0.2.1" +PLUGIN_MANAGER_VERSION = "0.2.2" REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager" CURRENT_TAG = "main" INDEX_META = "{repository_url}/{content_type}/{tag}/index.json" From c7ffa61d7328d8aeba0aa15c6b14bdaa94b4a7fd Mon Sep 17 00:00:00 2001 From: rikkolovescats Date: Wed, 18 Jan 2023 13:32:47 +0000 Subject: [PATCH 13/13] [ci] apply-version-metadata --- index.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.json b/index.json index a0bafaa..7ed3695 100644 --- a/index.json +++ b/index.json @@ -1,7 +1,12 @@ { "plugin_manager_url": "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py", "versions": { - "0.2.2": null, + "0.2.2": { + "api_version": 7, + "commit_sha": "2672a5a", + "released_on": "18-01-2023", + "md5sum": "2ef9761e4a02057cd93db3d280427f12" + }, "0.2.1": { "api_version": 7, "commit_sha": "8ac1032", @@ -63,4 +68,4 @@ "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugins/maps.json" ], "external_source_url": "https://github.com/{repository}/{content_type}/{tag}/category.json" -} +} \ No newline at end of file