From aa4989974a32ab2437d51fb6352b3eb54cecd83d Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Sun, 5 Mar 2006 21:43:54 +0000 Subject: plugin api change: Plugins() and main functions must receive (and possibly ignore) keyword arguments --- doc/PLUGINS | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'doc') 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 -- cgit v1.2.3