def run(self): global MyPiconsList print "[TVWall]FillPiconsList:run" for idx in range( 0 , len(MyList) ): MyPiconsList.append(LoadPixmap(cached = True, path = getPiconName(MyList[idx][0]))) print len(MyPiconsList) return
def updateIcons(self): pageidx = self.currPage * (self.numOfCol*self.numOfRow) idx = 0 for y in range(1,self.numOfRow+1): for x in range(1,self.numOfCol+1): chnameIndex = "chname_%s%s" % (x,y) strIndex = "cover_%s%s" % (x,y) if pageidx + idx < self.numOfItems: PiconPath = getPiconName(self.currList[pageidx+idx][0]) print("updateIcon for self[%s], channel %s, picon %s" % (strIndex, self.currList[pageidx+idx][1],PiconPath)) if config.plugins.TVWall.PreloadPicons.value == True: try: self[strIndex].setPixmap(MyPiconsList[pageidx + idx]) except: print "[TVWall]updateIcons:exception" self[strIndex].setPixmap(LoadPixmap(cached = True, path = PiconPath)) else: self[strIndex].setPixmap(LoadPixmap(cached = True, path = PiconPath)) #if icon available, don't display channel name if os_path.exists(PiconPath) and not PiconPath.endswith("picon_default.png"): self[strIndex].show() self[chnameIndex].setText("") else: print "picon for %s not exists" % self.currList[pageidx+idx][1] self[strIndex].hide() self[chnameIndex].setText(self.currList[pageidx+idx][1]) idx += 1 else: self[strIndex].hide() self[chnameIndex].setText("")
def findPicon(self, serviceName): try: if '::' in serviceName: serviceName = serviceName.split('::')[0] + ':' except: pass pngname = getPiconName(serviceName.toString()) return pngname
def run(self): global MyPiconsList print "[TVWall]FillPiconsList:run" for idx in range(0, len(MyList)): MyPiconsList.append( LoadPixmap(cached=True, path=getPiconName(MyList[idx][0]))) print len(MyPiconsList) return
def addPicon(): refstr = None if hasattr(timer.service_ref, 'sref'): refstr = str(timer.service_ref.sref) else: refstr = str(timer.service_ref) displayPicon = None picon = getPiconName(refstr) if picon != "": displayPicon = LoadPixmap(picon) if displayPicon is not None: res.append(MultiContentEntryPixmapAlphaBlend( pos = (colX, 0), size = (piconWidth, self.itemHeight), png = displayPicon, backcolor = None, backcolor_sel = None, flags = BT_SCALE | BT_KEEP_ASPECT_RATIO | BT_ALIGN_CENTER)) return piconWidth
def updateIcons(self): pageidx = self.currPage * (self.numOfCol * self.numOfRow) idx = 0 for y in range(1, self.numOfRow + 1): for x in range(1, self.numOfCol + 1): chnameIndex = "chname_%s%s" % (x, y) strIndex = "cover_%s%s" % (x, y) if pageidx + idx < self.numOfItems: PiconPath = getPiconName(self.currList[pageidx + idx][0]) print( "updateIcon for self[%s], channel %s, picon %s" % (strIndex, self.currList[pageidx + idx][1], PiconPath)) if config.plugins.TVWall.PreloadPicons.value == True: try: self[strIndex].setPixmap(MyPiconsList[pageidx + idx]) except: print "[TVWall]updateIcons:exception" self[strIndex].setPixmap( LoadPixmap(cached=True, path=PiconPath)) else: self[strIndex].setPixmap( LoadPixmap(cached=True, path=PiconPath)) #if icon available, don't display channel name if os_path.exists(PiconPath) and not PiconPath.endswith( "picon_default.png"): self[strIndex].show() self[chnameIndex].setText("") else: print "picon for %s not exists" % self.currList[ pageidx + idx][1] self[strIndex].hide() self[chnameIndex].setText(self.currList[pageidx + idx][1]) idx += 1 else: self[strIndex].hide() self[chnameIndex].setText("")
def fillpixmapList(self): for idx in range(0, self.numOfItems): self.pixmapList.append( LoadPixmap(getPiconName(self.currList[idx][0]))) return
def buildEPGSearchEntry(self, service, eventId, beginTime, duration, EventName): rec1 = self.getClockTypesForEntry(service, eventId, beginTime, duration) # Partnerbox if PartnerBoxIconsEnabled: rec2 = beginTime and isInRemoteTimer(self, beginTime, duration, service) else: rec2 = False r1 = self.weekday_rect r2 = self.datetime_rect r3 = self.descr_rect dx = self.piconSize[0] + self.piconDistance nowTime = int(time()) remaining = "" if beginTime is not None: if nowTime < beginTime: remaining = _(" (%d min)") % (duration / 60) else: prefix = "+" total = ((beginTime+duration) - nowTime) / 60 if total <= 0: prefix = "" remaining = _(" (%s%d min)") % (prefix, total) t = localtime(beginTime) serviceref = ServiceReference(service) # for Servicename if config.plugins.epgsearch.picons.value: if getPiconsName: picon = getPiconName(service) else: picon = self.findPicon(service) if picon != "": self.picon.setPara((self.piconSize[0], self.piconSize[1], 1, 1, False, 1, '#000f0f0f')) self.picon.startDecode(picon, 0, 0, False) png = self.picon.getData() dy = int((self.height - self.piconSize[1])/2.) res = [ None, # no private data needed (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r1.left(), r1.top()+ dy, self.piconSize[0], self.piconSize[1], png), (eListboxPythonMultiContent.TYPE_TEXT, r1.left() + dx, r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]), (eListboxPythonMultiContent.TYPE_TEXT, r2.left() + dx, r2.top(), r2.width(), r1.height(), 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4])) ] else: res = [ None, # no private data needed (eListboxPythonMultiContent.TYPE_TEXT, r1.left() + dx, r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]), (eListboxPythonMultiContent.TYPE_TEXT, r2.left() + dx, r2.top(), r2.width(), r1.height(), 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4])) ] else: res = [ None, # no private data needed (eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_RIGHT, self.days[t[6]]), (eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r1.height(), 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4])) ] if config.plugins.epgsearch.picons.value: if rec1 or rec2: if rec1: clock_types = rec1 # maybe Partnerbox too if rec2: if PartnerBoxZapRepIcons: clock_pic_partnerbox = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId) else: clock_pic_partnerbox = getRemoteClockPixmap(self, service, beginTime, duration, eventId) else: if PartnerBoxZapRepIcons: clock_pic = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId) else: clock_pic = getRemoteClockPixmap(self, service, beginTime, duration, eventId) if rec1 and rec2: # Partnerbox and local for i in range(len(clock_types)): res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.space + dx, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]])) res.extend(( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + (i + 1) * self.space + dx, r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic_partnerbox), (eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + self.pboxDistance + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))) else: if rec1: for i in range(len(clock_types)): res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.space + dx, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]])) res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + dx + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)) else: res.extend(( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + dx, r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic), (eListboxPythonMultiContent.TYPE_TEXT, r3.left() + self.pboxDistance + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))) else: res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + dx, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)) else: if rec1 or rec2: if rec1: clock_types = rec1 # maybe Partnerbox too if rec2: if PartnerBoxZapRepIcons: clock_pic_partnerbox = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId) else: clock_pic_partnerbox = getRemoteClockPixmap(self, service, beginTime, duration, eventId) else: if PartnerBoxZapRepIcons: clock_pic = getRemoteClockZapPixmap(self, service, beginTime, duration, eventId) else: clock_pic = getRemoteClockPixmap(self, service, beginTime, duration, eventId) if rec1 and rec2: # Partnerbox and local for i in range(len(clock_types)): res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.space, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]])) res.extend(( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + (i + 1) * self.space, r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic_partnerbox), (eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))) else: if rec1: for i in range(len(clock_types)): res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left() + i * self.iconSize, r3.top() + self.dy, self.iconSize, self.iconSize, self.clocks[clock_types[i]])) res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left() + (i + 1) * self.space + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)) else: res.extend(( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r3.left(), r3.top() + self.dy, self.iconSize, self.iconSize, clock_pic), (eListboxPythonMultiContent.TYPE_TEXT, r3.left() + self.space + self.nextIcon, r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining))) else: res.append((eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), r3.width(), r3.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, serviceref.getServiceName() + ": " + EventName + remaining)) return res
def buildMovieListEntry(self, serviceref, info, begin, data): switch = config.usage.show_icons_in_movielist.value ext = config.movielist.useextlist.value width = self.l.getItemSize().width() pathName = serviceref.getPath() res = [None] if ext != "0": ih = self.itemHeight / 2 else: ih = self.itemHeight if self.screenwidth and self.screenwidth == 1920: listBeginX = 3 listEndX = 3 listMarginX = 12 pathIconSize = 29 dataIconSize = 25 progressIconSize = 25 progressBarSize = 72 textPosY = 2 else: listBeginX = 2 listEndX = 2 listMarginX = 8 pathIconSize = 25 dataIconSize = 21 progressIconSize = 21 progressBarSize = 48 textPosY = 1 textPosX = listBeginX + dataIconSize + listMarginX if serviceref.flags & eServiceReference.mustDescent: # Directory iconSize = pathIconSize iconPosX = listBeginX - 1 iconPosY = ih / 2 - iconSize / 2 if iconPosY < iconPosX: iconPosY = iconPosX # Name is full path name if info is None: # Special case: "parent" txt = ".." else: p = os.path.split(pathName) if not p[1]: # if path ends in '/', p is blank. p = os.path.split(p[0]) txt = p[1] if txt == ".Trash": dateSize = getTextBoundarySize( self.instance, self.dateFont, self.l.getItemSize(), _("Trashcan") ).width() res.append( MultiContentEntryPixmapAlphaBlend( pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=self.iconTrash ) ) res.append( MultiContentEntryText( pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=_("Deleted items"), ) ) res.append( MultiContentEntryText( pos=(width - dateSize - listEndX, textPosY), size=(dateSize, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Trashcan"), ) ) return res dateSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), _("Directory")).width() res.append( MultiContentEntryPixmapAlphaBlend( pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=self.iconFolder ) ) res.append( MultiContentEntryText( pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=txt, ) ) res.append( MultiContentEntryText( pos=(width - dateSize - listEndX, textPosY), size=(dateSize, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Directory"), ) ) return res if (data == -1) or (data is None): data = MovieListData() cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] # x = ref,info,begin,... data.len = 0 # dont recalc movielist to speedup loading the list self.list[cur_idx] = ( x[0], x[1], x[2], data, ) # update entry in list... so next time we don't need to recalc data.txt = info.getName(serviceref) if config.movielist.hide_extensions.value: fileName, fileExtension = os.path.splitext(data.txt) if fileExtension in KNOWN_EXTENSIONS: data.txt = fileName data.icon = None data.part = None if os.path.split(pathName)[1] in self.runningTimers: if switch == "i": if (self.playInBackground or self.playInForeground) and serviceref == ( self.playInBackground or self.playInForeground ): data.icon = self.iconMoviePlayRec else: data.icon = self.iconMovieRec elif switch == "p" or switch == "s": data.part = 100 if (self.playInBackground or self.playInForeground) and serviceref == ( self.playInBackground or self.playInForeground ): data.partcol = self.pbarColourSeen else: data.partcol = self.pbarColourRec elif (self.playInBackground or self.playInForeground) and serviceref == ( self.playInBackground or self.playInForeground ): data.icon = self.iconMoviePlay else: data.part = moviePlayState(pathName + ".cuts", serviceref, data.len) if switch == "i": if data.part is not None and data.part > 0: data.icon = self.iconPart[data.part // 25] else: if config.usage.movielist_unseen.value: data.icon = self.iconUnwatched elif switch == "p" or switch == "s": if data.part is not None and data.part > 0: data.partcol = self.pbarColourSeen else: if config.usage.movielist_unseen.value: data.part = 100 data.partcol = self.pbarColour len = data.len if len > 0: len = "%d:%02d" % (len / 60, len % 60) else: len = "" iconSize = 0 if switch == "i": iconSize = dataIconSize iconPosX = listBeginX iconPosY = ih / 2 - iconSize / 2 if iconPosY < iconPosX: iconPosY = iconPosX res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=data.icon) ) elif switch == "p": if data.part is not None and data.part > 0: iconSize = progressBarSize iconPosX = listBeginX iconPosY = ih / 2 - iconSize / 8 if iconPosY < iconPosX: iconPosY = iconPosX res.append( MultiContentEntryProgress( pos=(iconPosX, iconPosY), size=(iconSize, iconSize / 4), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None, ) ) else: iconSize = dataIconSize iconPosX = listBeginX iconPosY = ih / 2 - iconSize / 2 if iconPosY < iconPosX: iconPosY = iconPosX res.append( MultiContentEntryPixmapAlphaBlend( pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=data.icon ) ) elif switch == "s": iconSize = progressIconSize iconPosX = listBeginX iconPosY = ih / 2 - iconSize / 2 if iconPosY < iconPosX: iconPosY = iconPosX if data.part is not None and data.part > 0: res.append( MultiContentEntryProgress( pos=(iconPosX, iconPosY), size=(iconSize, iconSize), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None, ) ) else: res.append( MultiContentEntryPixmapAlphaBlend( pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=data.icon ) ) begin_string = "" if begin > 0: begin_string = ", ".join(FuzzyTime(begin, inPast=True)) dateSize = serviceSize = getTextBoundarySize( self.instance, self.dateFont, self.l.getItemSize(), begin_string ).width() if iconSize: textPosX = listBeginX + iconSize + listMarginX else: textPosX = listBeginX if ext != "0": getrec = info.getName(serviceref) fileName, fileExtension = os.path.splitext(getrec) desc = None picon = None service = None try: serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(serviceref) desc = info.getInfoString(serviceref, iServiceInformation.sDescription) # get description ref = info.getInfoString(serviceref, iServiceInformation.sServiceref) # get reference service = ServiceReference(ref).getServiceName() # get service name serviceSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), service).width() except Exception, e: print ("[MovieList] load extended infos get failed: ", e) if ext == "2": try: picon = getPiconName(ref) picon = loadPNG(picon) except Exception, e: print ("[MovieList] load picon get failed: ", e)
def buildMovieListEntry(self, serviceref, info, begin, data): switch = config.usage.show_icons_in_movielist.value ext = config.movielist.useextlist.value width = self.l.getItemSize().width() pathName = serviceref.getPath() res = [ None ] if serviceref.flags & eServiceReference.mustDescent: if self.screenwidth and self.screenwidth == 1920: # Directory iconSize = 37 else: iconSize = 22 # Name is full path name if info is None: # Special case: "parent" txt = ".." else: p = os.path.split(pathName) if not p[1]: # if path ends in '/', p is blank. p = os.path.split(p[0]) txt = p[1] if txt == ".Trash": if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryPixmapAlphaBlend(pos=(3,5), size=(iconSize,37), png=self.iconTrash)) res.append(MultiContentEntryText(pos=(40+20, 5), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = _("Deleted items"))) res.append(MultiContentEntryText(pos=(width-145, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Trashcan"))) return res else: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,2), size=(iconSize,24), png=self.iconTrash)) res.append(MultiContentEntryText(pos=(iconSize+10, 0), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = _("Deleted items"))) res.append(MultiContentEntryText(pos=(width-150, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Trashcan"))) return res if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryPixmapAlphaBlend(pos=(3,5), size=(iconSize,iconSize), png=self.iconFolder)) res.append(MultiContentEntryText(pos=(40+20, 5), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = txt)) res.append(MultiContentEntryText(pos=(width-145, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Directory"))) return res else: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,2), size=(iconSize,iconSize), png=self.iconFolder)) res.append(MultiContentEntryText(pos=(iconSize+10, 0), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = txt)) res.append(MultiContentEntryText(pos=(width-150, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Directory"))) return res if (data == -1) or (data is None): data = MovieListData() cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] # x = ref,info,begin,... data.len = 0 #dont recalc movielist to speedup loading the list self.list[cur_idx] = (x[0], x[1], x[2], data) #update entry in list... so next time we don't need to recalc data.txt = info.getName(serviceref) if config.movielist.hide_extensions.value: fileName, fileExtension = os.path.splitext(data.txt) if fileExtension in KNOWN_EXTENSIONS: data.txt = fileName data.icon = None data.part = None if os.path.split(pathName)[1] in self.runningTimers: if switch == 'i': if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlayRec else: data.icon = self.iconMovieRec elif switch == 'p' or switch == 's': data.part = 100 if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.partcol = 0xffc71d else: data.partcol = 0xff001d elif (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlay else: data.part = moviePlayState(pathName + '.cuts', serviceref, data.len) if switch == 'i': if data.part is not None and data.part > 0: data.icon = self.iconPart[data.part // 25] else: if config.usage.movielist_unseen.value: data.icon = self.iconUnwatched elif switch == 'p' or switch == 's': if data.part is not None and data.part > 0: data.partcol = 0xffc71d else: if config.usage.movielist_unseen.value: data.part = 100 data.partcol = 0x206333 len = data.len if len > 0: len = "%d:%02d" % (len / 60, len % 60) else: len = "" iconSize = 0 if switch == 'i': if self.screenwidth and self.screenwidth == 1920: iconSize = 42 res.append(MultiContentEntryPixmapAlphaBlend(pos=(2,3), size=(iconSize,iconSize), png=data.icon)) else: iconSize = 22 res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,20), png=data.icon)) elif switch == 'p': if self.screenwidth and self.screenwidth == 1920: iconSize = 42 else: iconSize = 48 if data.part is not None and data.part > 0: if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryProgress(pos=(0,10), size=(iconSize+5,16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: res.append(MultiContentEntryProgress(pos=(0,5), size=(iconSize-2,16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,iconSize), png=data.icon)) else: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,20), png=data.icon)) elif switch == 's': if self.screenwidth and self.screenwidth == 1920: iconSize = 42 else: iconSize = 22 if data.part is not None and data.part > 0: if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryProgress(pos=(0,10), size=(iconSize+5,16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: res.append(MultiContentEntryProgress(pos=(0,5), size=(iconSize-2,16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,iconSize), png=data.icon)) else: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,20), png=data.icon)) begin_string = "" if begin > 0: begin_string = ', '.join(FuzzyTime(begin, inPast = True)) if ext != '0': ih = self.itemHeight / 2 else: ih = self.itemHeight lenSize = ih * 3 # 25 -> 75 dateSize = ih * 145 / 25 # 25 -> 145 if ext != '0': getrec = info.getName(serviceref) fileName, fileExtension = os.path.splitext(getrec) desc = None picon = None service = None try: serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(serviceref) desc = info.getInfoString(serviceref, iServiceInformation.sDescription) # get description ref = info.getInfoString(serviceref, iServiceInformation.sServiceref) # get reference service = ServiceReference(ref).getServiceName() # get service name except Exception, e: print('[MovieList] load extended infos get failed: ', e) if ext == '2': try: picon = getPiconName(ref) picon = loadPNG(picon) except Exception, e: print('[MovieList] load picon get failed: ', e)
def getInternalPicon(self, serviceRef): from Components.Renderer.Picon import getPiconName return getPiconName(serviceRef)
def buildEntry(self, service, service_name, events, picon): r1 = self.service_rect r2 = self.event_rect if picon is None: # go find picon and cache its location picon = getPiconName(service) curIdx = self.l.getCurrentSelectionIndex() self.list[curIdx] = (service, service_name, events, picon) if self.currentlyPlaying is not None and self.currentlyPlaying.toString( ) == service: serviceForeColor = self.foreColorServiceSelected serviceBackColor = self.backColorServiceSelected else: serviceForeColor = self.foreColorService serviceBackColor = self.backColorService res = [None] # Picon and Service name res.append( MultiContentEntryText(pos=(r1.x, r1.y), size=(r1.w, r1.h), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text="", color=serviceForeColor, color_sel=serviceForeColor, backcolor=serviceBackColor, backcolor_sel=serviceBackColor, border_width=self.serviceBorderWidth, border_color=self.borderColorService)) if self.showPicon: if self.piconSize is not None: piconHeight = self.piconSize.h - 2 * self.serviceBorderWidth piconWidth = self.piconSize.w - 2 * self.serviceBorderWidth else: piconHeight = r1.h - 2 * self.serviceBorderWidth piconWidth = 2 * piconHeight # FIXME: could do better... if piconWidth > r1.w - 2 * self.serviceBorderWidth: piconWidth = r1.w - 2 * self.serviceBorderWidth if picon != "": self.picload.setPara( (piconWidth, piconHeight, 1, 1, 1, 1, "#FFFFFFFF")) self.picload.startDecode(picon, piconWidth, piconHeight, False) displayPicon = self.picload.getData() if displayPicon is not None: res.append( MultiContentEntryPixmapAlphaTest( pos=(r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth), size=(piconWidth, piconHeight), png=displayPicon, backcolor=None, backcolor_sel=None)) else: piconWidth = 0 if self.showServiceTitle or picon == "" or not self.showPicon: res.append( MultiContentEntryText( pos=(r1.x + piconWidth + self.serviceBorderWidth + self.serviceNamePadding, r1.y + self.serviceBorderWidth), size=(r1.w - piconWidth - 2 * (self.serviceBorderWidth + self.serviceNamePadding), r1.h - 2 * self.serviceBorderWidth), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=service_name, color=serviceForeColor, color_sel=serviceForeColor, backcolor=None, backcolor_sel=None)) # Events for service if events: start = self.time_base + self.offs * self.time_epoch * 60 end = start + self.time_epoch * 60 left = r2.x top = r2.y width = r2.w height = r2.h now = time() for ev in events: #(event_id, event_title, begin_time, duration) stime = ev[2] duration = ev[3] if stime <= now and now < stime + duration: backColor = self.backColorNow foreColor = self.foreColorNow else: backColor = self.backColor foreColor = self.foreColor xpos, ewidth = self.calcEntryPosAndWidthHelper( stime, duration, start, end, width) # event box background res.append( MultiContentEntryText(pos=(left + xpos, top), size=(ewidth, height), font=1, flags=RT_HALIGN_CENTER | RT_VALIGN_CENTER, text="", color=None, color_sel=None, backcolor=backColor, backcolor_sel=self.backColorSelected, border_width=self.eventBorderWidth, border_color=self.borderColor)) # event text evX = left + xpos + self.eventBorderWidth + self.eventNamePadding evY = top + self.eventBorderWidth evW = ewidth - 2 * (self.eventBorderWidth + self.eventNamePadding) evH = height - 2 * self.eventBorderWidth if evW > 0: res.append( MultiContentEntryText( pos=(evX, evY), size=(evW, evH), font=1, flags=RT_HALIGN_CENTER | RT_VALIGN_CENTER | RT_WRAP, text=ev[1], color=foreColor, color_sel=self.foreColorSelected)) # recording icons rec = stime and self.timer.isInTimer(ev[0], stime, duration, service) if rec and ewidth > 23: res.append( MultiContentEntryPixmapAlphaTest( pos=(left + xpos + ewidth - 22, top + height - 22), size=(21, 21), png=self.getClockPixmap(service, stime, duration, ev[0]), backcolor=backColor, backcolor_sel=self.backColorSelected)) return res
def buildEntry(self, service, service_name, events, picon): r1 = self.service_rect r2 = self.event_rect if picon is None: # go find picon and cache its location picon = getPiconName(service) curIdx = self.l.getCurrentSelectionIndex() self.list[curIdx] = (service, service_name, events, picon) if self.currentlyPlaying is not None and self.currentlyPlaying.toString() == service: serviceForeColor = self.foreColorServiceSelected serviceBackColor = self.backColorServiceSelected else: serviceForeColor = self.foreColorService serviceBackColor = self.backColorService res = [ None ] # Picon and Service name res.append(MultiContentEntryText( pos = (r1.x, r1.y), size = (r1.w, r1.h), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER, text = "", color = serviceForeColor, color_sel = serviceForeColor, backcolor = serviceBackColor, backcolor_sel = serviceBackColor, border_width = self.serviceBorderWidth, border_color = self.borderColorService) ) if self.showPicon: if self.piconSize is not None: piconHeight = self.piconSize.h - 2 * self.serviceBorderWidth piconWidth = self.piconSize.w - 2 * self.serviceBorderWidth else: piconHeight = r1.h - 2 * self.serviceBorderWidth piconWidth = 2 * piconHeight # FIXME: could do better... if piconWidth > r1.w - 2 * self.serviceBorderWidth: piconWidth = r1.w - 2 * self.serviceBorderWidth if picon != "": self.picload.setPara((piconWidth, piconHeight, 1, 1, 1, 1, "#FFFFFFFF")) self.picload.startDecode(picon, piconWidth, piconHeight, False) displayPicon = self.picload.getData() if displayPicon is not None: res.append(MultiContentEntryPixmapAlphaTest( pos = (r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth), size = (piconWidth, piconHeight), png = displayPicon, backcolor = None, backcolor_sel = None) ) else: piconWidth = 0 if self.showServiceTitle or picon == "" or not self.showPicon: res.append(MultiContentEntryText( pos = (r1.x + piconWidth + self.serviceBorderWidth + self.serviceNamePadding, r1.y + self.serviceBorderWidth), size = (r1.w - piconWidth - 2 * (self.serviceBorderWidth + self.serviceNamePadding), r1.h - 2 * self.serviceBorderWidth), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER, text = service_name, color = serviceForeColor, color_sel = serviceForeColor, backcolor = None, backcolor_sel = None)) # Events for service if events: start = self.time_base + self.offs * self.time_epoch * 60 end = start + self.time_epoch * 60 left = r2.x top = r2.y width = r2.w height = r2.h now = time() for ev in events: #(event_id, event_title, begin_time, duration) stime = ev[2] duration = ev[3] if stime <= now and now < stime + duration: backColor = self.backColorNow foreColor = self.foreColorNow else: backColor = self.backColor foreColor = self.foreColor xpos, ewidth = self.calcEntryPosAndWidthHelper(stime, duration, start, end, width) # event box background res.append(MultiContentEntryText( pos = (left + xpos, top), size = (ewidth, height), font = 1, flags = RT_HALIGN_CENTER | RT_VALIGN_CENTER, text = "", color = None, color_sel = None, backcolor = backColor, backcolor_sel = self.backColorSelected, border_width = self.eventBorderWidth, border_color = self.borderColor)) # event text evX = left + xpos + self.eventBorderWidth + self.eventNamePadding evY = top + self.eventBorderWidth evW = ewidth - 2 * (self.eventBorderWidth + self.eventNamePadding) evH = height - 2 * self.eventBorderWidth if evW > 0: res.append(MultiContentEntryText( pos = (evX, evY), size = (evW, evH), font = 1, flags = RT_HALIGN_CENTER | RT_VALIGN_CENTER | RT_WRAP, text = ev[1], color = foreColor, color_sel = self.foreColorSelected)) # recording icons rec = stime and self.timer.isInTimer(ev[0], stime, duration, service) if rec and ewidth > 23: res.append(MultiContentEntryPixmapAlphaTest( pos = (left + xpos + ewidth - 22, top + height - 22), size = (21, 21), png = self.getClockPixmap(service, stime, duration, ev[0]), backcolor = backColor, backcolor_sel = self.backColorSelected)) return res
def buildMovieListEntry(self, serviceref, info, begin, data): switch = config.usage.show_icons_in_movielist.value ext = config.movielist.useextlist.value width = self.l.getItemSize().width() pathName = serviceref.getPath() res = [None] if ext != '0': ih = self.itemHeight // 2 else: ih = self.itemHeight if skin.getSkinFactor() == 1.5: listBeginX = 3 listEndX = 3 listMarginX = 12 pathIconSize = 29 dataIconSize = 25 progressIconSize = 25 progressBarSize = 72 textPosY = 2 else: listBeginX = 2 listEndX = 2 listMarginX = 8 pathIconSize = 25 dataIconSize = 21 progressIconSize = 21 progressBarSize = 48 textPosY = 1 textPosX = listBeginX + dataIconSize + listMarginX if serviceref.flags & eServiceReference.mustDescent: # Directory iconSize = pathIconSize iconPosX = listBeginX - 1 iconPosY = ih / 2 - iconSize / 2 if iconPosY < iconPosX: iconPosY = iconPosX # Name is full path name if info is None: # Special case: "parent" txt = ".." else: p = os.path.split(pathName) if not p[1]: # if path ends in '/', p is blank. p = os.path.split(p[0]) txt = p[1] if txt == ".Trash": dateSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), _("Trashcan")).width() res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=self.iconTrash)) res.append( MultiContentEntryText( pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=_("Deleted items"))) res.append( MultiContentEntryText( pos=(width - dateSize - listEndX, textPosY), size=(dateSize, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Trashcan"))) return res dateSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), _("Directory")).width() res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=self.iconFolder)) res.append( MultiContentEntryText(pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=txt)) res.append( MultiContentEntryText(pos=(width - dateSize - listEndX, textPosY), size=(dateSize, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Directory"))) return res if (data == -1) or (data is None): data = MovieListData() cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] # x = ref,info,begin,... data.len = 0 #dont recalc movielist to speedup loading the list self.list[cur_idx] = ( x[0], x[1], x[2], data ) #update entry in list... so next time we don't need to recalc data.txt = info.getName(serviceref) if config.movielist.hide_extensions.value: fileName, fileExtension = os.path.splitext(data.txt) if fileExtension in KNOWN_EXTENSIONS: data.txt = fileName data.icon = None data.part = None if os.path.split(pathName)[1] in self.runningTimers: if switch == 'i': if (self.playInBackground or self.playInForeground ) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlayRec else: data.icon = self.iconMovieRec elif switch == 'p' or switch == 's': data.part = 100 if (self.playInBackground or self.playInForeground ) and serviceref == (self.playInBackground or self.playInForeground): data.partcol = 0xffc71d else: data.partcol = 0xff001d elif (self.playInBackground or self.playInForeground) and serviceref == ( self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlay else: data.part = moviePlayState(pathName + '.cuts', serviceref, data.len) if switch == 'i': if data.part is not None and data.part > 0: data.icon = self.iconPart[data.part // 25] else: if config.usage.movielist_unseen.value: data.icon = self.iconUnwatched elif switch == 'p' or switch == 's': if data.part is not None and data.part > 0: data.partcol = 0xffc71d else: if config.usage.movielist_unseen.value: data.part = 100 data.partcol = 0x206333 len = data.len if len > 0: len = "%d:%02d" % (len // 60, len % 60) else: len = "" iconSize = 0 if switch == 'i': iconSize = dataIconSize iconPosX = listBeginX iconPosY = ih // 2 - iconSize // 2 if iconPosY < iconPosX: iconPosY = iconPosX res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=data.icon)) elif switch == 'p': if data.part is not None and data.part > 0: iconSize = progressBarSize iconPosX = listBeginX iconPosY = ih // 2 - iconSize // 8 if iconPosY < iconPosX: iconPosY = iconPosX res.append( MultiContentEntryProgress(pos=(iconPosX, iconPosY), size=(iconSize, iconSize // 4), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: iconSize = dataIconSize iconPosX = listBeginX iconPosY = ih // 2 - iconSize // 2 if iconPosY < iconPosX: iconPosY = iconPosX res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=data.icon)) elif switch == 's': iconSize = progressIconSize iconPosX = listBeginX iconPosY = ih // 2 - iconSize // 2 if iconPosY < iconPosX: iconPosY = iconPosX if data.part is not None and data.part > 0: res.append( MultiContentEntryProgress(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=data.icon)) begin_string = "" if begin > 0: begin_string = ', '.join(FuzzyTime(begin, inPast=True)) dateSize = serviceSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), begin_string).width() if iconSize: textPosX = listBeginX + iconSize + listMarginX else: textPosX = listBeginX if ext != '0': getrec = info.getName(serviceref) fileName, fileExtension = os.path.splitext(getrec) desc = None picon = None service = None try: serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(serviceref) desc = info.getInfoString( serviceref, iServiceInformation.sDescription) # get description ref = info.getInfoString( serviceref, iServiceInformation.sServiceref) # get reference service = ServiceReference( ref).getServiceName() # get service name serviceSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), service).width() except Exception as e: print(('[MovieList] load extended infos get failed: ', e)) if ext == '2': try: picon = getPiconName(ref) picon = loadPNG(picon) except Exception as e: print(('[MovieList] load picon get failed: ', e)) if fileExtension in RECORD_EXTENSIONS: if ext == '1': res.append( MultiContentEntryText( pos=(textPosX, 0), size=(width - textPosX - serviceSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append( MultiContentEntryText( pos=(width - serviceSize - listEndX, textPosY), size=(serviceSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=service)) if ext == '2': piconSize = ih * 1.667 res.append( MultiContentEntryText( pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append( MultiContentEntryPixmapAlphaBlend( pos=(width - piconSize - listEndX, listEndX), size=(piconSize, ih), png=picon, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO)) res.append( MultiContentEntryText(pos=(listBeginX, ih + textPosY), size=(width - listBeginX - dateSize - listMarginX - listEndX, ih), font=1, flags=RT_HALIGN_LEFT, text=desc)) res.append( MultiContentEntryText(pos=(width - dateSize - listEndX, ih + textPosY), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res else: res.append( MultiContentEntryText(pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append( MultiContentEntryText(pos=(width - dateSize - listEndX, ih), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res else: res.append( MultiContentEntryText(pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append( MultiContentEntryText(pos=(width - dateSize - listEndX, textPosY), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res
def fillpixmapList(self): for idx in range(0,self.numOfItems): self.pixmapList.append(LoadPixmap(getPiconName(self.currList[idx][0]))) return
def buildMovieListEntry(self, serviceref, info, begin, data): switch = config.usage.show_icons_in_movielist.value ext = config.movielist.useextlist.value width = self.l.getItemSize().width() pathName = serviceref.getPath() res = [None] if serviceref.flags & eServiceReference.mustDescent: if self.screenwidth and self.screenwidth == 1920: iconSize = 37 else: iconSize = 22 if info is None: txt = '..' else: p = os.path.split(pathName) if not p[1]: p = os.path.split(p[0]) txt = p[1] if txt == '.Trash': if self.screenwidth and self.screenwidth == 1920: res.append( MultiContentEntryPixmapAlphaBlend( pos=(3, 5), size=(iconSize, 37), png=self.iconTrash)) res.append( MultiContentEntryText(pos=(60, 5), size=(width - 166, self.itemHeight), font=0, flags=RT_HALIGN_LEFT, text=_('Deleted items'))) res.append( MultiContentEntryText(pos=(width - 145, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_('Trashcan'))) return res else: res.append( MultiContentEntryPixmapAlphaBlend( pos=(0, 2), size=(iconSize, 24), png=self.iconTrash)) res.append( MultiContentEntryText(pos=(iconSize + 10, 0), size=(width - 166, self.itemHeight), font=0, flags=RT_HALIGN_LEFT, text=_('Deleted items'))) res.append( MultiContentEntryText(pos=(width - 150, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_('Trashcan'))) return res if self.screenwidth and self.screenwidth == 1920: res.append( MultiContentEntryPixmapAlphaBlend(pos=(3, 5), size=(iconSize, iconSize), png=self.iconFolder)) res.append( MultiContentEntryText(pos=(60, 5), size=(width - 166, self.itemHeight), font=0, flags=RT_HALIGN_LEFT, text=txt)) res.append( MultiContentEntryText(pos=(width - 145, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_('Directory'))) return res else: res.append( MultiContentEntryPixmapAlphaBlend(pos=(0, 2), size=(iconSize, iconSize), png=self.iconFolder)) res.append( MultiContentEntryText(pos=(iconSize + 10, 0), size=(width - 166, self.itemHeight), font=0, flags=RT_HALIGN_LEFT, text=txt)) res.append( MultiContentEntryText(pos=(width - 150, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_('Directory'))) return res if data == -1 or data is None: data = MovieListData() cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] data.len = 0 self.list[cur_idx] = (x[0], x[1], x[2], data) data.txt = info.getName(serviceref) if config.movielist.hide_extensions.value: fileName, fileExtension = os.path.splitext(data.txt) if fileExtension in KNOWN_EXTENSIONS: data.txt = fileName data.icon = None data.part = None if os.path.split(pathName)[1] in self.runningTimers: if switch == 'i': if (self.playInBackground or self.playInForeground ) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlayRec else: data.icon = self.iconMovieRec elif switch == 'p' or switch == 's': data.part = 100 if (self.playInBackground or self.playInForeground ) and serviceref == (self.playInBackground or self.playInForeground): data.partcol = 16762653 else: data.partcol = 16711709 elif (self.playInBackground or self.playInForeground) and serviceref == ( self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlay else: data.part = moviePlayState(pathName + '.cuts', serviceref, data.len) if switch == 'i': if data.part is not None and data.part > 0: data.icon = self.iconPart[data.part // 25] elif config.usage.movielist_unseen.value: data.icon = self.iconUnwatched elif switch == 'p' or switch == 's': if data.part is not None and data.part > 0: data.partcol = 16762653 elif config.usage.movielist_unseen.value: data.part = 100 data.partcol = 2122547 len = data.len if len > 0: len = '%d:%02d' % (len / 60, len % 60) else: len = '' iconSize = 0 if switch == 'i': if self.screenwidth and self.screenwidth == 1920: iconSize = 42 res.append( MultiContentEntryPixmapAlphaBlend(pos=(2, 3), size=(iconSize, iconSize), png=data.icon)) else: iconSize = 22 res.append( MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, 20), png=data.icon)) elif switch == 'p': if self.screenwidth and self.screenwidth == 1920: iconSize = 42 else: iconSize = 48 if data.part is not None and data.part > 0: if self.screenwidth and self.screenwidth == 1920: res.append( MultiContentEntryProgress(pos=(0, 10), size=(iconSize + 5, 16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: res.append( MultiContentEntryProgress(pos=(0, 5), size=(iconSize - 2, 16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) elif self.screenwidth and self.screenwidth == 1920: res.append( MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, iconSize), png=data.icon)) else: res.append( MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, 20), png=data.icon)) elif switch == 's': if self.screenwidth and self.screenwidth == 1920: iconSize = 42 else: iconSize = 22 if data.part is not None and data.part > 0: if self.screenwidth and self.screenwidth == 1920: res.append( MultiContentEntryProgress(pos=(0, 10), size=(iconSize + 5, 16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: res.append( MultiContentEntryProgress(pos=(0, 5), size=(iconSize - 2, 16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) elif self.screenwidth and self.screenwidth == 1920: res.append( MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, iconSize), png=data.icon)) else: res.append( MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, 20), png=data.icon)) begin_string = '' if begin > 0: begin_string = ', '.join(FuzzyTime(begin, inPast=True)) if ext != '0': ih = self.itemHeight / 2 else: ih = self.itemHeight lenSize = ih * 3 dateSize = ih * 145 / 25 if ext != '0': getrec = info.getName(serviceref) fileName, fileExtension = os.path.splitext(getrec) desc = None picon = None service = None try: serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(serviceref) desc = info.getInfoString(serviceref, iServiceInformation.sDescription) ref = info.getInfoString(serviceref, iServiceInformation.sServiceref) service = ServiceReference(ref).getServiceName() except Exception as e: print('[MovieList] load extended infos get failed: ', e) if ext == '2': try: picon = getPiconName(ref) picon = loadPNG(picon) except Exception as e: print('[MovieList] load picon get failed: ', e) if fileExtension in RECORD_EXTENSIONS: if self.screenwidth and self.screenwidth == 1920: if ext == '1': res.append( MultiContentEntryText( pos=(iconSize + 20, 5), size=(width - iconSize - dateSize - dateSize / 2 - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append( MultiContentEntryText( pos=(width - dateSize - dateSize / 2 - 5, 1), size=(dateSize + dateSize / 2, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=service)) if ext == '2': piconSize = ih * 2 res.append( MultiContentEntryText(pos=(iconSize + 20, 5), size=(width - iconSize - dateSize - 15, ih + 2), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append( MultiContentEntryPixmapAlphaTest( pos=(width - 48 - 5, 1), size=(piconSize, ih - 2), png=picon, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO)) res.append( MultiContentEntryText(pos=(iconSize + 20, ih), size=(width - iconSize - dateSize - 15, ih), font=1, flags=RT_HALIGN_LEFT, text=desc)) res.append( MultiContentEntryText(pos=(width - dateSize, 0), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res else: if ext == '1': res.append( MultiContentEntryText( pos=(iconSize + 8, 0), size=(width - iconSize - dateSize - dateSize / 2 - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append( MultiContentEntryText( pos=(width - dateSize - dateSize / 2 - 5, 1), size=(dateSize + dateSize / 2, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=service)) if ext == '2': piconSize = ih * 2 res.append( MultiContentEntryText(pos=(iconSize + 8, 0), size=(width - iconSize - dateSize - 15, ih + 2), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append( MultiContentEntryPixmapAlphaTest( pos=(width - 48 - 5, 1), size=(piconSize, ih - 2), png=picon, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO)) res.append( MultiContentEntryText(pos=(iconSize + 8, ih), size=(width - iconSize - dateSize - 15, ih), font=1, flags=RT_HALIGN_LEFT, text=desc)) res.append( MultiContentEntryText(pos=(width - dateSize - 5, ih), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res elif self.screenwidth and self.screenwidth == 1920: res.append( MultiContentEntryText(pos=(iconSize + 20, 5), size=(width - iconSize - dateSize - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append( MultiContentEntryText(pos=(width - dateSize, ih), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res else: res.append( MultiContentEntryText(pos=(iconSize + 8, 0), size=(width - iconSize - dateSize - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append( MultiContentEntryText(pos=(width - dateSize - 5, ih), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res else: if self.screenwidth and self.screenwidth == 1920: res.append( MultiContentEntryText(pos=(iconSize + 20, 5), size=(width - iconSize - dateSize - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append( MultiContentEntryText(pos=(width - dateSize, 0), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res res.append( MultiContentEntryText(pos=(iconSize + 8, 0), size=(width - iconSize - dateSize - 15, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append( MultiContentEntryText(pos=(width - dateSize - 5, 0), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res return
def printLabels(self, hotkeys_force=False): self.bouquet_action = None bouquet_name = None self.action = '' hotkeys_priority = config.plugins.NumberZapExt.hotkeys_priority.value bouquets_priority = config.plugins.NumberZapExt.bouquets_priority.value or self.BouquetsPriority if hotkeys_priority or bouquets_priority: if bouquets_priority and not hotkeys_force: bouquet_name, self.bouquet_action = self.getHotkeyBouquets( int(self.field)) if self.bouquet_action is not None: name = _("%s" % (bouquet_name or '')) channel = _("Bouquet:") bouquet = bqname = "" service = None elif hotkeys_priority: self.action = self.getHotkeyAction(int(self.field)) if self.action: name = _(ACTIONLIST[self.action]['title']) channel = _("Action:") bouquet = bqname = "" service = None else: channel = _("Channel:") bouquet = _("Bouquet:") service, name, bqname = self.getNameFromNumber( int(self.field)) if name == 'N/A': name = _("invalid channel number") else: channel = _("Channel:") bouquet = _("Bouquet:") service, name, bqname = self.getNameFromNumber(int(self.field)) if name == 'N/A': if not service is None: name = _("service not found") else: name = _("invalid channel number") self.action = self.getHotkeyAction(int(self.field)) if self.action: name = _(ACTIONLIST[self.action]['title']) channel = _("Action:") bouquet = bqname = "" service = None else: channel = _("Channel:") bouquet = _("Bouquet:") service, name, bqname = self.getNameFromNumber(int(self.field)) if name == 'N/A': if not service is None: name = _("service not found") else: name = _("invalid channel number") bouquet_name, self.bouquet_action = self.getHotkeyBouquets( int(self.field)) if self.bouquet_action is not None: name = _("%s" % (bouquet_name or '')) channel = _("Bouquet:") bouquet = bqname = "" service = None else: self.action = self.getHotkeyAction(int(self.field)) if self.action: name = _(ACTIONLIST[self.action]['title']) channel = _("Action:") bouquet = bqname = "" service = None self["chNum"].setText(self.field) self["channel"].setText(channel) self["bouquet"].setText(bouquet) self["chName"].setText(name) self["chBouq"].setText(bqname) self.setTitle(str(self.field) + " " + name) if service and (name != _("service not found") or name != _("invalid channel number")): self.current_service = service else: self.current_service = None if config.plugins.NumberZapExt.picons.value: pngname = self.defpicon sname = "" if service: if getPiconsName: sname = getPiconName(service.toString()) else: refstr = service.toString() if refstr.startswith('1:134:'): refstr = GetWithAlternative(refstr) sname = ':'.join(refstr.split(':')[:11]) pos = sname.rfind(':') if pos != -1: sname = sname[:pos].rstrip(':').replace(':', '_') sname = config.plugins.NumberZapExt.picondir.value + sname + '.png' if sname and pathExists(sname): pngname = sname else: if not config.plugins.NumberZapExt.picons_show_default.value or not pngname: self["chPicon"].instance.setPixmap(None) return self["chPicon"].instance.setScale(1) self["chPicon"].instance.setPixmapFromFile(pngname) else: if config.plugins.NumberZapExt.picons_show_default.value and pngname: self["chPicon"].instance.setScale(1) self["chPicon"].instance.setPixmapFromFile(pngname) else: self["chPicon"].instance.setPixmap(None)
def buildMovieListEntry(self, serviceref, info, begin, data): switch = config.usage.show_icons_in_movielist.value ext = config.movielist.useextlist.value width = self.l.getItemSize().width() pathName = serviceref.getPath() res = [None] if serviceref.flags & eServiceReference.mustDescent: if self.screenwidth and self.screenwidth == 1920: iconSize = 37 else: iconSize = 22 if info is None: txt = '..' else: p = os.path.split(pathName) if not p[1]: p = os.path.split(p[0]) txt = p[1] if txt == '.Trash': if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryPixmapAlphaBlend(pos=(3, 5), size=(iconSize, 37), png=self.iconTrash)) res.append(MultiContentEntryText(pos=(60, 5), size=(width - 166, self.itemHeight), font=0, flags=RT_HALIGN_LEFT, text=_('Deleted items'))) res.append(MultiContentEntryText(pos=(width - 145, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_('Trashcan'))) return res else: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0, 2), size=(iconSize, 24), png=self.iconTrash)) res.append(MultiContentEntryText(pos=(iconSize + 10, 0), size=(width - 166, self.itemHeight), font=0, flags=RT_HALIGN_LEFT, text=_('Deleted items'))) res.append(MultiContentEntryText(pos=(width - 150, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_('Trashcan'))) return res if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryPixmapAlphaBlend(pos=(3, 5), size=(iconSize, iconSize), png=self.iconFolder)) res.append(MultiContentEntryText(pos=(60, 5), size=(width - 166, self.itemHeight), font=0, flags=RT_HALIGN_LEFT, text=txt)) res.append(MultiContentEntryText(pos=(width - 145, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_('Directory'))) return res else: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0, 2), size=(iconSize, iconSize), png=self.iconFolder)) res.append(MultiContentEntryText(pos=(iconSize + 10, 0), size=(width - 166, self.itemHeight), font=0, flags=RT_HALIGN_LEFT, text=txt)) res.append(MultiContentEntryText(pos=(width - 150, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_('Directory'))) return res if data == -1 or data is None: data = MovieListData() cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] data.len = 0 self.list[cur_idx] = (x[0], x[1], x[2], data) data.txt = info.getName(serviceref) if config.movielist.hide_extensions.value: fileName, fileExtension = os.path.splitext(data.txt) if fileExtension in KNOWN_EXTENSIONS: data.txt = fileName data.icon = None data.part = None if os.path.split(pathName)[1] in self.runningTimers: if switch == 'i': if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlayRec else: data.icon = self.iconMovieRec elif switch == 'p' or switch == 's': data.part = 100 if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.partcol = 16762653 else: data.partcol = 16711709 elif (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlay else: data.part = moviePlayState(pathName + '.cuts', serviceref, data.len) if switch == 'i': if data.part is not None and data.part > 0: data.icon = self.iconPart[data.part // 25] elif config.usage.movielist_unseen.value: data.icon = self.iconUnwatched elif switch == 'p' or switch == 's': if data.part is not None and data.part > 0: data.partcol = 16762653 elif config.usage.movielist_unseen.value: data.part = 100 data.partcol = 2122547 len = data.len if len > 0: len = '%d:%02d' % (len / 60, len % 60) else: len = '' iconSize = 0 if switch == 'i': if self.screenwidth and self.screenwidth == 1920: iconSize = 42 res.append(MultiContentEntryPixmapAlphaBlend(pos=(2, 3), size=(iconSize, iconSize), png=data.icon)) else: iconSize = 22 res.append(MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, 20), png=data.icon)) elif switch == 'p': if self.screenwidth and self.screenwidth == 1920: iconSize = 42 else: iconSize = 48 if data.part is not None and data.part > 0: if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryProgress(pos=(0, 10), size=(iconSize + 5, 16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: res.append(MultiContentEntryProgress(pos=(0, 5), size=(iconSize - 2, 16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) elif self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, iconSize), png=data.icon)) else: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, 20), png=data.icon)) elif switch == 's': if self.screenwidth and self.screenwidth == 1920: iconSize = 42 else: iconSize = 22 if data.part is not None and data.part > 0: if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryProgress(pos=(0, 10), size=(iconSize + 5, 16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: res.append(MultiContentEntryProgress(pos=(0, 5), size=(iconSize - 2, 16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) elif self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, iconSize), png=data.icon)) else: res.append(MultiContentEntryPixmapAlphaBlend(pos=(0, 1), size=(iconSize, 20), png=data.icon)) begin_string = '' if begin > 0: begin_string = ', '.join(FuzzyTime(begin, inPast=True)) if ext != '0': ih = self.itemHeight / 2 else: ih = self.itemHeight lenSize = ih * 3 dateSize = ih * 145 / 25 if ext != '0': getrec = info.getName(serviceref) fileName, fileExtension = os.path.splitext(getrec) desc = None picon = None service = None try: serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(serviceref) desc = info.getInfoString(serviceref, iServiceInformation.sDescription) ref = info.getInfoString(serviceref, iServiceInformation.sServiceref) service = ServiceReference(ref).getServiceName() except Exception as e: print ('[MovieList] load extended infos get failed: ', e) if ext == '2': try: picon = getPiconName(ref) picon = loadPNG(picon) except Exception as e: print ('[MovieList] load picon get failed: ', e) if fileExtension in RECORD_EXTENSIONS: if self.screenwidth and self.screenwidth == 1920: if ext == '1': res.append(MultiContentEntryText(pos=(iconSize + 20, 5), size=(width - iconSize - dateSize - dateSize / 2 - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append(MultiContentEntryText(pos=(width - dateSize - dateSize / 2 - 5, 1), size=(dateSize + dateSize / 2, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=service)) if ext == '2': piconSize = ih * 2 res.append(MultiContentEntryText(pos=(iconSize + 20, 5), size=(width - iconSize - dateSize - 15, ih + 2), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append(MultiContentEntryPixmapAlphaTest(pos=(width - 48 - 5, 1), size=(piconSize, ih - 2), png=picon, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO)) res.append(MultiContentEntryText(pos=(iconSize + 20, ih), size=(width - iconSize - dateSize - 15, ih), font=1, flags=RT_HALIGN_LEFT, text=desc)) res.append(MultiContentEntryText(pos=(width - dateSize, 0), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res else: if ext == '1': res.append(MultiContentEntryText(pos=(iconSize + 8, 0), size=(width - iconSize - dateSize - dateSize / 2 - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append(MultiContentEntryText(pos=(width - dateSize - dateSize / 2 - 5, 1), size=(dateSize + dateSize / 2, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=service)) if ext == '2': piconSize = ih * 2 res.append(MultiContentEntryText(pos=(iconSize + 8, 0), size=(width - iconSize - dateSize - 15, ih + 2), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append(MultiContentEntryPixmapAlphaTest(pos=(width - 48 - 5, 1), size=(piconSize, ih - 2), png=picon, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO)) res.append(MultiContentEntryText(pos=(iconSize + 8, ih), size=(width - iconSize - dateSize - 15, ih), font=1, flags=RT_HALIGN_LEFT, text=desc)) res.append(MultiContentEntryText(pos=(width - dateSize - 5, ih), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res elif self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryText(pos=(iconSize + 20, 5), size=(width - iconSize - dateSize - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append(MultiContentEntryText(pos=(width - dateSize, ih), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res else: res.append(MultiContentEntryText(pos=(iconSize + 8, 0), size=(width - iconSize - dateSize - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append(MultiContentEntryText(pos=(width - dateSize - 5, ih), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res else: if self.screenwidth and self.screenwidth == 1920: res.append(MultiContentEntryText(pos=(iconSize + 20, 5), size=(width - iconSize - dateSize - 15, ih), font=0, flags=RT_HALIGN_LEFT, text=data.txt)) res.append(MultiContentEntryText(pos=(width - dateSize, 0), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res res.append(MultiContentEntryText(pos=(iconSize + 8, 0), size=(width - iconSize - dateSize - 15, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append(MultiContentEntryText(pos=(width - dateSize - 5, 0), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res return
def printLabels(self, hotkeys_force=False): self.bouquet_action = None bouquet_name = None self.action = '' hotkeys_priority = config.plugins.NumberZapExt.hotkeys_priority.value bouquets_priority = config.plugins.NumberZapExt.bouquets_priority.value or self.BouquetsPriority if hotkeys_priority or bouquets_priority: if bouquets_priority and not hotkeys_force: bouquet_name, self.bouquet_action = self.getHotkeyBouquets(int(self.field)) if self.bouquet_action is not None: name = _("%s" % (bouquet_name or '')) channel = _("Bouquet:") bouquet = bqname = "" service = None elif hotkeys_priority: self.action = self.getHotkeyAction(int(self.field)) if self.action: name = _(ACTIONLIST[self.action]['title']) channel = _("Action:") bouquet = bqname = "" service = None else: channel = _("Channel:") bouquet = _("Bouquet:") service, name, bqname = self.getNameFromNumber(int(self.field)) if name == 'N/A': name = _("invalid channel number") else: channel = _("Channel:") bouquet = _("Bouquet:") service, name, bqname = self.getNameFromNumber(int(self.field)) if name == 'N/A': if not service is None: name = _("service not found") else: name = _("invalid channel number") self.action = self.getHotkeyAction(int(self.field)) if self.action: name = _(ACTIONLIST[self.action]['title']) channel = _("Action:") bouquet = bqname = "" service = None else: channel = _("Channel:") bouquet = _("Bouquet:") service, name, bqname = self.getNameFromNumber(int(self.field)) if name == 'N/A': if not service is None: name = _("service not found") else: name = _("invalid channel number") bouquet_name, self.bouquet_action = self.getHotkeyBouquets(int(self.field)) if self.bouquet_action is not None: name = _("%s" % (bouquet_name or '')) channel = _("Bouquet:") bouquet = bqname = "" service = None else: self.action = self.getHotkeyAction(int(self.field)) if self.action: name = _(ACTIONLIST[self.action]['title']) channel = _("Action:") bouquet = bqname = "" service = None self["chNum"].setText(self.field) self["channel"].setText(channel) self["bouquet"].setText(bouquet) self["chName"].setText(name) self["chBouq"].setText(bqname) self.setTitle(str(self.field) + " " + name) if service and (name != _("service not found") or name != _("invalid channel number")): self.current_service = service else: self.current_service = None if config.plugins.NumberZapExt.picons.value: pngname = self.defpicon sname = "" if service: if getPiconsName: sname = getPiconName(service.toString()) else: refstr = service.toString() if refstr.startswith('1:134:'): refstr = GetWithAlternative(refstr) sname = ':'.join(refstr.split(':')[:11]) pos = sname.rfind(':') if pos != -1: sname = sname[:pos].rstrip(':').replace(':','_') sname = config.plugins.NumberZapExt.picondir.value + sname + '.png' if sname and pathExists(sname): pngname = sname else: if not config.plugins.NumberZapExt.picons_show_default.value or not pngname: self["chPicon"].instance.setPixmap(None) return self["chPicon"].instance.setScale(1) self["chPicon"].instance.setPixmapFromFile(pngname) else: if config.plugins.NumberZapExt.picons_show_default.value and pngname: self["chPicon"].instance.setScale(1) self["chPicon"].instance.setPixmapFromFile(pngname) else: self["chPicon"].instance.setPixmap(None)
def buildEntry(self, service, service_name, events, picon): r1 = self.service_rect r2 = self.event_rect selected = self.cur_service[0] == service # Picon and Service name if CompareWithAlternatives(service, self.currentlyPlaying and self.currentlyPlaying.toString()): serviceForeColor = self.foreColorServiceSelected serviceBackColor = self.backColorServiceSelected bgpng = self.curSerPix or self.nowEvPix currentservice = True else: serviceForeColor = self.foreColorService serviceBackColor = self.backColorService bgpng = self.othEvPix currentservice = False res = [ None ] if bgpng is not None: # bacground for service rect res.append(MultiContentEntryPixmapAlphaTest( pos = (r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth), size = (r1.w - 2 * self.serviceBorderWidth, r1.h - 2 * self.serviceBorderWidth), png = bgpng, flags = BT_SCALE)) else: res.append(MultiContentEntryText( pos = (r1.x, r1.y), size = (r1.w, r1.h), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER, text = "", color = serviceForeColor, color_sel = serviceForeColor, backcolor = serviceBackColor, backcolor_sel = serviceBackColor)) displayPicon = None if self.showPicon: if picon is None: # go find picon and cache its location picon = getPiconName(service) curIdx = self.l.getCurrentSelectionIndex() self.list[curIdx] = (service, service_name, events, picon) piconWidth = self.picon_size.width() piconHeight = self.picon_size.height() if picon != "": displayPicon = loadPNG(picon) if displayPicon is not None: res.append(MultiContentEntryPixmapAlphaTest( pos = (r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth), size = (piconWidth, piconHeight), png = displayPicon, backcolor = None, backcolor_sel = None, flags = BT_SCALE | BT_KEEP_ASPECT_RATIO)) elif not self.showServiceTitle: # no picon so show servicename anyway in picon space namefont = 1 namefontflag = int(config.misc.graph_mepg.servicename_alignment.value) namewidth = piconWidth piconWidth = 0 else: piconWidth = 0 if self.showServiceTitle: # we have more space so reset parms namefont = 0 namefontflag = int(config.misc.graph_mepg.servicename_alignment.value) namewidth = r1.w - piconWidth if self.showServiceTitle or displayPicon is None: res.append(MultiContentEntryText( pos = (r1.x + piconWidth + self.serviceBorderWidth + self.serviceNamePadding, r1.y + self.serviceBorderWidth), size = (namewidth - 2 * (self.serviceBorderWidth + self.serviceNamePadding), r1.h - 2 * self.serviceBorderWidth), font = namefont, flags = namefontflag, text = service_name, color = serviceForeColor, color_sel = serviceForeColor, backcolor = None, backcolor_sel = None)) # Events for service backColorSel = self.backColorSelected if events: start = self.time_base + self.offs * self.time_epoch * 60 end = start + self.time_epoch * 60 left = r2.x top = r2.y width = r2.w height = r2.h now = time() for ev in events: #(event_id, event_title, begin_time, duration) stime = ev[2] duration = ev[3] xpos, ewidth = self.calcEntryPosAndWidthHelper(stime, duration, start, end, width) rec = self.timer.isInTimer(ev[0], stime, duration, service) # event box background foreColorSelected = foreColor = self.foreColor if stime <= now and now < stime + duration: backColor = self.backColorNow if isPlayableForCur(ServiceReference(service).ref): foreColor = self.foreColorNow foreColorSelected = self.foreColorSelected else: backColor = self.backColor if selected and self.select_rect.x == xpos + left and self.selEvPix: bgpng = self.selEvPix backColorSel = None elif rec is not None and rec[1][-1] in (2, 12): bgpng = self.recEvPix foreColor = self.foreColorRec backColor = self.backColorRec elif stime <= now and now < stime + duration: bgpng = self.nowEvPix elif currentservice: bgpng = self.curSerPix or self.othEvPix backColor = self.backColorServiceSelected else: bgpng = self.othEvPix if bgpng is not None: res.append(MultiContentEntryPixmapAlphaTest( pos = (left + xpos + self.eventBorderWidth, top + self.eventBorderWidth), size = (ewidth - 2 * self.eventBorderWidth, height - 2 * self.eventBorderWidth), png = bgpng, flags = BT_SCALE)) else: res.append(MultiContentEntryText( pos = (left + xpos, top), size = (ewidth, height), font = 1, flags = int(config.misc.graph_mepg.event_alignment.value), text = "", color = None, color_sel = None, backcolor = backColor, backcolor_sel = backColorSel)) # event text evX = left + xpos + self.eventBorderWidth + self.eventNamePadding evY = top + self.eventBorderWidth evW = ewidth - 2 * (self.eventBorderWidth + self.eventNamePadding) evH = height - 2 * self.eventBorderWidth if evW > 0: res.append(MultiContentEntryText( pos = (evX, evY), size = (evW, evH), font = 1, flags = int(config.misc.graph_mepg.event_alignment.value), text = ev[1], color = foreColor, color_sel = foreColorSelected)) # recording icons if rec is not None: for i in range(len(rec[1])): if ewidth < (i + 1) * 22: break res.append(MultiContentEntryPixmapAlphaTest( pos = (left + xpos + ewidth - (i + 1) * 22, top + height - 22), size = (21, 21), png = self.clocks[rec[1][len(rec[1]) - 1 - i]])) else: if selected and self.selEvPix: res.append(MultiContentEntryPixmapAlphaTest( pos = (r2.x + self.eventBorderWidth, r2.y + self.eventBorderWidth), size = (r2.w - 2 * self.eventBorderWidth, r2.h - 2 * self.eventBorderWidth), png = self.selEvPix, flags = BT_SCALE)) return res
def buildEntry(self, service, service_name, events, picon): r1 = self.service_rect r2 = self.event_rect selected = self.cur_service[0] == service # Picon and Service name if CompareWithAlternatives(service, self.currentlyPlaying and self.currentlyPlaying.toString()): serviceForeColor = self.foreColorServiceSelected serviceBackColor = self.backColorServiceSelected bgpng = self.nowEvPix else: serviceForeColor = self.foreColorService serviceBackColor = self.backColorService bgpng = self.othEvPix res = [ None ] if bgpng is not None: # bacground for service rect res.append(MultiContentEntryPixmapAlphaTest( pos = (r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth), size = (r1.w - 2 * self.serviceBorderWidth, r1.h - 2 * self.serviceBorderWidth), png = bgpng)) else: res.append(MultiContentEntryText( pos = (r1.x, r1.y), size = (r1.w, r1.h), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER, text = "", color = serviceForeColor, color_sel = serviceForeColor, backcolor = serviceBackColor, backcolor_sel = serviceBackColor, border_width = self.serviceBorderWidth, border_color = self.borderColorService) ) displayPicon = None if self.showPicon: if picon is None: # go find picon and cache its location picon = getPiconName(service) curIdx = self.l.getCurrentSelectionIndex() self.list[curIdx] = (service, service_name, events, picon) piconWidth = self.picon_size.width() piconHeight = self.picon_size.height() if picon != "": self.picload.setPara((piconWidth, piconHeight, 1, 1, 1, 1, "#FFFFFFFF")) self.picload.startDecode(picon, 0, 0, False) displayPicon = self.picload.getData() if displayPicon is not None: res.append(MultiContentEntryPixmapAlphaTest( pos = (r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth), size = (piconWidth, piconHeight), png = displayPicon, backcolor = None, backcolor_sel = None) ) elif not self.showServiceTitle: # no picon so show servicename anyway in picon space namefont = 1 namefontflag = RT_HALIGN_LEFT | RT_VALIGN_CENTER | RT_WRAP namewidth = piconWidth piconWidth = 0 else: piconWidth = 0 if self.showServiceTitle: # we have more space so reset parms namefont = 0 namefontflag = RT_HALIGN_LEFT | RT_VALIGN_CENTER namewidth = r1.w - piconWidth if self.showServiceTitle or displayPicon is None: res.append(MultiContentEntryText( pos = (r1.x + piconWidth + self.serviceBorderWidth + self.serviceNamePadding, r1.y + self.serviceBorderWidth), size = (namewidth - 2 * (self.serviceBorderWidth + self.serviceNamePadding), r1.h - 2 * self.serviceBorderWidth), font = namefont, flags = namefontflag, text = service_name, color = serviceForeColor, color_sel = serviceForeColor, backcolor = None, backcolor_sel = None)) # Events for service backColorSel = self.backColorSelected if events: start = self.time_base + self.offs * self.time_epoch * 60 end = start + self.time_epoch * 60 left = r2.x top = r2.y width = r2.w height = r2.h now = time() for ev in events: #(event_id, event_title, begin_time, duration) stime = ev[2] duration = ev[3] xpos, ewidth = self.calcEntryPosAndWidthHelper(stime, duration, start, end, width) # event box background if stime <= now and now < stime + duration: backColor = self.backColorNow foreColor = self.foreColorNow else: backColor = self.backColor foreColor = self.foreColor if selected and self.select_rect.x == xpos + left and self.selEvPix: bgpng = self.selEvPix backColorSel = None elif stime <= now and now < stime + duration: bgpng = self.nowEvPix else: bgpng = self.othEvPix if bgpng is not None: res.append(MultiContentEntryPixmapAlphaTest( pos = (left + xpos + self.eventBorderWidth, top + self.eventBorderWidth), size = (ewidth - 2 * self.eventBorderWidth, height - 2 * self.eventBorderWidth), png = bgpng)) else: res.append(MultiContentEntryText( pos = (left + xpos, top), size = (ewidth, height), font = 1, flags = RT_HALIGN_CENTER | RT_VALIGN_CENTER, text = "", color = None, color_sel = None, backcolor = backColor, backcolor_sel = backColorSel, border_width = self.eventBorderWidth, border_color = self.borderColor)) # event text evX = left + xpos + self.eventBorderWidth + self.eventNamePadding evY = top + self.eventBorderWidth evW = ewidth - 2 * (self.eventBorderWidth + self.eventNamePadding) evH = height - 2 * self.eventBorderWidth if evW > 0: res.append(MultiContentEntryText( pos = (evX, evY), size = (evW, evH), font = 1, flags = RT_HALIGN_CENTER | RT_VALIGN_CENTER | RT_WRAP, text = ev[1], color = foreColor, color_sel = self.foreColorSelected, backcolor_sel = backColorSel)) # recording icons rec = stime and self.timer.isInTimer(ev[0], stime, duration, service) if rec and ewidth > 23: res.append(MultiContentEntryPixmapAlphaTest( pos = (left + xpos + ewidth - 22, top + height - 22), size = (21, 21), png = self.getClockPixmap(service, stime, duration, ev[0])) ) return res
def buildEntry(self, service, service_name, events, picon): r1 = self.service_rect r2 = self.event_rect selected = self.cur_service[0] == service # Picon and Service name if CompareWithAlternatives(service, self.currentlyPlaying and self.currentlyPlaying.toString()): serviceForeColor = self.foreColorServiceSelected serviceBackColor = self.backColorServiceSelected bgpng = self.curSerPix or self.nowEvPix currentservice = True else: serviceForeColor = self.foreColorService serviceBackColor = self.backColorService bgpng = self.othEvPix currentservice = False res = [ None ] if bgpng is not None: # bacground for service rect res.append(MultiContentEntryPixmapAlphaTest( pos = (r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth), size = (r1.w - 2 * self.serviceBorderWidth, r1.h - 2 * self.serviceBorderWidth), png = bgpng, flags = BT_SCALE)) else: res.append(MultiContentEntryText( pos = (r1.x, r1.y), size = (r1.w, r1.h), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER, text = "", color = serviceForeColor, color_sel = serviceForeColor, backcolor = serviceBackColor, backcolor_sel = serviceBackColor)) displayPicon = None if self.showPicon: if picon is None: # go find picon and cache its location picon = getPiconName(service) curIdx = self.l.getCurrentSelectionIndex() self.list[curIdx] = (service, service_name, events, picon) piconWidth = self.picon_size.width() piconHeight = self.picon_size.height() if picon != "": displayPicon = loadPNG(picon) if displayPicon is not None: res.append(MultiContentEntryPixmapAlphaTest( pos = (r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth), size = (piconWidth, piconHeight), png = displayPicon, backcolor = None, backcolor_sel = None, flags = BT_SCALE | BT_KEEP_ASPECT_RATIO)) elif not self.showServiceTitle: # no picon so show servicename anyway in picon space namefont = 1 namefontflag = int(config.misc.graph_mepg.servicename_alignment.value) namewidth = piconWidth piconWidth = 0 else: piconWidth = 0 if self.showServiceTitle: # we have more space so reset parms namefont = 0 namefontflag = int(config.misc.graph_mepg.servicename_alignment.value) namewidth = r1.w - piconWidth if self.showServiceTitle or displayPicon is None: res.append(MultiContentEntryText( pos = (r1.x + piconWidth + self.serviceBorderWidth + self.serviceNamePadding, r1.y + self.serviceBorderWidth), size = (namewidth - 2 * (self.serviceBorderWidth + self.serviceNamePadding), r1.h - 2 * self.serviceBorderWidth), font = namefont, flags = namefontflag, text = service_name, color = serviceForeColor, color_sel = serviceForeColor, backcolor = None, backcolor_sel = None)) # Events for service backColorSel = self.backColorSelected if events: start = self.time_base + self.offs * self.time_epoch * 60 end = start + self.time_epoch * 60 left = r2.x top = r2.y width = r2.w height = r2.h now = time() for ev in events: #(event_id, event_title, begin_time, duration) stime = ev[2] duration = ev[3] xpos, ewidth = self.calcEntryPosAndWidthHelper(stime, duration, start, end, width) rec = self.timer.isInTimer(ev[0], stime, duration, service) # event box background foreColorSelected = foreColor = self.foreColor if stime <= now and now < stime + duration: backColor = self.backColorNow if isPlayableForCur(ServiceReference(service).ref): foreColor = self.foreColorNow foreColorSelected = self.foreColorSelected else: backColor = self.backColor if selected and self.select_rect.x == xpos + left and self.selEvPix: bgpng = self.selEvPix backColorSel = None elif rec is not None and rec[1][-1] in (2, 12): bgpng = self.recEvPix foreColor = self.foreColorRec backColor = self.backColorRec elif stime <= now and now < stime + duration: bgpng = self.nowEvPix elif currentservice: bgpng = self.curSerPix or self.othEvPix backColor = self.backColorServiceSelected else: bgpng = self.othEvPix if bgpng is not None: res.append(MultiContentEntryPixmapAlphaTest( pos = (left + xpos + self.eventBorderWidth, top + self.eventBorderWidth), size = (ewidth - 2 * self.eventBorderWidth, height - 2 * self.eventBorderWidth), png = bgpng, flags = BT_SCALE)) else: res.append(MultiContentEntryText( pos = (left + xpos, top), size = (ewidth, height), font = 1, flags = int(config.misc.graph_mepg.event_alignment.value), text = "", color = None, color_sel = None, backcolor = backColor, backcolor_sel = backColorSel)) # event text evX = left + xpos + self.eventBorderWidth + self.eventNamePadding evY = top + self.eventBorderWidth evW = ewidth - 2 * (self.eventBorderWidth + self.eventNamePadding) evH = height - 2 * self.eventBorderWidth if evW > 0: res.append(MultiContentEntryText( pos = (evX, evY), size = (evW, evH), font = 1, flags = int(config.misc.graph_mepg.event_alignment.value), text = ev[1], color = foreColor, color_sel = foreColorSelected)) # recording icons if rec is not None: for i in list(range(len(rec[1]))): if ewidth < (i + 1) * 22: break res.append(MultiContentEntryPixmapAlphaTest( pos = (left + xpos + ewidth - (i + 1) * 22, top + height - 22), size = (21, 21), png = self.clocks[rec[1][len(rec[1]) - 1 - i]])) else: if selected and self.selEvPix: res.append(MultiContentEntryPixmapAlphaTest( pos = (r2.x + self.eventBorderWidth, r2.y + self.eventBorderWidth), size = (r2.w - 2 * self.eventBorderWidth, r2.h - 2 * self.eventBorderWidth), png = self.selEvPix, flags = BT_SCALE)) return res
def buildMovieListEntry(self, serviceref, info, begin, data): showPicons = "picon" in config.usage.movielist_servicename_mode.value switch = config.usage.show_icons_in_movielist.value piconWidth = config.usage.movielist_piconwidth.value if showPicons else 0 durationWidth = self.durationWidth if config.usage.load_length_of_movies_in_moviellist.value else 0 width = self.l.getItemSize().width() dateWidth = self.dateWidth if not config.movielist.use_fuzzy_dates.value: dateWidth += 30 iconSize = self.iconsWidth if switch == 'p': iconSize = self.pbarLargeWidth ih = self.itemHeight col0iconSize = piconWidth if showPicons else iconSize space = self.spaceIconeText r = self.spaceRight pathName = serviceref.getPath() res = [None] if serviceref.flags & eServiceReference.mustDescent: # Directory # Name is full path name if info is None: # Special case: "parent" txt = ".." else: p = os.path.split(pathName) if not p[1]: # if path ends in '/', p is blank. p = os.path.split(p[0]) txt = p[1] if txt == ".Trash": res.append( MultiContentEntryPixmapAlphaTest( pos=((col0iconSize - self.iconTrash.size().width()) / 2, (self.itemHeight - self.iconFolder.size().height()) / 2), size=(iconSize, self.iconTrash.size().height()), png=self.iconTrash)) res.append( MultiContentEntryText( pos=(col0iconSize + space, 0), size=(width - 145, self.itemHeight), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=_("Deleted items"))) res.append( MultiContentEntryText(pos=(width - 185 - r, 0), size=(185, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Trash can"))) return res if not config.movielist.show_underlines.value: txt = txt.replace('_', ' ').strip() res.append( MultiContentEntryPixmapAlphaTest( pos=((col0iconSize - self.iconFolder.size().width()) / 2, (self.itemHeight - self.iconFolder.size().height()) / 2), size=(iconSize, iconSize), png=self.iconFolder)) res.append( MultiContentEntryText(pos=(col0iconSize + space, 0), size=(width - 145, self.itemHeight), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=txt)) res.append( MultiContentEntryText(pos=(width - 145 - r, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Directory"))) return res if data == -1 or data is None: data = MovieListData() cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] # x = ref,info,begin,... if config.usage.load_length_of_movies_in_moviellist.value: data.len = x[1].getLength(x[0]) #recalc the movie length... else: data.len = 0 #dont recalc movielist to speedup loading the list self.list[cur_idx] = ( x[0], x[1], x[2], data ) #update entry in list... so next time we don't need to recalc if config.movielist.show_underlines.value: data.txt = info.getName(serviceref) else: data.txt = info.getName(serviceref).replace('_', ' ').strip() if config.movielist.hide_extensions.value: fileName, fileExtension = os.path.splitext(data.txt) if fileExtension in KNOWN_EXTENSIONS: data.txt = fileName data.icon = None data.part = None if os.path.split(pathName)[1] in self.runningTimers: if switch == 'i': if (self.playInBackground or self.playInForeground ) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlayRec else: data.icon = self.iconMovieRec elif switch in ('p', 's'): data.part = 100 if (self.playInBackground or self.playInForeground ) and serviceref == (self.playInBackground or self.playInForeground): data.partcol = self.pbarColourSeen else: data.partcol = self.pbarColourRec elif (self.playInBackground or self.playInForeground) and serviceref == ( self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlay elif pathName.endswith( ".tmpcut.ts" ): # cutting with moviecut plugin to same filename data.icon = self.iconCutting else: data.part = moviePlayState(pathName + '.cuts', serviceref, data.len) if switch == 'i': if data.part is not None and data.part > 0: data.icon = self.iconPart[data.part // 25] else: if config.usage.movielist_unseen.value: data.icon = self.iconUnwatched elif switch in ('p', 's'): if data.part is not None and data.part > 0: data.partcol = self.pbarColourSeen else: if config.usage.movielist_unseen.value: data.part = 100 data.partcol = self.pbarColour colX = 0 if switch == 'p': iconSize = self.pbarLargeWidth ih = self.itemHeight def addProgress(): # icon/progress if data: if switch == 'i' and hasattr(data, 'icon') and data.icon is not None: res.append( MultiContentEntryPixmapAlphaTest( pos=(colX, self.partIconeShift), size=(iconSize, data.icon.size().height()), png=data.icon)) elif switch in ('p', 's'): if hasattr(data, 'part') and data.part > 0: res.append( MultiContentEntryProgress(pos=(colX, self.pbarShift), size=(iconSize, self.pbarHeight), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) elif hasattr(data, 'icon') and data.icon is not None: res.append( MultiContentEntryPixmapAlphaTest( pos=(colX, self.pbarShift), size=(iconSize, self.pbarHeight), png=data.icon)) return iconSize serviceref = info.getInfoString(serviceref, iServiceInformation.sServiceref) displayPicon = None if piconWidth > 0: # Picon picon = getPiconName(serviceref) if picon != "": displayPicon = loadPNG(picon) if displayPicon is not None: res.append( MultiContentEntryPixmapAlphaTest( pos=(colX, 0), size=(piconWidth, ih), png=displayPicon, backcolor=None, backcolor_sel=None, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO | BT_HALIGN_CENTER | BT_VALIGN_CENTER)) colX = piconWidth else: colX = addProgress() # Recording name res.append( MultiContentEntryText(pos=(colX, 0), size=(width - iconSize - space - durationWidth - dateWidth - r - colX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) colX = width - iconSize - space - durationWidth - dateWidth - r if piconWidth > 0: colX = addProgress() # Duration Mins if durationWidth > 0: if data: len = data.len if len > 0: len = ngettext("%d Min", "%d Mins", (len / 60)) % (len / 60) res.append( MultiContentEntryText(pos=(colX + 880, 2), size=(durationWidth, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=len)) # Date begin_string = "" if begin > 0: if config.movielist.use_fuzzy_dates.value: begin_string = ', '.join(FuzzyTime(begin, inPast=True)) else: begin_string = strftime( "%s, %s" % (config.usage.date.daylong.value, config.usage.time.short.value), localtime(begin)) res.append( MultiContentEntryText(pos=(width - dateWidth - r - 130, 2), size=(dateWidth + 130, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res
def buildMovieListEntry(self, serviceref, info, begin, data): showPicons = "picon" in config.usage.movielist_servicename_mode.value switch = config.usage.show_icons_in_movielist.value piconWidth = config.usage.movielist_piconwidth.value if showPicons else 0 durationWidth = self.durationWidth if config.usage.load_length_of_movies_in_moviellist.value else 0 width = self.l.getItemSize().width() dateWidth = self.dateWidth if not config.movielist.use_fuzzy_dates.value: dateWidth += 30 iconSize = self.iconsWidth if switch == 'p': iconSize = self.pbarLargeWidth ih = self.itemHeight col0iconSize = piconWidth if showPicons else iconSize space = self.spaceIconeText r = self.spaceRight pathName = serviceref.getPath() res = [ None ] if serviceref.flags & eServiceReference.mustDescent: # Directory # Name is full path name if info is None: # Special case: "parent" txt = ".." else: p = os.path.split(pathName) if not p[1]: # if path ends in '/', p is blank. p = os.path.split(p[0]) txt = p[1] if txt == ".Trash": res.append(MultiContentEntryPixmapAlphaBlend(pos=((col0iconSize-self.iconTrash.size().width())/2,(self.itemHeight-self.iconFolder.size().height())/2), size=(iconSize,self.iconTrash.size().height()), png=self.iconTrash)) res.append(MultiContentEntryText(pos=(col0iconSize + space, 0), size=(width-145, self.itemHeight), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = _("Deleted items"))) res.append(MultiContentEntryText(pos=(width-145-r, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Trash can"))) return res res.append(MultiContentEntryPixmapAlphaBlend(pos=((col0iconSize-self.iconFolder.size().width())/2,(self.itemHeight-self.iconFolder.size().height())/2), size=(iconSize,iconSize), png=self.iconFolder)) res.append(MultiContentEntryText(pos=(col0iconSize + space, 0), size=(width-145, self.itemHeight), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = txt)) res.append(MultiContentEntryText(pos=(width-145-r, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Directory"))) return res if data == -1 or data is None: data = MovieListData() cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] # x = ref,info,begin,... if config.usage.load_length_of_movies_in_moviellist.value: data.len = x[1].getLength(x[0]) #recalc the movie length... else: data.len = 0 #dont recalc movielist to speedup loading the list self.list[cur_idx] = (x[0], x[1], x[2], data) #update entry in list... so next time we don't need to recalc data.txt = info.getName(serviceref) if config.movielist.hide_extensions.value: fileName, fileExtension = os.path.splitext(data.txt) if fileExtension in KNOWN_EXTENSIONS: data.txt = fileName data.icon = None data.part = None if os.path.split(pathName)[1] in self.runningTimers: if switch == 'i': if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlayRec else: data.icon = self.iconMovieRec elif switch in ('p', 's'): data.part = 100 if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.partcol = self.pbarColourSeen else: data.partcol = self.pbarColourRec elif (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlay else: data.part = moviePlayState(pathName + '.cuts', serviceref, data.len) if switch == 'i': if data.part is not None and data.part > 0: data.icon = self.iconPart[data.part // 25] else: if config.usage.movielist_unseen.value: data.icon = self.iconUnwatched elif switch in ('p', 's'): if data.part is not None and data.part > 0: data.partcol = self.pbarColourSeen else: if config.usage.movielist_unseen.value: data.part = 100 data.partcol = self.pbarColour colX = 0 if switch == 'p': iconSize = self.pbarLargeWidth ih = self.itemHeight def addProgress(): # icon/progress if data: if switch == 'i' and hasattr(data, 'icon') and data.icon is not None: res.append(MultiContentEntryPixmapAlphaBlend(pos=(colX,self.partIconeShift), size=(iconSize,data.icon.size().height()), png=data.icon)) elif switch in ('p', 's'): if hasattr(data, 'part') and data.part > 0: res.append(MultiContentEntryProgress(pos=(colX,self.pbarShift), size=(iconSize, self.pbarHeight), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) elif hasattr(data, 'icon') and data.icon is not None: res.append(MultiContentEntryPixmapAlphaBlend(pos=(colX,self.pbarShift), size=(iconSize, self.pbarHeight), png=data.icon)) return iconSize serviceref = info.getInfoString(serviceref, iServiceInformation.sServiceref) displayPicon = None if piconWidth > 0: # Picon picon = getPiconName(serviceref) if picon != "": displayPicon = loadPNG(picon) if displayPicon is not None: res.append(MultiContentEntryPixmapAlphaBlend( pos = (colX, 0), size = (piconWidth, ih), png = displayPicon, backcolor = None, backcolor_sel = None, flags = BT_SCALE | BT_KEEP_ASPECT_RATIO | BT_HALIGN_CENTER | BT_VALIGN_CENTER)) colX += piconWidth + space else: colX += addProgress() + space # Recording name res.append(MultiContentEntryText(pos=(colX, 0), size=(width-iconSize-space-durationWidth-dateWidth-r-colX, ih), font = 0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = data.txt)) colX = width-iconSize-space-durationWidth-dateWidth-r if piconWidth > 0: colX += addProgress() # Duration - optionally active if durationWidth > 0: if data: len = data.len if len > 0: len = ngettext("%d Min", "%d Mins", (len / 60)) % (len / 60) res.append(MultiContentEntryText(pos=(colX, 0), size=(durationWidth, ih), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=len)) # Date begin_string = "" if begin > 0: if config.movielist.use_fuzzy_dates.value: begin_string = ', '.join(FuzzyTime(begin, inPast = True)) else: begin_string = strftime("%s, %s" % (config.usage.date.daylong.value, config.usage.time.short.value), localtime(begin)) res.append(MultiContentEntryText(pos=(width-dateWidth-r, 0), size=(dateWidth, ih), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=begin_string)) return res