diff --git a/plugin_manager.py b/plugin_manager.py index 270948e..748bf28 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -432,14 +432,18 @@ class PluginLocal: self.save() def set_version(self, version): - ba.app.config["Community Plugin Manager"]["Installed Plugins"][self.name]["version"] = version + app = ba.app + app.config["Community Plugin Manager"]["Installed Plugins"][self.name]["version"] = version return self # def set_entry_points(self): - # if not "entry_points" in ba.app.config["Community Plugin Manager"]["Installed Plugins"][self.name]: - # ba.app.config["Community Plugin Manager"]["Installed Plugins"][self.name]["entry_points"] = [] + # if not "entry_points" in ba.app.config["Community Plugin Manager"] + # ["Installed Plugins"][self.name]: + # ba.app.config["Community Plugin Manager"]["Installed Plugins"] + # [self.name]["entry_points"] = [] # for entry_point in await self.get_entry_points(): - # ba.app.config["Community Plugin Manager"]["Installed Plugins"][self.name]["entry_points"].append(entry_point) + # ba.app.config["Community Plugin Manager"]["Installed Plugins"][self.name] + # ["entry_points"].append(entry_point) async def set_content(self, content): if not self._content: @@ -478,7 +482,8 @@ class PluginVersion: self.view_url = self.plugin.url.format(content_type="blob", tag=tag) def __eq__(self, plugin_version): - return (self.number, self.plugin.name) == (plugin_version.number, plugin_version.plugin.name) + return (self.number, self.plugin.name) == (plugin_version.number, + plugin_version.plugin.name) def __repr__(self): return f"" @@ -492,8 +497,9 @@ class PluginVersion: async def install(self): local_plugin = await self._download() - ba.screenmessage(f"{self.plugin.name} installed", color=(0,1,0)) - if ba.app.config["Community Plugin Manager"]["Settings"]["Auto Enable Plugins After Installation"]: + ba.screenmessage(f"{self.plugin.name} installed", color=(0, 1, 0)) + check = ba.app.config["Community Plugin Manager"]["Settings"] + if check["Auto Enable Plugins After Installation"]: await local_plugin.enable() @@ -575,14 +581,15 @@ class Plugin: async def uninstall(self): await self.get_local().uninstall() - ba.screenmessage(f"{self.name} uninstalled", color=(0,1,0)) + ba.screenmessage(f"{self.name} uninstalled", color=(0, 1, 0)) def has_update(self): return self.get_local().version != self.latest_compatible_version.number async def update(self): await self.latest_compatible_version.install() - ba.screenmessage(f"{self.name} updated to {self.latest_compatible_version.number}", color=(0,1,0)) + ba.screenmessage(f"{self.name} updated to {self.latest_compatible_version.number}", + color=(0, 1, 0)) class PluginWindow(popup.PopupWindow): @@ -718,12 +725,12 @@ class PluginWindow(popup.PopupWindow): open_pos_y = (100 if _uiscale is ba.UIScale.SMALL else 110 if _uiscale is ba.UIScale.MEDIUM else 120) open_button = ba.buttonwidget(parent=self._root_widget, - autoselect=True, - position=(open_pos_x-7.5, open_pos_y-15), - size=(55, 55), - button_type="square", - label="", - on_activate_call=lambda: ba.open_url(self.plugin.view_url)) + autoselect=True, + position=(open_pos_x-7.5, open_pos_y-15), + size=(55, 55), + button_type="square", + label="", + on_activate_call=lambda: ba.open_url(self.plugin.view_url)) ba.imagewidget(parent=self._root_widget, position=(open_pos_x, open_pos_y), size=(40, 40), @@ -738,16 +745,16 @@ class PluginWindow(popup.PopupWindow): if to_draw_button4: settings_pos_x = (0 if _uiscale is ba.UIScale.SMALL else - 60 if _uiscale is ba.UIScale.MEDIUM else 60) + 60 if _uiscale is ba.UIScale.MEDIUM else 60) settings_pos_y = (100 if _uiscale is ba.UIScale.SMALL else - 110 if _uiscale is ba.UIScale.MEDIUM else 120) + 110 if _uiscale is ba.UIScale.MEDIUM else 120) settings_button = ba.buttonwidget(parent=self._root_widget, - autoselect=True, - position=(settings_pos_x, settings_pos_y), - size=(40, 40), - button_type="square", - label="", - on_activate_call=self.settings) + autoselect=True, + position=(settings_pos_x, settings_pos_y), + size=(40, 40), + button_type="square", + label="", + on_activate_call=self.settings) ba.imagewidget(parent=self._root_widget, position=(settings_pos_x, settings_pos_y), size=(40, 40), @@ -838,7 +845,8 @@ class PluginManager: request = category.fetch_metadata() requests.append(request) for repository in ba.app.config["Community Plugin Manager"]["Custom Sources"]: - plugin_category_url = partial_format(plugin_index["external_source_url"], repository=repository) + plugin_category_url = partial_format(plugin_index["external_source_url"], + repository=repository) category = Category(plugin_category_url, is_3rd_party=True) request = category.fetch_metadata() requests.append(request) @@ -918,7 +926,7 @@ class PluginSourcesWindow(popup.PopupWindow): b_textcolor = (0.75, 0.7, 0.8) s = 1.1 if _uiscale is ba.UIScale.SMALL else 1.27 if ba.UIScale.MEDIUM else 1.57 - text_scale = 0.7 * s + # text_scale = 0.7 * s self._transition_out = 'out_scale' transition = 'in_scale' self._root_widget = ba.containerwidget(size=(400, 340), @@ -961,19 +969,21 @@ class PluginSourcesWindow(popup.PopupWindow): delete_source_button_position_pos_x = 360 delete_source_button_position_pos_y = 110 delete_source_button = ba.buttonwidget(parent=self._root_widget, - position=(delete_source_button_position_pos_x, delete_source_button_position_pos_y), - size=(25, 25), - on_activate_call=self.delete_selected_source, - label="", - # texture=ba.gettexture("crossOut"), - button_type="square", - color=(0.6, 0, 0), - textcolor=b_textcolor, - # autoselect=True, - text_scale=1) + position=(delete_source_button_position_pos_x, + delete_source_button_position_pos_y), + size=(25, 25), + on_activate_call=self.delete_selected_source, + label="", + # texture=ba.gettexture("crossOut"), + button_type="square", + color=(0.6, 0, 0), + textcolor=b_textcolor, + # autoselect=True, + text_scale=1) ba.imagewidget(parent=self._root_widget, - position=(delete_source_button_position_pos_x + 2, delete_source_button_position_pos_y), + position=(delete_source_button_position_pos_x + 2, + delete_source_button_position_pos_y), size=(25, 25), color=(5, 2, 2), texture=ba.gettexture("crossOut"), @@ -992,16 +1002,16 @@ class PluginSourcesWindow(popup.PopupWindow): ) self._add_source_widget = ba.textwidget(parent=self._root_widget, - text="rikkolovescats/sahilp-plugins", - size=(335, 50), - position=(21, 22), - h_align='left', - v_align='center', - editable=True, - scale=0.75, - maxwidth=215, - # autoselect=True, - description="Add Source") + text="rikkolovescats/sahilp-plugins", + size=(335, 50), + position=(21, 22), + h_align='left', + v_align='center', + editable=True, + scale=0.75, + maxwidth=215, + # autoselect=True, + description="Add Source") loop = asyncio.get_event_loop() @@ -1039,7 +1049,6 @@ class PluginSourcesWindow(popup.PopupWindow): scale=0.75, maxwidth=260) - def select_source(self, source): self.selected_source = source @@ -1373,7 +1382,7 @@ class PluginManagerWindow(ba.Window): size=(30, 30), button_type="square", label="", - on_activate_call=lambda: + on_activate_call=lambda: loop.create_task(self.refresh())) ba.imagewidget(parent=self._root_widget, position=(settings_pos_x, settings_pos_y),