Update to Version 0.1.7

This commit is contained in:
Vishal 2022-10-03 20:20:33 +05:30 committed by GitHub
parent b8d70aea65
commit 13ca7b04ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 14 deletions

View file

@ -1,6 +1,12 @@
## Plugin Manager (dd-mm-yyyy) ## Plugin Manager (dd-mm-yyyy)
### 0.1.7 (03-10-2022)
- Added New Option in settings for Notifying new plugins.
- Added a Discord Button to join Bombsquad's Official Discord server.
### 0.1.6 (15-09-2022) ### 0.1.6 (15-09-2022)
- Distinguish the settings button with a cyan color (previously was green) in plugin manager window. - Distinguish the settings button with a cyan color (previously was green) in plugin manager window.

View file

@ -1,6 +1,7 @@
{ {
"plugin_manager_url": "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py", "plugin_manager_url": "http://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py",
"versions": { "versions": {
"0.1.7": null,
"0.1.6": { "0.1.6": {
"api_version": 7, "api_version": 7,
"commit_sha": "2a7ad8e", "commit_sha": "2a7ad8e",

View file

@ -20,7 +20,7 @@ _env = _ba.env()
_uiscale = ba.app.ui.uiscale _uiscale = ba.app.ui.uiscale
PLUGIN_MANAGER_VERSION = "0.1.6" PLUGIN_MANAGER_VERSION = "0.1.7"
REPOSITORY_URL = "http://github.com/bombsquad-community/plugin-manager" REPOSITORY_URL = "http://github.com/bombsquad-community/plugin-manager"
CURRENT_TAG = "main" CURRENT_TAG = "main"
# XXX: Using https with `ba.open_url` seems to trigger a pop-up dialog box on # XXX: Using https with `ba.open_url` seems to trigger a pop-up dialog box on
@ -36,6 +36,7 @@ REGEXP = {
"plugin_entry_points": re.compile(b"(ba_meta export plugin\n+class )(.*)\\("), "plugin_entry_points": re.compile(b"(ba_meta export plugin\n+class )(.*)\\("),
"minigames": re.compile(b"(ba_meta export game\n+class )(.*)\\("), "minigames": re.compile(b"(ba_meta export game\n+class )(.*)\\("),
} }
DISCORD_URL = "https://ballistica.net/discord"
_CACHE = {} _CACHE = {}
@ -124,7 +125,6 @@ class StartupTasks:
plugin_manager_config = ba.app.config.setdefault("Community Plugin Manager", {}) plugin_manager_config = ba.app.config.setdefault("Community Plugin Manager", {})
plugin_manager_config.setdefault("Custom Sources", []) plugin_manager_config.setdefault("Custom Sources", [])
installed_plugins = plugin_manager_config.setdefault("Installed Plugins", {}) installed_plugins = plugin_manager_config.setdefault("Installed Plugins", {})
for plugin_name in tuple(installed_plugins.keys()): for plugin_name in tuple(installed_plugins.keys()):
plugin = PluginLocal(plugin_name) plugin = PluginLocal(plugin_name)
if not plugin.is_installed: if not plugin.is_installed:
@ -135,6 +135,7 @@ class StartupTasks:
"Auto Update Plugin Manager": True, "Auto Update Plugin Manager": True,
"Auto Update Plugins": True, "Auto Update Plugins": True,
"Auto Enable Plugins After Installation": True, "Auto Enable Plugins After Installation": True,
"Notify New Plugins": True
} }
settings = plugin_manager_config.setdefault("Settings", {}) settings = plugin_manager_config.setdefault("Settings", {})
@ -174,12 +175,34 @@ class StartupTasks:
plugins_to_update.append(plugin.update()) plugins_to_update.append(plugin.update())
await asyncio.gather(*plugins_to_update) await asyncio.gather(*plugins_to_update)
async def notify_new_plugins(self):
if not ba.app.config["Community Plugin Manager"]["Settings"]["Notify New Plugins"]:
return
await self.plugin_manager.setup_index()
try:
num_of_plugins = ba.app.config["Community Plugin Manager"]["Existing Number of Plugins"]
except Exception:
ba.app.config["Community Plugin Manager"]["Existing Number of Plugins"] = len(await self.plugin_manager.categories["All"].get_plugins())
num_of_plugins = ba.app.config["Community Plugin Manager"]["Existing Number of Plugins"]
ba.app.config.commit()
return
new_num_of_plugins = len(await self.plugin_manager.categories["All"].get_plugins())
if num_of_plugins < new_num_of_plugins:
ba.screenmessage("We got new Plugins for you to try!")
ba.app.config["Community Plugin Manager"]["Existing Number of Plugins"] = new_num_of_plugins
ba.app.config.commit()
async def execute(self): async def execute(self):
self.setup_config() self.setup_config()
try: try:
await asyncio.gather( await asyncio.gather(
self.update_plugin_manager(), self.update_plugin_manager(),
self.update_plugins(), self.update_plugins(),
self.notify_new_plugins(),
) )
except urllib.error.URLError: except urllib.error.URLError:
pass pass
@ -1678,7 +1701,7 @@ class PluginManagerSettingsWindow(popup.PopupWindow):
scale=text_scale * 0.8) scale=text_scale * 0.8)
pos -= 34 * text_scale pos -= 34 * text_scale
pos = height - 220 pos = height - 200
ba.textwidget(parent=self._root_widget, ba.textwidget(parent=self._root_widget,
position=(width * 0.49, pos-5), position=(width * 0.49, pos-5),
size=(0, 0), size=(0, 0),
@ -1689,17 +1712,16 @@ class PluginManagerSettingsWindow(popup.PopupWindow):
color=color, color=color,
maxwidth=width * 0.95) maxwidth=width * 0.95)
pos -= 45 pos -= 75
ba.textwidget(parent=self._root_widget, ba.buttonwidget(parent=self._root_widget,
position=(width * 0.22, pos-5), position=((width * 0.20) - button_size[0] / 2, pos),
size=(0, 0), size=button_size,
h_align='center', on_activate_call=lambda: ba.open_url(DISCORD_URL),
v_align='center', textcolor=b_text_color,
text=f'API Version: {ba.app.api_version}', button_type='square',
scale=text_scale * 0.7, text_scale=1,
color=(0.4, 0.8, 1), label='Discord')
maxwidth=width * 0.95)
pos -= 25
ba.buttonwidget(parent=self._root_widget, ba.buttonwidget(parent=self._root_widget,
position=((width * 0.49) - button_size[0] / 2, pos), position=((width * 0.49) - button_size[0] / 2, pos),
size=button_size, size=button_size,
@ -1756,6 +1778,16 @@ class PluginManagerSettingsWindow(popup.PopupWindow):
scale=text_scale * 0.8, scale=text_scale * 0.8,
color=text_color, color=text_color,
maxwidth=width * 0.9) maxwidth=width * 0.9)
pos -= 25
ba.textwidget(parent=self._root_widget,
position=(width * 0.49, pos),
size=(0, 0),
h_align='center',
v_align='center',
text=f'API Version: {ba.app.api_version}',
scale=text_scale * 0.7,
color=(0.4, 0.8, 1),
maxwidth=width * 0.95)
pos = height * 0.1 pos = height * 0.1