simplify GUIcreate/createWidget, fix base class order
[enigma2.git] / lib / python / Components / MediaPlayer.py
index 31799c5bff97c81d7572916a67d8fcd002296fc2..c271c3c64989bfa5105efbe6edee5ddfc369f9cc 100644 (file)
@@ -50,7 +50,7 @@ def PlaylistEntryComponent(serviceref, state):
     
        return res
 
-class PlayList(HTMLComponent, GUIComponent, MenuList):
+class PlayList(MenuList, HTMLComponent, GUIComponent):
        def __init__(self):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
@@ -61,14 +61,17 @@ class PlayList(HTMLComponent, GUIComponent, MenuList):
                self.oldCurrPlaying = -1
        
        def clear(self):
-               self.list = []
+               del self.list[:]
                self.l.setList(self.list)
-    
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(32)
-       
+               self.currPlaying = 0
+               self.oldCurrPlaying = -1
+
+       GUI_WIDGET = eListbox
+
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(32)
+
        def getSelection(self):
                return self.l.getCurrentSelection()[0]
                
@@ -81,8 +84,8 @@ class PlayList(HTMLComponent, GUIComponent, MenuList):
        def deleteFile(self, index):
                if self.currPlaying >= index:
                        self.currPlaying -= 1
-               self.list = self.list[:index] + self.list[index + 1:]
-       
+               del self.list[index]
+
        def setCurrentPlaying(self, index):
                self.oldCurrPlaying = self.currPlaying
                self.currPlaying = index
@@ -121,4 +124,4 @@ class PlayList(HTMLComponent, GUIComponent, MenuList):
                return list
        
        def __len__(self):
-               return len(self.list)
\ No newline at end of file
+               return len(self.list)