1 # -*- coding: ISO-8859-1 -*-
2 #===============================================================================
3 # VLC Player Plugin by A. Lätsch 2007
4 # modified by Volker Christian 2008
6 # This is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free
8 # Software Foundation; either version 2, or (at your option) any later
10 #===============================================================================
13 from enigma import eListboxPythonMultiContent, RT_HALIGN_LEFT, gFont
15 from Tools.LoadPixmap import LoadPixmap
16 from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
17 from Components.MenuList import MenuList
19 from skin import parseFont
21 class VlcPlayList(MenuList):
22 def __init__(self, getPlaylistEntriesCB):
23 MenuList.__init__(self, list, False, eListboxPythonMultiContent)
24 self.font = gFont("Regular", 18)
25 self.l.setFont(0, self.font)
26 self.l.setItemHeight(23)
27 self.l.setBuildFunc(self.buildListboxEntry)
28 self.getPlaylistEntriesCB = getPlaylistEntriesCB
30 def applySkin(self, desktop, parent):
32 if self.skinAttributes is not None:
33 for (attrib, value) in self.skinAttributes:
35 self.font = parseFont(value, ((1,1),(1,1)))
36 self.l.setFont(0, self.font)
37 elif attrib == "itemHeight":
38 self.l.setItemHeight(int(value))
40 attribs.append((attrib, value))
41 self.skinAttributes = attribs
42 return MenuList.applySkin(self, desktop, parent)
45 def buildListboxEntry(self, name, path):
46 size = self.l.getItemSize()
47 height = size.height()
50 (eListboxPythonMultiContent.TYPE_TEXT, height + 15, 0, size.width() - height - 15, height, 0, RT_HALIGN_LEFT, name)
53 png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/movie.png"))
56 res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 0, height, height, png))
61 files = self.getPlaylistEntriesCB()
66 fileEntries.append((name, path))
67 fileEntries.sort(cmp = lambda x, y: cmp(x[1][7], y[1][7]))
68 self.list = fileEntries
69 self.l.setList(self.list)
73 cur = self.getCurrent()
78 def getNextFile(self):
79 i = self.getSelectedIndex() + 1
80 if i < len(self.list):
82 return self.getCurrent()
85 def getPrevFile(self):
86 i = self.getSelectedIndex() - 1
87 if i < len(self.list):
89 return self.getCurrent()