Build Fixing Part 2

This commit is contained in:
Vishal 2022-08-24 16:03:15 +05:30 committed by GitHub
parent 8ad43be72f
commit 3907df6871
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -432,14 +432,18 @@ class PluginLocal:
self.save() self.save()
def set_version(self, version): 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 return self
# def set_entry_points(self): # def set_entry_points(self):
# if not "entry_points" in ba.app.config["Community Plugin Manager"]["Installed Plugins"][self.name]: # if not "entry_points" in ba.app.config["Community Plugin Manager"]
# ba.app.config["Community Plugin Manager"]["Installed Plugins"][self.name]["entry_points"] = [] # ["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(): # 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): async def set_content(self, content):
if not self._content: if not self._content:
@ -478,7 +482,8 @@ class PluginVersion:
self.view_url = self.plugin.url.format(content_type="blob", tag=tag) self.view_url = self.plugin.url.format(content_type="blob", tag=tag)
def __eq__(self, plugin_version): 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): def __repr__(self):
return f"<PluginVersion({self.plugin.name} {self.number})>" return f"<PluginVersion({self.plugin.name} {self.number})>"
@ -492,8 +497,9 @@ class PluginVersion:
async def install(self): async def install(self):
local_plugin = await self._download() local_plugin = await self._download()
ba.screenmessage(f"{self.plugin.name} installed", color=(0,1,0)) ba.screenmessage(f"{self.plugin.name} installed", color=(0, 1, 0))
if ba.app.config["Community Plugin Manager"]["Settings"]["Auto Enable Plugins After Installation"]: check = ba.app.config["Community Plugin Manager"]["Settings"]
if check["Auto Enable Plugins After Installation"]:
await local_plugin.enable() await local_plugin.enable()
@ -575,14 +581,15 @@ class Plugin:
async def uninstall(self): async def uninstall(self):
await self.get_local().uninstall() 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): def has_update(self):
return self.get_local().version != self.latest_compatible_version.number return self.get_local().version != self.latest_compatible_version.number
async def update(self): async def update(self):
await self.latest_compatible_version.install() 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): class PluginWindow(popup.PopupWindow):
@ -838,7 +845,8 @@ class PluginManager:
request = category.fetch_metadata() request = category.fetch_metadata()
requests.append(request) requests.append(request)
for repository in ba.app.config["Community Plugin Manager"]["Custom Sources"]: 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) category = Category(plugin_category_url, is_3rd_party=True)
request = category.fetch_metadata() request = category.fetch_metadata()
requests.append(request) requests.append(request)
@ -918,7 +926,7 @@ class PluginSourcesWindow(popup.PopupWindow):
b_textcolor = (0.75, 0.7, 0.8) 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 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' self._transition_out = 'out_scale'
transition = 'in_scale' transition = 'in_scale'
self._root_widget = ba.containerwidget(size=(400, 340), self._root_widget = ba.containerwidget(size=(400, 340),
@ -961,7 +969,8 @@ class PluginSourcesWindow(popup.PopupWindow):
delete_source_button_position_pos_x = 360 delete_source_button_position_pos_x = 360
delete_source_button_position_pos_y = 110 delete_source_button_position_pos_y = 110
delete_source_button = ba.buttonwidget(parent=self._root_widget, delete_source_button = ba.buttonwidget(parent=self._root_widget,
position=(delete_source_button_position_pos_x, delete_source_button_position_pos_y), position=(delete_source_button_position_pos_x,
delete_source_button_position_pos_y),
size=(25, 25), size=(25, 25),
on_activate_call=self.delete_selected_source, on_activate_call=self.delete_selected_source,
label="", label="",
@ -973,7 +982,8 @@ class PluginSourcesWindow(popup.PopupWindow):
text_scale=1) text_scale=1)
ba.imagewidget(parent=self._root_widget, 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), size=(25, 25),
color=(5, 2, 2), color=(5, 2, 2),
texture=ba.gettexture("crossOut"), texture=ba.gettexture("crossOut"),
@ -1039,7 +1049,6 @@ class PluginSourcesWindow(popup.PopupWindow):
scale=0.75, scale=0.75,
maxwidth=260) maxwidth=260)
def select_source(self, source): def select_source(self, source):
self.selected_source = source self.selected_source = source