mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
Showing all authors and their info for a plugin.
This commit is contained in:
parent
6f42f2aa9f
commit
2bc90859e6
2 changed files with 81 additions and 1 deletions
|
|
@ -894,6 +894,83 @@ class Plugin:
|
|||
bui.getsound('error').play()
|
||||
|
||||
|
||||
class AuthorsWindow(popup.PopupWindow):
|
||||
def __init__(self, authors_info, origin_widget):
|
||||
self.authors_info = authors_info
|
||||
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)
|
||||
|
||||
pos = height * 0.9
|
||||
bui.textwidget(parent=self._root_widget,
|
||||
position=(width * 0.49, pos), size=(0, 0),
|
||||
h_align='center', v_align='center', text='Authors',
|
||||
scale=text_scale * 1.25, color=color,
|
||||
maxwidth=width * 0.9)
|
||||
|
||||
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),
|
||||
# autoselect=True,
|
||||
button_type='backSmall',
|
||||
on_activate_call=self._back)
|
||||
|
||||
bui.containerwidget(edit=self._root_widget, cancel_button=back_button)
|
||||
|
||||
self._scrollwidget = bui.scrollwidget(parent=self._root_widget,
|
||||
size=(width * 0.8, height * 0.75),
|
||||
position=(width * 0.1, height * 0.1))
|
||||
self._columnwidget = bui.columnwidget(parent=self._scrollwidget,
|
||||
border=1,
|
||||
left_border=-20 if _uiscale is babase.UIScale.SMALL else 0,
|
||||
margin=0)
|
||||
|
||||
for author in self.authors_info:
|
||||
for key, value in author.items():
|
||||
text = f"{key.title()}: {value if value != '' else 'Not Provided'}"
|
||||
if key == 'name':
|
||||
text = (' ' if _uiscale is babase.UIScale.SMALL else ' ') + value
|
||||
bui.textwidget(parent=self._columnwidget,
|
||||
size=(width * 0.8, 35 if key == 'name' else 30),
|
||||
always_highlight=True,
|
||||
color=color,
|
||||
scale=(
|
||||
(1.0 if key == 'name' else 0.9) if _uiscale is babase.UIScale.SMALL else
|
||||
(1.2 if key == 'name' else 1.0)
|
||||
),
|
||||
text=text,
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
maxwidth=420)
|
||||
bui.textwidget(parent=self._columnwidget,
|
||||
size=(width * 0.8, 30),
|
||||
always_highlight=True,
|
||||
color=color,
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
maxwidth=420)
|
||||
|
||||
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
|
||||
|
|
@ -964,7 +1041,9 @@ class PluginWindow(popup.PopupWindow):
|
|||
text=text,
|
||||
scale=text_scale * 0.8,
|
||||
color=color,
|
||||
maxwidth=width * 0.9)
|
||||
maxwidth=width * 0.9,
|
||||
selectable=True,
|
||||
on_activate_call=lambda: AuthorsWindow(self.plugin.info["authors"], self._root_widget))
|
||||
pos -= 35
|
||||
# status = bui.textwidget(parent=self._root_widget,
|
||||
# position=(width * 0.49, pos), size=(0, 0),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue