Package yapsy :: Module IPlugin
[hide private]

Source Code for Module yapsy.IPlugin

 1  #!/usr/bin/python 
 2  # -*- coding: utf-8 -*- 
 3   
 4   
 5  """ 
 6  Defines the basic interfaces for a plugin. These interfaces are 
 7  inherited by the *core* class of a plugin. The *core* class of a 
 8  plugin is then the one that will be notified the 
 9  activation/deactivation of a plugin via the ``activate/deactivate`` 
10  methods. 
11   
12  For simple (near trivial) plugin systems, one can directly use the 
13  following interfaces. 
14   
15  When designing a non-trivial plugin system, one should create new 
16  plugin interfaces that inherit the following interfaces. 
17  """ 
18   
19   
20 -class IPlugin(object):
21 """ 22 The most simple interface to be inherited when creating a plugin. 23 """ 24
25 - def __init__(self):
26 """ 27 Set the basic variables. 28 """ 29 self.is_activated = False
30
31 - def activate(self):
32 """ 33 Called at plugin activation. 34 """ 35 self.is_activated = True
36
37 - def deactivate(self):
38 """ 39 Called when the plugin is disabled. 40 """ 41 self.is_activated = False
42