Base Plugin Methods

This document describes the base methods that all plugins share and how to override them to customize the plugins behavior


Intro

All plugins need to derive from plugin.Plugin and are singleton objects, because of this it is recommended to not override __init__() unless there is a strong reason to do so. All interfaces will provide there own initialization method and a callback that will be used to allow custom plugins to interact with the application.


Properties

There is currently only one base property that is used. Its the __name__ property which is used for identification and some internal tracking for persistence of settings in some cases. This property should be overridden to return the name of the plugin.

@property
def __name__(self):
    return 'EdPlugin'

Common Method

There are a number of common methods that plugins should override to provide better integration with the application.

Version Selection

GetMinVersion can be overridden to restrict what the minimum version of Editra the plugin is compatible with. By default it will return the current running version of Editra, but this should overridden to return at least the version string of the version the plugin was initially released with.

def GetMinVersion(self):
    """Override in subclasses to return the minimum version of Editra that
    the plugin is compatible with. By default it will return the current
    version of Editra.
    @return: version str
 
    """
    return "0.4.95"

Dynamic Initialization

The following methods can be overridden to allow the plugin to be dynamically initialized. Currently these methods are not used but implementing them will allow them to be used when this interface is completed.

def InstallHook(self):
    """Override in subclasses to allow the plugin to be loaded
    dynamically.
    @return: None
 
    """
    pass
 
def IsInstalled(self):
    """Return whether the plugins L{InstallHook} method has been called
    or not already.
    @return: bool
 
    """
    return False