- minor bugfix (allow empty content)
[enigma2.git] / components.py
index 4c26c0a029b4cfb10de887f2ca79a68b06626070..76423387d25242b633a35e8126d21e53e7944552 100644 (file)
@@ -97,8 +97,10 @@ class GUIComponent:
                i = self.GUIcreateInstance(self, parent, skindata)
                priv["instance"] = i
                self.notifier.append(i)
-               if self.notifierAdded:
+               try:
                        self.notifierAdded(i)
+               except:
+                       pass
        
        # GUIdelete must delete *all* references to the current component!
        def GUIdelete(self, priv):
@@ -221,3 +223,21 @@ class VolumeBar(HTMLComponent, GUIComponent, VariableValue):
                g = eSlider(parent)
                g.setRange(0, 100)
                return g
+
+
+class MenuList(HTMLComponent, GUIComponent):
+       def __init__(self, list):
+               GUIComponent.__init__(self)
+               self.l = eListboxPythonStringContent()
+               self.l.setList(list)
+       
+       def getCurrent(self):
+               return self.l.getCurrentSelection()
+       
+       def GUIcreateInstance(self, priv, parent, skindata):
+               g = eListbox(parent)
+               g.setContent(self.l)
+               return g
+       
+       def GUIdeleteInstance(self, g):
+               g.setContent(None)