add ability to remove list and config from a wizard
[enigma2.git] / lib / python / Components / ConfigList.py
1 from HTMLComponent import *
2 from GUIComponent import *
3 from config import *
4
5 from enigma import eListbox, eListboxPythonConfigContent
6
7 class ConfigList(HTMLComponent, GUIComponent):
8         def __init__(self, list):
9                 GUIComponent.__init__(self)
10                 self.l = eListboxPythonConfigContent()
11                 self.l.setList(list)
12                 self.l.setSeperation(100)
13                 self.list = list
14         
15         def toggle(self):
16                 selection = self.getCurrent()
17                 selection[1].toggle()
18                 self.invalidateCurrent()
19
20         def handleKey(self, key):
21                 selection = self.getCurrent()
22                 selection[1].handleKey(key)
23                 self.invalidateCurrent()
24
25         def getCurrent(self):
26                 return self.l.getCurrentSelection()
27         
28         def invalidateCurrent(self):
29                 self.l.invalidateEntry(self.l.getCurrentSelectionIndex())
30                 
31         def invalidate(self, entry):
32                 i = 0
33                 for x in self.list:
34                         if (entry.getConfigPath() == x[1].parent.getConfigPath()):
35                                 self.l.invalidateEntry(i)
36                         i += 1
37                 
38         def GUIcreate(self, parent):
39                 self.instance = eListbox(parent)
40                 self.instance.setContent(self.l)
41         
42         def GUIdelete(self):
43                 self.instance.setContent(None)
44                 self.instance = None
45