MovieList - added skin parameters for support fullhd
authorims <ims21@users.sourceforge.net>
Tue, 20 Jan 2015 00:13:52 +0000 (01:13 +0100)
committerlittlesat <littlesat99@yahoo.com>
Tue, 20 Jan 2015 10:03:23 +0000 (11:03 +0100)
Signed-off-by: littlesat <littlesat99@yahoo.com>

lib/python/Components/MovieList.py

index 13f8a8f..fafc730 100644 (file)
@@ -13,7 +13,7 @@ import NavigationInstance
 import skin
 
 from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformation, \
-       RT_HALIGN_LEFT, RT_HALIGN_RIGHT, eServiceReference, eServiceCenter, eTimer
+       RT_HALIGN_LEFT, RT_HALIGN_RIGHT, eServiceReference, eServiceCenter, eTimer, RT_VALIGN_CENTER
 
 AUDIO_EXTENSIONS = frozenset((".dts", ".mp3", ".wav", ".wave", ".ogg", ".flac", ".m4a", ".mp2", ".m2a", ".3gp", ".3g2", ".asf", ".wma"))
 DVD_EXTENSIONS = ('.iso', '.img')
@@ -158,6 +158,20 @@ class MovieList(GUIComponent):
                self.fontSizesCompact = (20,14)
                self.fontSizesMinimal = (20,16)
                self.itemHeights = (75,37,25)
+               self.pbarShift = 5
+               self.pbarHeight = 16
+               self.pbarLargeWidth = 48
+               self.partIconeShiftMinimal = 5
+               self.partIconeShiftCompact = 4
+               self.partIconeShiftOriginal = 5
+               self.spaceRight = 2
+               self.spaceIconeText = 2
+               self.iconsWidth = 22
+               self.trashShift = 1
+               self.dirShift = 1
+               self.columnsOriginal = (180,200)
+               self.columnsCompactDescription = (120,140,154)
+               self.compactColumn = (200)
                self.reloadDelayTimer = None
                self.l = eListboxPythonMultiContent()
                self.tags = set()
@@ -257,6 +271,34 @@ class MovieList(GUIComponent):
                                                self.fontSizesMinimal = map(int, value.split(","))
                                        elif attrib == "itemHeights":
                                                self.itemHeights = map(int, value.split(","))
+                                       elif attrib == "pbarShift":
+                                               self.pbarShift = int(value)
+                                       elif attrib == "pbarHeight":
+                                               self.pbarHeight = int(value)
+                                       elif attrib == "pbarLargeWidth":
+                                               self.pbarLargeWidth = int(value)
+                                       elif attrib == "partIconeShiftMinimal":
+                                               self.partIconeShiftMinimal = int(value)
+                                       elif attrib == "partIconeShiftCompact":
+                                               self.partIconeShiftCompact = int(value)
+                                       elif attrib == "partIconeShiftOriginal":
+                                               self.partIconeShiftOriginal = int(value)
+                                       elif attrib == "spaceIconeText":
+                                               self.spaceIconeText = int(value)
+                                       elif attrib == "iconsWidth":
+                                               self.iconsWidth = int(value)
+                                       elif attrib == "trashShift":
+                                               self.trashShift = int(value)
+                                       elif attrib == "dirShift":
+                                               self.dirShift = int(value)
+                                       elif attrib == "spaceRight":
+                                               self.spaceRight = int(value)
+                                       elif attrib == "columnsOriginal":
+                                               self.columnsOriginal = map(int, value.split(","))
+                                       elif attrib == "columnsCompactDescription":
+                                               self.columnsCompactDescription = map(int, value.split(","))
+                                       elif attrib == "compactColumn":
+                                               self.compactColumn = int(value)
                                        else:
                                                attribs.append((attrib, value))
                                except Exception, e:
@@ -289,13 +331,18 @@ class MovieList(GUIComponent):
 
        def buildMovieListEntry(self, serviceref, info, begin, data):
                width = self.l.getItemSize().width()
+               iconSize = self.iconsWidth
+               space = self.spaceIconeText
+               r = self.spaceRight
                pathName = serviceref.getPath()
                res = [ None ]
 
                if serviceref.flags & eServiceReference.mustDescent:
                        # Directory
-                       iconSize = 22
                        # Name is full path name
+                       valign_center = 0
+                       if self.list_type == MovieList.LISTTYPE_MINIMAL:
+                               valign_center = RT_VALIGN_CENTER
                        if info is None:
                                # Special case: "parent"
                                txt = ".."
