add kill to Console
[enigma2.git] / lib / python / Components / Renderer / Listbox.py
index d784b614751f02a50eb1c76cdb10dd68e45f3567..7a895330aa2381f8cc03d5c6348e346096cdabee 100644 (file)
@@ -1,7 +1,4 @@
-from Components.VariableText import VariableText
 from Renderer import Renderer
-from Tools.Event import Event
-
 from enigma import eListbox
 
 # the listbox renderer is the listbox, but no listbox content.
@@ -42,11 +39,15 @@ class Listbox(Renderer, object):
                self.wrap_around = self.wrap_around # trigger
                self.selection_enabled = self.selection_enabled # trigger
 
+       def preWidgetRemove(self, instance):
+               instance.setContent(None)
+               instance.selectionChanged.get().remove(self.selectionChanged)
+
        def setWrapAround(self, wrap_around):
                self.__wrap_around = wrap_around
                if self.instance is not None:
                        self.instance.setWrapAround(self.__wrap_around)
-       
+
        wrap_around = property(lambda self: self.__wrap_around, setWrapAround)
 
        def selectionChanged(self):
@@ -54,16 +55,16 @@ class Listbox(Renderer, object):
 
        def getIndex(self):
                if self.instance is None:
-                       return None
+                       return 0
                return self.instance.getCurrentIndex()
-               
+
        def moveToIndex(self, index):
                if self.instance is None:
                        return
                self.instance.moveSelectionTo(index)
 
        index = property(getIndex, moveToIndex)
-       
+
        def move(self, direction):
                if self.instance is not None:
                        self.instance.moveSelection(direction)
@@ -77,3 +78,7 @@ class Listbox(Renderer, object):
 
        def changed(self, what):
                self.content = self.source.content
+
+       def entry_changed(self, index):
+               if self.instance is not None:
+                       self.instance.entryChanged(index)