def __remove_plugin(self, plugin: AbstractPlugin): if not plugin.is_permanent(): plugin_id = plugin.get_id() if plugin_id in self.plugins: self.plugins.pop(plugin_id) if isinstance(plugin, RegularPlugin): if plugin.file_path in self.plugin_file_path: self.plugin_file_path.pop(plugin.file_path)
def __add_plugin(self, plugin: AbstractPlugin): plugin_id = plugin.get_id() if plugin_id in self.plugins: self.logger.critical( 'Something is not correct, a plugin with existed plugin id "{}" is added' .format(plugin_id)) self.plugins[plugin_id] = plugin if isinstance(plugin, RegularPlugin): self.plugin_file_path[plugin.file_path] = plugin_id
def __add_permanent_plugin(self, plugin: AbstractPlugin): self.__add_plugin(plugin) plugin.load()
def __add_plugin(self, plugin: AbstractPlugin): plugin_id = plugin.get_id() self.plugins[plugin_id] = plugin if isinstance(plugin, RegularPlugin): self.plugin_file_path[plugin.file_path] = plugin_id