mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
some work on new more window
This commit is contained in:
parent
9b4ee194a1
commit
3830f203bc
1 changed files with 99 additions and 20 deletions
|
|
@ -30,7 +30,8 @@ from datetime import datetime
|
|||
import logging
|
||||
|
||||
PLUGIN_MANAGER_VERSION = "1.1.0"
|
||||
REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager"
|
||||
REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager"
|
||||
PLUGIN_ISSUE_TEMPLATE = "bug_report.md" # https://github.com/bombsquad-community/plugin-manager/issues/new?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"
|
||||
|
|
@ -987,6 +988,76 @@ class AuthorsWindow(popup.PopupWindow):
|
|||
bui.getsound('swish').play()
|
||||
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'
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
)
|
||||
|
||||
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=(source_btn_pos_x, source_btn_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.imagewidget(parent=self._root_widget,
|
||||
position=(source_btn_pos_x, source_btn_pos_y),
|
||||
size=(40, 40),
|
||||
color=(0.8, 0.95, 1),
|
||||
texture=bui.gettexture("file"),
|
||||
draw_controller=source_button)
|
||||
bui.textwidget(parent=self._root_widget,
|
||||
position=(source_btn_pos_x-3, source_btn_pos_y+12),
|
||||
text="Source",
|
||||
size=(10, 10),
|
||||
draw_controller=source_button,
|
||||
color=(1, 1, 1, 1),
|
||||
rotate=25,
|
||||
scale=0.45)
|
||||
|
||||
print(dir(plugin))
|
||||
# bui.textwidget(parent=self._root_widget,
|
||||
# size=(60,60),
|
||||
# text=plugin)
|
||||
|
||||
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)
|
||||
|
||||
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):
|
||||
|
|
@ -1150,33 +1221,41 @@ 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 +1265,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 +1280,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