verify that ConfigList entries are ConfigElements
[enigma2.git] / lib / python / Components / ConfigList.py
index e586f39..c93b10f 100644 (file)
@@ -1,6 +1,6 @@
 from HTMLComponent import *
 from GUIComponent import *
-from config import KEY_LEFT, KEY_RIGHT, KEY_0, KEY_DELETE, KEY_OK, KEY_TIMEOUT
+from config import KEY_LEFT, KEY_RIGHT, KEY_0, KEY_DELETE, KEY_OK, KEY_TIMEOUT, ConfigElement
 from Components.ActionMap import NumberActionMap
 from enigma import eListbox, eListboxPythonConfigContent, eTimer
 
@@ -52,17 +52,13 @@ class ConfigList(HTMLComponent, GUIComponent, object):
                n = self.getCurrent()
                
                if self.help_window:
-                       print "close old help window!"
                        self.session.deleteDialog(self.help_window)
                
                nh = n and n[1].helpWindow()
-               print "n, nh:", n, nh
                if nh is not None and self.session is not None:
-                       print "show new help window"
                        self.help_window = self.session.instantiateDialog(*nh)
                        self.help_window.show()
 
-               print "config selection changed, from ", self.current, " to ", n
                self.current = n
                for x in self.onSelectionChanged:
                        x()
@@ -74,10 +70,14 @@ class ConfigList(HTMLComponent, GUIComponent, object):
        def preWidgetRemove(self, instance):
                instance.selectionChanged.get().remove(self.selectionChanged)
        
-       def setList(self, list):
-               self.__list = list
+       def setList(self, l):
+               self.__list = l
                self.l.setList(self.__list)
 
+               if l is not None:
+                       for x in l:
+                               assert isinstance(x[1], ConfigElement), "entry in ConfigList " + str(x[1]) + " must be a ConfigElement"
+
        def getList(self):
                return self.__list
 
@@ -104,8 +104,8 @@ class ConfigListScreen:
                        "8": self.keyNumberGlobal,
                        "9": self.keyNumberGlobal,
                        "0": self.keyNumberGlobal
-               }, -1)
-
+               }, -1) # to prevent left/right overriding the listbox
+               
                self["config"] = ConfigList(list, session = session)
 
        def keyOK(self):