allow styleable TemplatedMultiContent lists
[enigma2.git] / lib / python / Components / MediaPlayer.py
index 84f7bec7b9ddd7db68f07d6d6664564c3787daa5..87ba977c0cbc9dba8ff39389289da66a9a52d6d7 100644 (file)
@@ -22,7 +22,10 @@ ForwardIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/i
 
 def PlaylistEntryComponent(serviceref, state):
        res = [ serviceref ]
-       res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 0, 470, 32, 0, RT_VALIGN_CENTER, path.split(serviceref.getPath().split('/')[-1])[1]))
+       text = serviceref.getName()
+       if text is "":
+               text = path.split(serviceref.getPath().split('/')[-1])[1]
+       res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 0, 470, 32, 0, RT_VALIGN_CENTER, text))
        png = None
        if state == STATE_PLAY:
                png = PlayIcon
@@ -37,7 +40,7 @@ def PlaylistEntryComponent(serviceref, state):
 
        if png is not None:
                res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 0, 16, 16, png))
-    
+
        return res
 
 class PlayList(MenuList):
@@ -61,6 +64,10 @@ class PlayList(MenuList):
        def addFile(self, serviceref):
                self.list.append(PlaylistEntryComponent(serviceref, STATE_NONE))
 
+       def updateFile(self, index, newserviceref):
+               if index < len(self.list):
+                   self.list[index] = PlaylistEntryComponent(newserviceref, STATE_NONE)
+
        def deleteFile(self, index):
                if self.currPlaying >= index:
                        self.currPlaying -= 1
@@ -69,6 +76,7 @@ class PlayList(MenuList):
        def setCurrentPlaying(self, index):
                self.oldCurrPlaying = self.currPlaying
                self.currPlaying = index
+               self.moveToIndex(index)
 
        def updateState(self, state):
                if len(self.list) > self.oldCurrPlaying and self.oldCurrPlaying != -1: