fix memleak
[enigma2.git] / lib / python / Components / ConfigList.py
index a2bdcb0b3ce532003260ea88b8ed397e0af35fdb..0181ef02873e38a51ba7288387802515427ca420 100644 (file)
@@ -4,29 +4,53 @@ from config import *
 
 from enigma import eListbox, eListboxPythonConfigContent
 
 
 from enigma import eListbox, eListboxPythonConfigContent
 
-class ConfigList(HTMLComponent, GUIComponent):
+class ConfigList(HTMLComponent, GUIComponent, object):
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonConfigContent()
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonConfigContent()
-               self.l.setList(list)
                self.l.setSeperation(100)
                self.l.setSeperation(100)
+               self.list = list
+               self.onSelectionChanged = [ ]
        
        def toggle(self):
                selection = self.getCurrent()
                selection[1].toggle()
                self.invalidateCurrent()
        
        def toggle(self):
                selection = self.getCurrent()
                selection[1].toggle()
                self.invalidateCurrent()
-       
+
+       def handleKey(self, key):
+               selection = self.getCurrent()
+               if selection[1].parent.enabled:
+                       selection[1].handleKey(key)
+                       self.invalidateCurrent()
+
        def getCurrent(self):
                return self.l.getCurrentSelection()
        
        def invalidateCurrent(self):
                self.l.invalidateEntry(self.l.getCurrentSelectionIndex())
        def getCurrent(self):
                return self.l.getCurrentSelection()
        
        def invalidateCurrent(self):
                self.l.invalidateEntry(self.l.getCurrentSelectionIndex())
+               
+       def invalidate(self, entry):
+               i = 0
+               for x in self.__list:
+                       if (entry.getConfigPath() == x[1].parent.getConfigPath()):
+                               self.l.invalidateEntry(i)
+                       i += 1
+
+       GUI_WIDGET = eListbox
        
        
-       def GUIcreate(self, parent, skindata):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
+       def selectionChanged(self):
+               for x in self.onSelectionChanged:
+                       x()
+
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.selectionChanged.get().append(self.selectionChanged)
        
        
-       def GUIdelete(self):
-               self.instance.setContent(None)
-               self.instance = None
+       def setList(self, list):
+               self.__list = list
+               self.l.setList(self.__list)
+
+       def getList(self):
+               return self.__list
 
 
+       list = property(getList, setList)