(self)
| 15 | |
| 16 | class PluginManager: |
| 17 | def __init__(self): |
| 18 | self.log = logging.getLogger("PluginManager") |
| 19 | self.path_plugins = os.path.abspath(os.path.dirname(plugins.__file__)) |
| 20 | self.path_installed_plugins = config.data_dir + "/__plugins__" |
| 21 | self.plugins = defaultdict(list) # Registered plugins (key: class name, value: list of plugins for class) |
| 22 | self.subclass_order = {} # Record the load order of the plugins, to keep it after reload |
| 23 | self.pluggable = {} |
| 24 | self.plugin_names = [] # Loaded plugin names |
| 25 | self.plugins_updated = {} # List of updated plugins since restart |
| 26 | self.plugins_rev = {} # Installed plugins revision numbers |
| 27 | self.after_load = [] # Execute functions after loaded plugins |
| 28 | self.function_flags = {} # Flag function for permissions |
| 29 | self.reloading = False |
| 30 | self.config_path = config.data_dir + "/plugins.json" |
| 31 | self.loadConfig() |
| 32 | |
| 33 | self.config.setdefault("builtin", {}) |
| 34 | |
| 35 | sys.path.append(os.path.join(os.getcwd(), self.path_plugins)) |
| 36 | self.migratePlugins() |
| 37 | |
| 38 | if config.debug: # Auto reload Plugins on file change |
| 39 | from Debug import DebugReloader |
| 40 | DebugReloader.watcher.addCallback(self.reloadPlugins) |
| 41 | |
| 42 | def loadConfig(self): |
| 43 | if os.path.isfile(self.config_path): |
nothing calls this directly
no test coverage detected