mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
Load newly installed plugins without restarting
This commit is contained in:
parent
004a563ffd
commit
aaeed0eb7a
1 changed files with 8 additions and 1 deletions
|
|
@ -7,7 +7,6 @@ from bastd.ui import popup
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
|
|
@ -313,10 +312,18 @@ class PluginLocal:
|
||||||
if entry_point not in ba.app.config["Plugins"]:
|
if entry_point not in ba.app.config["Plugins"]:
|
||||||
ba.app.config["Plugins"][entry_point] = {}
|
ba.app.config["Plugins"][entry_point] = {}
|
||||||
ba.app.config["Plugins"][entry_point]["enabled"] = True
|
ba.app.config["Plugins"][entry_point]["enabled"] = True
|
||||||
|
if entry_point not in ba.app.plugins.active_plugins:
|
||||||
|
self.load_plugin(entry_point)
|
||||||
# await self._set_status(to_enable=True)
|
# await self._set_status(to_enable=True)
|
||||||
self.save()
|
self.save()
|
||||||
ba.screenmessage("Plugin Enabled")
|
ba.screenmessage("Plugin Enabled")
|
||||||
|
|
||||||
|
def load_plugin(self, entry_point):
|
||||||
|
plugin_class = ba._general.getclass(entry_point, ba.Plugin)
|
||||||
|
loaded_plugin_class = plugin_class()
|
||||||
|
loaded_plugin_class.on_app_running()
|
||||||
|
ba.app.plugins.active_plugins[entry_point] = loaded_plugin_class
|
||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
for entry_point, plugin_info in ba.app.config["Plugins"].items():
|
for entry_point, plugin_info in ba.app.config["Plugins"].items():
|
||||||
if entry_point.startswith(self._entry_point_initials):
|
if entry_point.startswith(self._entry_point_initials):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue