diff --git a/index.json b/index.json index c3dc776..35dcae8 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": { + "1.0.14": null, "1.0.13": { "api_version": 8, "commit_sha": "2a4cb47", diff --git a/plugin_manager.py b/plugin_manager.py index 517f117..30d3927 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -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),