Merge pull request #2 from Loup-Garou911XD/Add-tutorial-button

Added confirmation window
This commit is contained in:
Sravan Kumar 2023-02-08 19:46:15 +05:30 committed by GitHub
commit 1b5953fb98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -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",

View file

@ -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
@ -961,9 +961,16 @@ class PluginWindow(popup.PopupWindow):
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():
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
@ -976,7 +983,9 @@ class PluginWindow(popup.PopupWindow):
label="",
# color=ba.app.ui.title_color,
color=(0.6, 0.53, 0.63),
on_activate_call=lambda: ba.open_url(self.plugin.info["external_url"]))
on_activate_call=tutorial_confirm_window)
ba.imagewidget(parent=self._root_widget,
position=(open_pos_x, open_pos_y),
size=(40, 40),