We could make a plugin-instance directly callable, which should have the same result as calling the activate() routine. So this is somehow a shortcut.
class MyPlugin(GwBasePattern):
...
def activate():
pass
plugin = MyPlugin()
plugin.activate()
# or
plugin()
We could do this by using __call__ inside GwBasePattern:
class GwBasePattern:
def __cal__(self, *args, **kwargs):
self.activate(*args, **kwargs)
Another idea to automatically activate plugins during initialisation:
plugin = MyPlugin(activate=True)
The GwBasePattern would check this during __init__:
class GwBasePattern:
def __init__(self, *args, **kwargs):
if "activate" in kwargs.keys() and kwargs["activate"] is True:
self.activate()
Maybe there could also be an config-option, to activate plugins during initialisation automatically.
But I'm not sure, for which plugins __init__ gets called currently (only by user, all registered plugin, ... ).
Must check is in the pluginmananger.py.