aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens/PluginBrowser.py
blob: 1c9097465a000def4b0705ae3dd00d239a26ae4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
from Plugins.Plugin import PluginDescriptor

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,
		})
		
	def save(self):
		#self.close()
		self.run()
	
	def run(self):
		plugin = self["list"].l.getCurrentSelection()[0]
		
		plugin(session=self.session)
		
	def updateList(self):
		self.list = [ ]
		self.pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
		for plugin in self.pluginlist:
			self.list.append(PluginEntryComponent(plugin))
		
		self["list"].l.setList(self.list)