mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
commit
dd2d04c2b7
1 changed files with 122 additions and 24 deletions
|
|
@ -31,6 +31,8 @@ import logging
|
|||
|
||||
PLUGIN_MANAGER_VERSION = "1.1.0"
|
||||
REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager"
|
||||
# https://github.com/bombsquad-community/plugin-manager/issues/new?template=bug_report.md
|
||||
PLUGIN_ISSUE_TEMPLATE = "bug_report.md"
|
||||
# Current tag can be changed to "staging" or any other branch in
|
||||
# plugin manager repo for testing purpose.
|
||||
CURRENT_TAG = "main"
|
||||
|
|
@ -988,6 +990,95 @@ class AuthorsWindow(popup.PopupWindow):
|
|||
bui.containerwidget(edit=self._root_widget, transition='out_scale')
|
||||
|
||||
|
||||
class MoreWindow(popup.PopupWindow):
|
||||
def __init__(self, origin_widget, plugin):
|
||||
self.scale_origin = origin_widget.get_screen_space_center()
|
||||
bui.getsound('swish').play()
|
||||
s = 1.25 if _uiscale is babase.UIScale.SMALL else 1.39 if _uiscale is babase.UIScale.MEDIUM else 1.67
|
||||
width = 400 * s
|
||||
height = width * 0.8
|
||||
color = (1, 1, 1)
|
||||
text_scale = 0.7 * s
|
||||
self._transition_out = 'out_scale'
|
||||
transition = 'in_scale'
|
||||
for value in plugin.info['versions'].values():
|
||||
if value['api_version'] == _app_api_version:
|
||||
released_on = value['released_on']
|
||||
print(released_on)
|
||||
|
||||
self._root_widget = bui.containerwidget(
|
||||
size=(width, height),
|
||||
on_outside_click_call=self._back,
|
||||
transition=transition,
|
||||
scale=(1.5 if _uiscale is babase.UIScale.SMALL else 1.5
|
||||
if _uiscale is babase.UIScale.MEDIUM else 1.0),
|
||||
scale_origin_stack_offset=self.scale_origin)
|
||||
|
||||
back_button = bui.buttonwidget(
|
||||
parent=self._root_widget,
|
||||
position=(width * 0.1, height * 0.87),
|
||||
size=(60, 60),
|
||||
scale=0.8,
|
||||
label=babase.charstr(babase.SpecialChar.BACK),
|
||||
button_type='backSmall',
|
||||
on_activate_call=self._back)
|
||||
bui.containerwidget(edit=self._root_widget, cancel_button=back_button)
|
||||
|
||||
bui.textwidget(
|
||||
parent=self._root_widget,
|
||||
position=(width/4, height/1.5),
|
||||
text=f"RELEASED ON: {released_on}",
|
||||
h_align='left', v_align='center')
|
||||
|
||||
bui.textwidget(
|
||||
parent=self._root_widget,
|
||||
position=(width/4, height/2),
|
||||
text="Source: ",
|
||||
h_align='left', v_align='center')
|
||||
|
||||
source_btn_pos_x = (390 if _uiscale is babase.UIScale.SMALL else
|
||||
450 if _uiscale is babase.UIScale.MEDIUM else 440)
|
||||
source_btn_pos_y = (100 if _uiscale is babase.UIScale.SMALL else
|
||||
110 if _uiscale is babase.UIScale.MEDIUM else 120)
|
||||
source_button = bui.buttonwidget(
|
||||
parent=self._root_widget,
|
||||
autoselect=True,
|
||||
position=(width/2-25, height/2-25),
|
||||
size=(80, 80),
|
||||
button_type="square",
|
||||
label="",
|
||||
color=(0.6, 0.53, 0.63),
|
||||
on_activate_call=lambda: bui.open_url(self.plugin.view_url))
|
||||
bui.imagewidget(
|
||||
parent=self._root_widget,
|
||||
position=(width/2-25, height/2-25),
|
||||
size=(80, 80),
|
||||
color=(0.8, 0.95, 1),
|
||||
texture=bui.gettexture("file"),
|
||||
draw_controller=source_button)
|
||||
bui.textwidget(
|
||||
parent=self._root_widget,
|
||||
position=(width/2-16, height/2-2),
|
||||
text="Source",
|
||||
size=(20, 20),
|
||||
draw_controller=source_button,
|
||||
color=(1, 1, 1, 1),
|
||||
rotate=25,
|
||||
scale=0.7)
|
||||
|
||||
bui.buttonwidget(
|
||||
parent=self._root_widget,
|
||||
size=(60, 60),
|
||||
label="report a bug",
|
||||
on_activate_call=babase.Call(
|
||||
bui.open_url, REPOSITORY_URL + "/issues/new?template=" + PLUGIN_ISSUE_TEMPLATE)
|
||||
)
|
||||
|
||||
def _back(self) -> None:
|
||||
bui.getsound('swish').play()
|
||||
bui.containerwidget(edit=self._root_widget, transition='out_scale')
|
||||
|
||||
|
||||
class PluginWindow(popup.PopupWindow):
|
||||
def __init__(self, plugin, origin_widget, button_callback=lambda: None):
|
||||
self.plugin = plugin
|
||||
|
|
@ -1150,33 +1241,40 @@ class PluginWindow(popup.PopupWindow):
|
|||
on_cancel_call=self._cancel,
|
||||
selected_child=selected_btn)
|
||||
|
||||
open_pos_x = (390 if _uiscale is babase.UIScale.SMALL else
|
||||
more_pos_x = (390 if _uiscale is babase.UIScale.SMALL else
|
||||
450 if _uiscale is babase.UIScale.MEDIUM else 440)
|
||||
open_pos_y = (100 if _uiscale is babase.UIScale.SMALL else
|
||||
more_pos_y = (100 if _uiscale is babase.UIScale.SMALL else
|
||||
110 if _uiscale is babase.UIScale.MEDIUM else 120)
|
||||
open_button = bui.buttonwidget(parent=self._root_widget,
|
||||
# MK:
|
||||
|
||||
more_button = bui.buttonwidget(parent=self._root_widget,
|
||||
autoselect=True,
|
||||
position=(open_pos_x, open_pos_y),
|
||||
position=(more_pos_x, more_pos_y),
|
||||
size=(40, 40),
|
||||
button_type="square",
|
||||
label="",
|
||||
color=(0.6, 0.53, 0.63),
|
||||
on_activate_call=lambda: bui.open_url(self.plugin.view_url))
|
||||
)
|
||||
bui.buttonwidget(edit=more_button,
|
||||
on_activate_call=babase.Call(MoreWindow, more_button, self.plugin)
|
||||
)
|
||||
|
||||
bui.imagewidget(parent=self._root_widget,
|
||||
position=(open_pos_x, open_pos_y),
|
||||
position=(more_pos_x, more_pos_y),
|
||||
size=(40, 40),
|
||||
color=(0.8, 0.95, 1),
|
||||
texture=bui.gettexture("file"),
|
||||
draw_controller=open_button)
|
||||
draw_controller=more_button)
|
||||
bui.textwidget(parent=self._root_widget,
|
||||
position=(open_pos_x-3, open_pos_y+12),
|
||||
text="Source",
|
||||
position=(more_pos_x-3, more_pos_y+12),
|
||||
text="More...",
|
||||
size=(10, 10),
|
||||
draw_controller=open_button,
|
||||
draw_controller=more_button,
|
||||
color=(1, 1, 1, 1),
|
||||
rotate=25,
|
||||
scale=0.45)
|
||||
|
||||
# MK:
|
||||
# Below snippet handles the tutorial button in the plugin window
|
||||
tutorial_url = self.plugin.info["external_url"]
|
||||
if tutorial_url:
|
||||
|
|
@ -1186,13 +1284,13 @@ class PluginWindow(popup.PopupWindow):
|
|||
text=text,
|
||||
action=lambda: bui.open_url(self.plugin.info["external_url"]),
|
||||
)
|
||||
open_pos_x = (440 if _uiscale is babase.UIScale.SMALL else
|
||||
more_pos_x = (440 if _uiscale is babase.UIScale.SMALL else
|
||||
500 if _uiscale is babase.UIScale.MEDIUM else 490)
|
||||
open_pos_y = (100 if _uiscale is babase.UIScale.SMALL else
|
||||
more_pos_y = (100 if _uiscale is babase.UIScale.SMALL else
|
||||
110 if _uiscale is babase.UIScale.MEDIUM else 120)
|
||||
open_button = bui.buttonwidget(parent=self._root_widget,
|
||||
tutorial_button = bui.buttonwidget(parent=self._root_widget,
|
||||
autoselect=True,
|
||||
position=(open_pos_x, open_pos_y),
|
||||
position=(more_pos_x, more_pos_y),
|
||||
size=(40, 40),
|
||||
button_type="square",
|
||||
label="",
|
||||
|
|
@ -1201,16 +1299,16 @@ class PluginWindow(popup.PopupWindow):
|
|||
on_activate_call=tutorial_confirm_window)
|
||||
|
||||
bui.imagewidget(parent=self._root_widget,
|
||||
position=(open_pos_x, open_pos_y),
|
||||
position=(more_pos_x, more_pos_y),
|
||||
size=(40, 40),
|
||||
color=(0.8, 0.95, 1),
|
||||
texture=bui.gettexture("frameInset"),
|
||||
draw_controller=open_button)
|
||||
draw_controller=tutorial_button)
|
||||
bui.textwidget(parent=self._root_widget,
|
||||
position=(open_pos_x - 3, open_pos_y + 12),
|
||||
position=(more_pos_x - 3, more_pos_y + 12),
|
||||
text="Tutorial",
|
||||
size=(10, 10),
|
||||
draw_controller=open_button,
|
||||
draw_controller=tutorial_button,
|
||||
color=(1, 1, 1, 1),
|
||||
rotate=25,
|
||||
scale=0.45)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue