changed plugin specification: use generic "handle_event" instead of "setup" and "cleanup"

fixed bug in reinitializing of plugins (Closes: #111)
fixed glitch that delayed the results of the plugin_manager to go into effect by one request
This commit is contained in:
lars 2007-01-08 02:30:29 +00:00
parent 0cf35e287c
commit 68e0cddc59
4 changed files with 76 additions and 54 deletions

View file

@ -31,10 +31,9 @@ Python code interface:
- function "get_status":
- returns a string, that describes a state connected to this plugin (e.g. the current date and
time (for the "date" plugin))
- function "setup":
- may be overridden to specify bootup behaviour
- function "cleanup":
- may be overridden to specify shutdown behaviour
- function "handle_event(event, event_info)":
- may be overridden to specify event handling (e.g. "bootup", "shutdown")
- see src/cryptobox/plugins/base.py for details
- the class variable "plugin_capabilities" must be an array of strings (supported: "system" and
"volume")
- the class variable "plugin_visibility" may contain one or more of the following items:

View file

@ -62,15 +62,16 @@ class volume_automount(cryptobox.plugins.base.CryptoBoxPlugin):
return "volume_automount"
def setup(self):
def handle_event(self, event, event_info=None):
"""Override bootup behaviour.
Mount all volumes marked as 'automount'.
"""
cryptobox.plugins.base.CryptoBoxPlugin.setup(self)
for cont in self.cbox.get_container_list():
if self.__is_auto_mount(cont) and not cont.is_mounted():
cont.mount()
cryptobox.plugins.base.CryptoBoxPlugin.handle_event(self, event, event_info)
if event == "bootup":
for cont in self.cbox.get_container_list():
if self.__is_auto_mount(cont) and not cont.is_mounted():
cont.mount()
def is_useful(self, device):