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",
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
====================
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
print "pressed", number
self["text"].number(number)
-def main(session):
+def main(session, **kwargs):
session.openWithCallback(test, ChoiceBox, title="Delete everything on this Dreambox?", list=[(_("yes"), "yes"), (_("no"), "no"), (_("perhaps"), "perhaps"), (_("ask me tomorrow"), "ask me tomorrow"), (_("leave me alone with this!"), "yes")])
def test(returnValue):
print "You entered", returnValue
-def Plugins():
- return PluginDescriptor(name="Test", description="plugin to test some capabilities", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)
-
-
\ No newline at end of file
+def Plugins(**kwargs):
+ return PluginDescriptor(name="Test", description="plugin to test some capabilities", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)
self.cut_list.remove(self.context_nearest_mark)
self.uploadCuesheet()
-def main(session, service):
+def main(session, service, **kwargs):
session.open(CutListEditor, service)
-def Plugins():
+def Plugins(**kwargs):
return PluginDescriptor(name="Cutlist Editor", description=_("Cutlist editor..."), where = PluginDescriptor.WHERE_MOVIELIST, fnc=main)
print "pressed", number
self["text"].number(number)
-def main(session):
+def main(session, **kwargs):
session.open(FileManager)
-def Plugins():
+def Plugins(**kwargs):
return PluginDescriptor(name="File-Manager", description="Let's you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)
return params
-def main(session, plugin):
+def main(session, plugin, **kwargs):
print "Running plugin " + plugin[:-4] + ".so with config file", plugin
print getPluginParams(plugin)
-def Plugins():
- return getPlugins()
\ No newline at end of file
+def Plugins(**kwargs):
+ return getPlugins()
reactor.listenTCP(80, http.HTTPFactory(site))
-def autostart(reason):
+def autostart(reason, **kwargs):
if reason == 0:
try:
startWebserver()
except ImportError:
print "twisted not available, not starting web services"
-def Plugins():
+def Plugins(**kwargs):
return PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart)
NavigationInstance.instance.playService = type(NavigationInstance.instance.playService)(playService, NavigationInstance, Navigation)
-def AlternativeZappingSetup(session):
+def AlternativeZappingSetup(session, **kwargs):
session.open(AlternativeZapping)
-def Plugins():
+def Plugins(**kwargs):
return [PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart),
PluginDescriptor(name="Alternative services setup" , description="Defines alternatives for services.", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=AlternativeZappingSetup)]
# servicereference
# reason
+ # you have to ignore unknown kwargs!
+
# argument: session
WHERE_BLUEMENU = 0
WHERE_MAINMENU = 1
def updateIcon(self, path):
if type(self.iconstr) is str:
- self.icon = loadPNG(path + self.iconstr)
+ self.icon = loadPNG(path + "/" + self.iconstr)
else:
self.icon = None
def ok(self):
self.close(4)
-def Plugins():
+def Plugins(**kwargs):
from Tools.DreamboxHardware import getFPVersion
version = getFPVersion()
newversion = getUpgradeVersion() or 0
else:
self.close()
-def UpgradeMain(session):
+def UpgradeMain(session, **kwargs):
session.open(Upgrade)
-def IpkgMain(session):
+def IpkgMain(session, **kwargs):
session.open(Ipkg)
-def Plugins():
+def Plugins(**kwargs):
return [PluginDescriptor(name="Old Softwareupdate", description="Updates your receiver's software", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain),
PluginDescriptor(name="IPKG", description="IPKG frontend", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=IpkgMain)]
else:
self.status.setText("not moving")
-def PositionerMain(session):
+def PositionerMain(session, **kwargs):
session.open(PositionerSetup)
-def Plugins():
+def Plugins(**kwargs):
return PluginDescriptor(name="Positioner setup", description="Setup your positioner", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=PositionerMain)
-
else:
self.close()
-def UpgradeMain(session):
+def UpgradeMain(session, **kwargs):
session.open(UpdatePluginMenu)
-def Plugins():
+def Plugins(**kwargs):
return PluginDescriptor(name="Softwareupdate", description="Updates your receiver's software", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain)