From fe4d41177a01d1fe47e80f700292e4f93b46933f Mon Sep 17 00:00:00 2001 From: Loup <90267658+Loup-Garou911XD@users.noreply.github.com> Date: Tue, 7 Feb 2023 21:55:25 +0530 Subject: [PATCH 1/3] Added confirmation window --- plugin_manager.py | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/plugin_manager.py b/plugin_manager.py index 1650138..435a0f1 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -1,7 +1,7 @@ # ba_meta require api 7 import ba import _ba -from bastd.ui import popup +from bastd.ui import popup, confirm import urllib.request import http.client @@ -813,7 +813,6 @@ class PluginWindow(popup.PopupWindow): async def draw_ui(self): # print(ba.app.plugins.active_plugins) - 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 @@ -960,7 +959,44 @@ class PluginWindow(popup.PopupWindow): color=(1, 1, 1, 1), rotate=25, scale=0.45) - + + # Below snippet handles the tutorial button in the plugin window + tutorial_url = self.plugin.info["external_url"] + if tutorial_url: + def tutorial_confirm_window(): + text="This will take you to \n\""+self.plugin.info["external_url"] + "\"" + tutorial_confirm_window = confirm.ConfirmWindow( + text=text, + action=lambda: ba.open_url(self.plugin.info["external_url"]), + ) + open_pos_x = (350 if _uiscale is ba.UIScale.SMALL else + 410 if _uiscale is ba.UIScale.MEDIUM else 400) + open_pos_y = (100 if _uiscale is ba.UIScale.SMALL else + 110 if _uiscale is ba.UIScale.MEDIUM else 120) + open_button = ba.buttonwidget(parent=self._root_widget, + autoselect=True, + position=(open_pos_x, open_pos_y), + size=(40, 40), + button_type="square", + label="", + # color=ba.app.ui.title_color, + color=(0.6, 0.53, 0.63), + on_activate_call=tutorial_confirm_window) + ba.imagewidget(parent=self._root_widget, + position=(open_pos_x, open_pos_y), + size=(40, 40), + color=(0.8, 0.95, 1), + texture=ba.gettexture("frameInset"), + draw_controller=open_button) + ba.textwidget(parent=self._root_widget, + position=(open_pos_x - 3, open_pos_y + 12), + text="Tutorial", + size=(10, 10), + draw_controller=open_button, + color=(1, 1, 1, 1), + rotate=25, + scale=0.45) + if to_draw_button4: settings_pos_x = (60 if _uiscale is ba.UIScale.SMALL else 60 if _uiscale is ba.UIScale.MEDIUM else 60) From d13591e4738e0bdeefdfd7e56c7023b3500ba04b Mon Sep 17 00:00:00 2001 From: Loup <90267658+Loup-Garou911XD@users.noreply.github.com> Date: Tue, 7 Feb 2023 22:02:32 +0530 Subject: [PATCH 2/3] updated version --- index.json | 1 + plugin_manager.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.json b/index.json index 7ed3695..c2ba40e 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.3": null, "0.2.2": { "api_version": 7, "commit_sha": "2672a5a", diff --git a/plugin_manager.py b/plugin_manager.py index 435a0f1..9efe976 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.2" +PLUGIN_MANAGER_VERSION = "0.2.3" REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager" CURRENT_TAG = "main" INDEX_META = "{repository_url}/{content_type}/{tag}/index.json" From 7efede369967c5713da329872e0770e46c32eacd Mon Sep 17 00:00:00 2001 From: Loup <90267658+Loup-Garou911XD@users.noreply.github.com> Date: Tue, 7 Feb 2023 23:12:23 +0530 Subject: [PATCH 3/3] Attempt at fixing conflict --- plugin_manager.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin_manager.py b/plugin_manager.py index 9efe976..b97ae1a 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -813,6 +813,7 @@ class PluginWindow(popup.PopupWindow): async def draw_ui(self): # print(ba.app.plugins.active_plugins) + 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 @@ -959,8 +960,8 @@ class PluginWindow(popup.PopupWindow): color=(1, 1, 1, 1), rotate=25, scale=0.45) - - # Below snippet handles the tutorial button in the plugin window + + # Below snippet handles the tutorial button in the plugin window tutorial_url = self.plugin.info["external_url"] if tutorial_url: def tutorial_confirm_window(): @@ -996,7 +997,7 @@ class PluginWindow(popup.PopupWindow): color=(1, 1, 1, 1), rotate=25, scale=0.45) - + if to_draw_button4: settings_pos_x = (60 if _uiscale is ba.UIScale.SMALL else 60 if _uiscale is ba.UIScale.MEDIUM else 60)