From ccb8d260ed5e51f6f65205be04744a9e8322aa6f Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 21 Dec 2005 04:41:36 +0000 Subject: add plugins to test it: uncomment the example.py in lib/python/Plugins/Makefile.am plugins can be added at runtime --- lib/python/Screens/PluginBrowser.py | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lib/python/Screens/PluginBrowser.py (limited to 'lib/python/Screens/PluginBrowser.py') diff --git a/lib/python/Screens/PluginBrowser.py b/lib/python/Screens/PluginBrowser.py new file mode 100644 index 00000000..c03aa910 --- /dev/null +++ b/lib/python/Screens/PluginBrowser.py @@ -0,0 +1,46 @@ +from Screen import Screen + +from Components.MenuList import MenuList +from Components.ActionMap import ActionMap +from Components.PluginComponent import plugins +from Components.PluginList import * +from Components.config import config + + +class PluginBrowser(Screen): + def __init__(self, session): + Screen.__init__(self, session) + + self.list = [] + self["list"] = PluginList(self.list) + self.updateList() + + self["actions"] = ActionMap(["WizardActions"], + { + "ok": self.save, + "back": self.close, + "up": self.up, + "down": self.down + }, -1) + + def save(self): + #self.close() + self.run() + + def run(self): + plugin = self.pluginlist[self["list"].l.getCurrentSelectionIndex()] + plugins.runPlugin(plugin, self.session) + + def updateList(self): + self.list = [] + self.pluginlist = plugins.getPluginList() + for x in self.pluginlist: + self.list.append(PluginEntryComponent(x[0], x[1])) + + self["list"].l.setList(self.list) + + def up(self): + self["list"].instance.moveSelection(self["list"].instance.moveUp) + + def down(self): + self["list"].instance.moveSelection(self["list"].instance.moveDown) -- cgit v1.2.3