diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-03-05 21:43:54 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-03-05 21:43:54 +0000 |
| commit | aa4989974a32ab2437d51fb6352b3eb54cecd83d (patch) | |
| tree | 02985c92f7eefd795dd96cfde0ee4f5262a18a50 /doc | |
| parent | 313449731e21f1360ce920e7daf24ddd512706fc (diff) | |
| download | enigma2-aa4989974a32ab2437d51fb6352b3eb54cecd83d.tar.gz enigma2-aa4989974a32ab2437d51fb6352b3eb54cecd83d.zip | |
plugin api change: Plugins() and main functions must receive (and possibly ignore) keyword arguments
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/PLUGINS | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/doc/PLUGINS b/doc/PLUGINS index 96558775..c383997e 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -5,19 +5,20 @@ Enigma2 plugins are always written in python. If you really have to call C/C++ functions from your code, you can supply a python module with it, implementing your functions. -Let's write a plugin. We call it "ourSmallTest", and it should be a test -plugin. +Let's write a plugin. We call it "OurSmallTest", and it should be a test +plugin. Thus we choose "DemoPlugins" as a category. The category is just to +organize plugins in the filesystem. The simplest plugin looks like the following: -Plugins/ourSmallTest/plugin.py: +Plugins/DemoPlugins/OurSmallTest/plugin.py: "from Plugins.Plugin import PluginDescriptor -def main(session): +def main(session, **kwargs): print "Hello world!" -def Plugins(): +def Plugins(**kwargs): return PluginDescriptor( name="Our Small Test", description="plugin to test some capabilities", @@ -68,6 +69,12 @@ def main(session): with MyScreen being a GUI screen. +About the **kwargs: +This somewhat special syntax (in fact the name 'kwargs' is arbitrary, but +stands for "keyword arguments") collects all addition keyword arguments +(i.e. named parameters). For example. the Plugins()-call gets a "path" +parameter, and probably more in the future. You must ignore all additional +keywords which you don't need! autostarting plugins ==================== @@ -78,8 +85,17 @@ end on shutdown. you just have to use "WHERE_AUTOSTART". your entry point must (fnc) look like: -def autostartEntry(raeson): +def autostartEntry(raeson, **kwargs): if reason == 0: # startup print "startup" elif reason == 1: print "shutdown" + +Categories +========== + +Currently defined categories are: + +* DemoPlugins: Plugins fore pure demonstration purposes +* Extensions: User interface extensions +* SystemPlugins: Hardware specific plugins |
