Migrated scan plugin

This commit is contained in:
Joel Collins 2019-12-18 11:06:02 +00:00
parent 480848b009
commit dee77c295a
13 changed files with 442 additions and 290 deletions

View file

@ -29,6 +29,8 @@ class BasePlugin:
self.name = name
self.methods = {}
@property
def views(self):
return self._views
@ -102,6 +104,13 @@ class BasePlugin:
def _name_uri_safe(self):
return snake_to_spine(self._name_python_safe)
def add_method(self, method_name, method):
self.methods[method_name] = method
if not hasattr(self, method_name):
setattr(self, method_name, method)
else:
logging.warning("Unable to bind method to plugin. Method name already exists.")
def find_plugins(plugin_path, module_name="plugins"):
print(f"Loading plugins from {plugin_path}")