just one bouquet at moment
[enigma2.git] / lib / python / Screens / PluginBrowser.py
1 from Screen import Screen
2
3 from Components.MenuList import MenuList
4 from Components.ActionMap import ActionMap
5 from Components.PluginComponent import plugins
6 from Components.PluginList import *
7 from Components.config import config
8
9
10 class PluginBrowser(Screen):
11         def __init__(self, session):
12                 Screen.__init__(self, session)
13                 
14                 self.list = []
15                 self["list"] = PluginList(self.list)
16                 self.updateList()
17                 
18                 self["actions"] = ActionMap(["WizardActions"], 
19                 {
20                         "ok": self.save,
21                         "back": self.close,
22                         "up": self.up,
23                         "down": self.down
24                 }, -1)
25                 
26         def save(self):
27                 #self.close()
28                 self.run()
29         
30         def run(self):
31                 plugin = self.pluginlist[self["list"].l.getCurrentSelectionIndex()]
32                 plugins.runPlugin(plugin, self.session)
33                 
34         def updateList(self):
35                 self.list = []
36                 self.pluginlist = plugins.getPluginList()
37                 for x in self.pluginlist:
38                         self.list.append(PluginEntryComponent(x[0], x[1]))
39                 
40                 self["list"].l.setList(self.list)
41
42         def up(self):
43                 self["list"].instance.moveSelection(self["list"].instance.moveUp)
44                 
45         def down(self):
46                 self["list"].instance.moveSelection(self["list"].instance.moveDown)