samuraix.plugin

class samuraix.plugin.Plugin

Base class for Plugins. You should derive your plugin from it. Every plugin is required to have a key describing its task. For example, the sx-simpledeco plugin has the ‘decoration’ key. There are just a few constant plugin keys, so you are relatively free to use any key you like. Reserved keys are ‘desktops’ (there has to be a desktops plugin loaded, otherwise samurai-x2 will quit), ...

key
The plugin key, usually a string
Todo:complete the list of reserved keys.
attach_data_to(obj, data)

Attaches data to the object obj, identified by key. That’s just a shortcut for:

obj.attach_data(self.key, data)
get_data(obj)

Get the formerly attached data from obj, identified by key. That’s just a shortcut for:

return obj.data[self.key]
has_data(obj)
does the plugin have any data attached to obj? return True or False.
remove_data(obj)

remove the formerly attached data from obj, identified by key. That’s just a shortcut for:

del obj.data[self.key]

samurai-x

Previous topic

samuraix.main

Next topic

samuraix.pluginsys

This Page