@@ -306,13 +353,13 @@ class MovieList(GUIComponent):
                                        p = os.path.split(p[0])
                                txt = p[1]
                                if txt == ".Trash":
-                                       res.append(MultiContentEntryPixmapAlphaTest(pos=(0,1), size=(iconSize,24), png=self.iconTrash))
-                                       res.append(MultiContentEntryText(pos=(iconSize+2, 0), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = _("Deleted items")))
-                                       res.append(MultiContentEntryText(pos=(width-145, 4), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT, text=_("Trash can")))
+                                       res.append(MultiContentEntryPixmapAlphaTest(pos=(0,self.trashShift), size=(iconSize,self.iconTrash.size().height()), png=self.iconTrash))
+                                       res.append(MultiContentEntryText(pos=(iconSize+space, 0), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT|valign_center, text = _("Deleted items")))
+                                       res.append(MultiContentEntryText(pos=(width-145-r, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|valign_center, text=_("Trash can")))
                                        return res
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=(0,1), size=(iconSize,iconSize), png=self.iconFolder))
-                       res.append(MultiContentEntryText(pos=(iconSize+2, 0), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = txt))
-                       res.append(MultiContentEntryText(pos=(width-145, 4), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT, text=_("Directory")))
+                       res.append(MultiContentEntryPixmapAlphaTest(pos=(0,self.dirShift), size=(iconSize,iconSize), png=self.iconFolder))
+                       res.append(MultiContentEntryText(pos=(iconSize+space, 0), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT|valign_center, text = txt))
+                       res.append(MultiContentEntryText(pos=(width-145-r, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|valign_center, text=_("Directory")))
                        return res
                if (data == -1) or (data is None):
                        data = MovieListData()
@@ -367,22 +414,21 @@ class MovieList(GUIComponent):
                        len = ""
 
                if data.icon is not None:
-                       iconSize = 22
                        if self.list_type in (MovieList.LISTTYPE_COMPACT_DESCRIPTION,MovieList.LISTTYPE_COMPACT):
-                               pos = (0,4)
+                               pos = (0,self.partIconeShiftCompact)
+                       elif self.list_type == MovieList.LISTTYPE_ORIGINAL:
+                               pos = (0,self.partIconeShiftOriginal)
                        else:
-                               pos = (0,5)
-                       res.append(MultiContentEntryPixmapAlphaTest(pos=pos, size=(iconSize,20), png=data.icon))
+                               pos = (0,self.partIconeShiftMinimal)
+                       res.append(MultiContentEntryPixmapAlphaTest(pos=pos, size=(iconSize,data.icon.size().height()), png=data.icon))
                switch = config.usage.show_icons_in_movielist.value
-               if switch == 'p' or switch == 's':
+               if switch in ('p', 's'):
                        if switch == 'p':
-                               iconSize = 48
-                       else:
-                               iconSize = 22
+                               iconSize = self.pbarLargeWidth
                        if data.part is not None:
-                               res.append(MultiContentEntryProgress(pos=(0,5), size=(iconSize-2,16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None))
+                               res.append(MultiContentEntryProgress(pos=(0,self.pbarShift), size=(iconSize, self.pbarHeight), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None))
                elif switch == 'i':
-                       iconSize = 22
+                       pass
                else:
                        iconSize = 0
 
@@ -392,59 +438,62 @@ class MovieList(GUIComponent):
 
                ih = self.itemHeight
                if self.list_type == MovieList.LISTTYPE_ORIGINAL:
+                       fc, sc = self.columnsOriginal[0], self.columnsOriginal[1]
                        ih1 = (ih * 2) / 5 # 75 -> 30
                        ih2 = (ih * 2) / 3 # 75 -> 50
-                       res.append(MultiContentEntryText(pos=(iconSize, 0), size=(width-182, ih1), font = 0, flags = RT_HALIGN_LEFT, text=data.txt))
+                       res.append(MultiContentEntryText(pos=(iconSize+space, 0), size=(width-fc-r, ih1), font = 0, flags = RT_HALIGN_LEFT, text=data.txt))
                        if self.tags:
-                               res.append(MultiContentEntryText(pos=(width-180, 0), size=(180, ih1), font = 2, flags = RT_HALIGN_RIGHT, text = info.getInfoString(serviceref, iServiceInformation.sTags)))
+                               res.append(MultiContentEntryText(pos=(width-fc-r, 0), size=(fc, ih1), font = 2, flags = RT_HALIGN_RIGHT, text = info.getInfoString(serviceref, iServiceInformation.sTags)))
                                if data.serviceName:
-                                       res.append(MultiContentEntryText(pos=(200, ih2), size=(200, ih2-ih1), font = 1, flags = RT_HALIGN_LEFT, text = data.serviceName))
+                                       res.append(MultiContentEntryText(pos=(sc-r, ih2), size=(sc, ih2-ih1), font = 1, flags = RT_HALIGN_LEFT, text = data.serviceName))
                        else:
                                if data.serviceName:
-                                       res.append(MultiContentEntryText(pos=(width-180, 0), size=(180, ih1), font = 2, flags = RT_HALIGN_RIGHT, text = data.serviceName))
-                       res.append(MultiContentEntryText(pos=(0, ih1), size=(width, ih2-ih1), font=1, flags=RT_HALIGN_LEFT, text=data.description))
-                       res.append(MultiContentEntryText(pos=(0, ih2), size=(200, ih-ih2), font=1, flags=RT_HALIGN_LEFT, text=begin_string))
+                                       res.append(MultiContentEntryText(pos=(width-fc-r, 0), size=(fc, ih1), font = 2, flags = RT_HALIGN_RIGHT, text = data.serviceName))
+                       res.append(MultiContentEntryText(pos=(0, ih1), size=(width-r, ih2-ih1), font=1, flags=RT_HALIGN_LEFT, text=data.description))
+                       res.append(MultiContentEntryText(pos=(0, ih2), size=(sc-r, ih-ih2), font=1, flags=RT_HALIGN_LEFT, text=begin_string))
                        if len:
-                            res.append(MultiContentEntryText(pos=(width-200, ih2), size=(198, ih-ih2), font=1, flags=RT_HALIGN_RIGHT, text=len))
+                            res.append(MultiContentEntryText(pos=(width-sc-r, ih2), size=(sc, ih-ih2), font=1, flags=RT_HALIGN_RIGHT, text=len))
                elif self.list_type == MovieList.LISTTYPE_COMPACT_DESCRIPTION:
                        ih1 = ((ih * 8) + 14) / 15 # 37 -> 20, round up
                        if len:
                             lenSize = 58 * ih / 37
                        else:
                             lenSize = 0
-                       res.append(MultiContentEntryText(pos=(iconSize, 0), size=(width-140, ih1), font = 0, flags = RT_HALIGN_LEFT, text = data.txt))
-                       res.append(MultiContentEntryText(pos=(0, ih1), size=(width-154-lenSize, ih-ih1), font=1, flags=RT_HALIGN_LEFT, text=data.description))
-                       res.append(MultiContentEntryText(pos=(width-120, 6), size=(120, ih1), font=1, flags=RT_HALIGN_RIGHT, text=begin_string))
+                       fc, sc, tc = self.columnsCompactDescription[0], self.columnsCompactDescription[1], self.columnsCompactDescription[2]
+                       res.append(MultiContentEntryText(pos=(iconSize+space, 0), size=(width-sc-r, ih1), font = 0, flags = RT_HALIGN_LEFT, text = data.txt))
+                       res.append(MultiContentEntryText(pos=(0, ih1), size=(width-tc-lenSize-r, ih-ih1), font=1, flags=RT_HALIGN_LEFT, text=data.description))
+                       res.append(MultiContentEntryText(pos=(width-fc-r, 6), size=(fc, ih1), font=1, flags=RT_HALIGN_RIGHT, text=begin_string))
                        if data.serviceName:
-                               res.append(MultiContentEntryText(pos=(width-154-lenSize, ih1), size=(154, ih-ih1), font = 1, flags = RT_HALIGN_RIGHT, text = data.serviceName))
+                               res.append(MultiContentEntryText(pos=(width-tc-lenSize-r, ih1), size=(tc, ih-ih1), font = 1, flags = RT_HALIGN_RIGHT, text = data.serviceName))
                        if lenSize:
-                            res.append(MultiContentEntryText(pos=(width-lenSize, ih1), size=(lenSize, ih-ih1), font=1, flags=RT_HALIGN_RIGHT, text=len))
+                            res.append(MultiContentEntryText(pos=(width-lenSize-r, ih1), size=(lenSize, ih-ih1), font=1, flags=RT_HALIGN_RIGHT, text=len))
                elif self.list_type == MovieList.LISTTYPE_COMPACT:
+                       col = self.compactColumn
                        ih1 = ((ih * 8) + 14) / 15 # 37 -> 20, round up
                        if len:
                             lenSize = 2 * ih
                        else:
                             lenSize = 0
-                       res.append(MultiContentEntryText(pos=(iconSize, 0), size=(width-lenSize-iconSize, ih1), font = 0, flags = RT_HALIGN_LEFT, text = data.txt))
+                       res.append(MultiContentEntryText(pos=(iconSize+space, 0), size=(width-lenSize-iconSize-space-r, ih1), font = 0, flags = RT_HALIGN_LEFT, text = data.txt))
                        if self.tags:
-                               res.append(MultiContentEntryText(pos=(width-200, ih1), size=(200, ih-ih1), font = 1, flags = RT_HALIGN_RIGHT, text = info.getInfoString(serviceref, iServiceInformation.sTags)))
+                               res.append(MultiContentEntryText(pos=(width-col-r, ih1), size=(col, ih-ih1), font = 1, flags = RT_HALIGN_RIGHT, text = info.getInfoString(serviceref, iServiceInformation.sTags)))
                                if data.serviceName:
-                                       res.append(MultiContentEntryText(pos=(200, ih1), size=(200, ih-ih1), font = 1, flags = RT_HALIGN_LEFT, text = data.serviceName))
+                                       res.append(MultiContentEntryText(pos=(col, ih1), size=(col, ih-ih1), font = 1, flags = RT_HALIGN_LEFT, text = data.serviceName))
                        else:
                                if data.serviceName:
-                                       res.append(MultiContentEntryText(pos=(width-200, ih1), size=(200, ih-ih1), font = 1, flags = RT_HALIGN_RIGHT, text = data.serviceName))
-                       res.append(MultiContentEntryText(pos=(0, ih1), size=(200, ih-ih1), font=1, flags=RT_HALIGN_LEFT, text=begin_string))
+                                       res.append(MultiContentEntryText(pos=(width-col-r, ih1), size=(col, ih-ih1), font = 1, flags = RT_HALIGN_RIGHT, text = data.serviceName))
+                       res.append(MultiContentEntryText(pos=(0, ih1), size=(col, ih-ih1), font=1, flags=RT_HALIGN_LEFT, text=begin_string))
                        if lenSize:
-                            res.append(MultiContentEntryText(pos=(width-lenSize, 0), size=(lenSize, ih1), font=0, flags=RT_HALIGN_RIGHT, text=len))
+                            res.append(MultiContentEntryText(pos=(width-lenSize-r, 0), size=(lenSize, ih1), font=0, flags=RT_HALIGN_RIGHT, text=len))
                else:
                        if (self.descr_state == MovieList.SHOW_DESCRIPTION) or not len:
                                dateSize = ih * 145 / 25   # 25 -> 145
-                               res.append(MultiContentEntryText(pos=(iconSize, 0), size=(width-iconSize-dateSize, ih), font = 0, flags = RT_HALIGN_LEFT, text = data.txt))
-                               res.append(MultiContentEntryText(pos=(width-dateSize, 4), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string))
+                               res.append(MultiContentEntryText(pos=(iconSize+space, 0), size=(width-iconSize-space-dateSize-r, ih), font = 0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = data.txt))
+                               res.append(MultiContentEntryText(pos=(width-dateSize-r, 4), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=begin_string))
                        else:
                                lenSize = ih * 3 # 25 -> 75
-                               res.append(MultiContentEntryText(pos=(iconSize, 0), size=(width-lenSize-iconSize, ih), font = 0, flags = RT_HALIGN_LEFT, text = data.txt))
-                               res.append(MultiContentEntryText(pos=(width-lenSize, 0), size=(lenSize, ih), font=0, flags=RT_HALIGN_RIGHT, text=len))
+                               res.append(MultiContentEntryText(pos=(iconSize+space, 0), size=(width-lenSize-iconSize-space-r, ih), font = 0, flags = RT_HALIGN_LEFT, text = data.txt))
+                               res.append(MultiContentEntryText(pos=(width-lenSize-r, 0), size=(lenSize, ih), font=0, flags=RT_HALIGN_RIGHT, text=len))
                return res
 
        def moveToFirstMovie(self):
@@ -568,7 +617,7 @@ class MovieList(GUIComponent):
                                self.list.append((serviceref, info, begin, -1))
                                numberOfDirs += 1
                                continue
-                       # convert space-seperated list of tags into a set
+                       # convert separe-seperated list of tags into a set
                        this_tags = info.getInfoString(serviceref, iServiceInformation.sTags).split(' ')
                        name = info.getName(serviceref)
                        if this_tags == ['']:
@@ -692,7 +741,7 @@ class MovieList(GUIComponent):
                                # if path ends in '/', p is blank.
                                p = os.path.split(p[0])
                        name = p[1]
-                # print "Sorting for -%s-" % name
+               # print "Sorting for -%s-" % name
 
                return (1, name and name.lower() or "", -x[2])