Replace on_plugin_manager_prompt to default plugin setting ui

This commit is contained in:
! Freaku 2022-12-05 21:39:08 +05:30 committed by GitHub
parent 8c78e89088
commit 6aa0f6f677
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@ _env = _ba.env()
_uiscale = ba.app.ui.uiscale
PLUGIN_MANAGER_VERSION = "0.1.10"
PLUGIN_MANAGER_VERSION = "0.2.0"
REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager"
CURRENT_TAG = "main"
INDEX_META = "{repository_url}/{content_type}/{tag}/index.json"
@ -364,13 +364,13 @@ class PluginLocal:
def has_settings(self):
for plugin_entry_point, plugin_class in ba.app.plugins.active_plugins.items():
if plugin_entry_point.startswith(self._entry_point_initials):
return hasattr(plugin_class, "on_plugin_manager_prompt")
return hasattr(plugin_class, "has_settings_ui")
return False
def launch_settings(self):
def launch_settings(self, source_widget):
for plugin_entry_point, plugin_class in ba.app.plugins.active_plugins.items():
if plugin_entry_point.startswith(self._entry_point_initials):
return plugin_class.on_plugin_manager_prompt()
return plugin_class.show_settings_ui(source_widget)
async def get_content(self):
if self._content is None:
@ -851,8 +851,10 @@ class PluginWindow(popup.PopupWindow):
size=(40, 40),
button_type="square",
label="",
color=(0, 0.75, 0.75),
on_activate_call=self.settings)
color=(0, 0.75, 0.75),)
ba.buttonwidget(
edit=settings_button,
on_activate_call=ba.Call(self.settings, settings_button),)
ba.imagewidget(parent=self._root_widget,
position=(settings_pos_x, settings_pos_y),
size=(40, 40),
@ -883,8 +885,8 @@ class PluginWindow(popup.PopupWindow):
return wrapper
def settings(self):
self.local_plugin.launch_settings()
def settings(self, source_widget):
self.local_plugin.launch_settings(source_widget)
@button
def disable(self) -> None: