add possibility to disable/enable listbox selection in multicontent templates
[vuplus_dvbapp] / lib / python / Components / Renderer / Listbox.py
index ef8206a..640121e 100644 (file)
@@ -39,6 +39,10 @@ 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:
@@ -51,7 +55,7 @@ class Listbox(Renderer, object):
 
        def getIndex(self):
                if self.instance is None:
-                       return None
+                       return 0
                return self.instance.getCurrentIndex()
 
        def moveToIndex(self, index):
@@ -73,4 +77,12 @@ class Listbox(Renderer, object):
        selection_enabled = property(lambda self: self.__selection_enabled, setSelectionEnabled)
 
        def changed(self, what):
+               if hasattr(self.source, "selectionEnabled"):
+                       self.selection_enabled = self.source.selectionEnabled
+               if len(what) > 1 and isinstance(what[1], str) and what[1] == "style":
+                       return
                self.content = self.source.content
+
+       def entry_changed(self, index):
+               if self.instance is not None:
+                       self.instance.entryChanged(index)