def ChannelListEntryComponent(type, channelname, serviceref, eventid, eventname, starttime, endtime, usercount, percent): res = [ (serviceref, eventid) ] # PIXMAP / PICON pixmap = "/usr/share/enigma2/skin_default/picon_default.png" searchPaths = ('/usr/share/enigma2/picon/','/media/cf/picon/','/media/usb/picon/') srefstring = serviceref pos = srefstring.rfind(':') if pos != -1: srefstring = srefstring[:pos].rstrip(':').replace(':','_') for path in searchPaths: pngname = path + srefstring + ".png" if fileExists(pngname): pixmap = pngname # Build Menu if type == "tvcharts": res.append(MultiContentEntryPixmapAlphaTest(pos=(8, 8), size=(100, 60), png=loadPNG(pixmap))) res.append(MultiContentEntryText(pos=(130, 5), size=(480, 30), font=0, text="%s (Viewer: %s)" % (channelname, usercount))) res.append(MultiContentEntryText(pos=(130, 35), size=(480, 25), font=1, text=eventname)) elif type == "timercharts": res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 10), size=(100, 60), png=loadPNG(pixmap))) res.append(MultiContentEntryText(pos=(130, 5), size=(480, 28), font=0, text="%s (User: %s)" % (channelname, usercount))) res.append(MultiContentEntryText(pos=(130, 33), size=(480, 25), font=1, text=eventname)) res.append(MultiContentEntryText(pos=(130, 57), size=(480, 20), font=2, text="%s Uhr - %s Uhr (%smin)" % (strftime("%d.%m.%Y %H:%M", gmtime(starttime)), strftime("%H:%M", gmtime(endtime)), int((endtime-starttime)/60)))) elif type == "moviecharts": res.append(MultiContentEntryPixmapAlphaTest(pos=(8, 8), size=(100, 60), png=loadPNG(pixmap))) res.append(MultiContentEntryText(pos=(130, 5), size=(480, 30), font=0, text=eventname)) res.append(MultiContentEntryText(pos=(130, 33), size=(480, 25), font=1, text="Viewer: %s" % (usercount))) res.append(MultiContentEntryText(pos=(130, 57), size=(480, 20), font=2, text="%s Uhr - %s" % (strftime("%d.%m.%Y %H:%M", gmtime(starttime)), channelname))) return res
def buildList(self, entry): self.setTitle(_("STB-Channels / Web-Channel")) (stbSender, webSender, serviceref, status) = entry if int(status) == 0: imageStatus = path = os.path.join(PIXMAP_PATH, "minus.png") else: imageStatus = path = os.path.join(PIXMAP_PATH, "plus.png") global TemplatedListFonts if TemplatedListFonts is not None: l = [entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 8, 16, 16, loadPNG(imageStatus)), (eListboxPythonMultiContent.TYPE_TEXT, 35, 1, 400, 30, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, stbSender), (eListboxPythonMultiContent.TYPE_TEXT, 450, 1, 350, 30, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, webSender), (eListboxPythonMultiContent.TYPE_TEXT, 800, 1, 300, 30, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, "", colorYellow) ] else: l = [entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 8, 16, 16, loadPNG(imageStatus)), (eListboxPythonMultiContent.TYPE_TEXT, 35, 3, 300, 26, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, stbSender), (eListboxPythonMultiContent.TYPE_TEXT, 350, 3, 250, 26, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, webSender), (eListboxPythonMultiContent.TYPE_TEXT, 600, 3, 250, 26, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, "", colorYellow) ] return l
def DesignsListEntry(self,name,title="",author="",rating="",date="",total_votes=""): res = [[name,title,author,rating,date,total_votes]] png = metrixDefaults.PLUGIN_DIR + "images/vote"+rating+".png" pngtype = metrixDefaults.PLUGIN_DIR + "MyMetrix/images/brush.png" res.append(MultiContentEntryPixmapAlphaTest(pos=(412, 9), size=(170, 32), png=loadPNG(png))) res.append(MultiContentEntryPixmapAlphaTest(pos=(3, 7), size=(32, 32), png=loadPNG(pngtype))) res.append(MultiContentEntryText(pos=(40, 4), size=(367, 45), font=0, text=title)) return res
def buildList(self, entry): (Serie, Staffel, Sender, UTCTime, ID, MarkerFlag) = entry icon = imageNone = "%simages/black.png" % SerienRecorder.serienRecMainPath imageNeu = "%simages/neu.png" % SerienRecorder.serienRecMainPath if MarkerFlag == 1: setFarbe = parseColor('green').argb() elif MarkerFlag == 2: setFarbe = parseColor('red').argb() else: setFarbe = parseColor('foreground').argb() if str(Staffel).isdigit() and int(Staffel) == 1: icon = imageNeu foregroundColor = parseColor('foreground').argb() Staffel = "Staffel %s" % str(Staffel) WochenTag = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"] xtime = time.strftime(WochenTag[time.localtime(int(UTCTime)).tm_wday]+ ", %d.%m.%Y", time.localtime(int(UTCTime))) if config.plugins.serienRec.showPicons.value != "0": picon = loadPNG(imageNone) if Sender and self.serviceRefs.get(Sender): # Get picon by reference or by name piconPath = self.piconLoader.getPicon(self.serviceRefs.get(Sender)[0] if config.plugins.serienRec.showPicons.value == "1" else self.serviceRefs.get(Sender)[1]) if piconPath: self.picloader = PicLoader(80 * skinFactor, 40 * skinFactor) picon = self.picloader.load(piconPath) self.picloader.destroy() return [entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 5, 80 * skinFactor, 40 * skinFactor, picon), (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 340 * skinFactor, 15 * skinFactor, 30 * skinFactor, 30 * skinFactor, loadPNG(icon)), (eListboxPythonMultiContent.TYPE_TEXT, 110 * skinFactor, 3, 200 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, Sender, foregroundColor, foregroundColor), (eListboxPythonMultiContent.TYPE_TEXT, 110 * skinFactor, 29 * skinFactor, 200 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, xtime), (eListboxPythonMultiContent.TYPE_TEXT, 375 * skinFactor, 3, 500 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, Serie, setFarbe, setFarbe), (eListboxPythonMultiContent.TYPE_TEXT, 375 * skinFactor, 29 * skinFactor, 500 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, Staffel) ] else: return [entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 15, 15 * skinFactor, 30 * skinFactor, 30 * skinFactor, loadPNG(icon)), (eListboxPythonMultiContent.TYPE_TEXT, 50 * skinFactor, 3, 200 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, Sender, foregroundColor, foregroundColor), (eListboxPythonMultiContent.TYPE_TEXT, 50 * skinFactor, 29 * skinFactor, 200 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, xtime), (eListboxPythonMultiContent.TYPE_TEXT, 300 * skinFactor, 3, 500 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, Serie, setFarbe, setFarbe), (eListboxPythonMultiContent.TYPE_TEXT, 300 * skinFactor, 29 * skinFactor, 500 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, Staffel) ]
def LoadPixmap(path, desktop = None, cached = False): if path[-4:] == '.png': ptr = loadPNG(path) elif path[-4:] == '.jpg': ptr = loadJPG(path) elif path[-1:] == '.': alpha = loadPNG(path + 'a.png') ptr = loadJPG(path + 'rgb.jpg', alpha) else: raise Exception('neither .png nor .jpg, please fix file extension') if ptr and desktop: desktop.makeCompatiblePixmap(ptr) return ptr
def LoadPixmap(path, desktop = None, cached = False): if path[-4:] == ".png": ptr = loadPNG(path) elif path[-4:] == ".jpg": ptr = loadJPG(path) elif path[-1:] == ".": alpha = loadPNG(path + "a.png") ptr = loadJPG(path + "rgb.jpg", alpha) else: raise Exception("neither .png nor .jpg, please fix file extension") if ptr and desktop: desktop.makeCompatiblePixmap(ptr) return ptr
def buildList(self, entry): width = self.l.getItemSize().width() (name, coverFound, filename) = entry res = [ None ] if coverFound: truePath = "/usr/share/enigma2/skin_default/extensions/cover_yes.png" res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 1, 25, 25, loadPNG(truePath))) else: falsePath = "/usr/share/enigma2/skin_default/extensions/cover_no.png" res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 1, 25, 25, loadPNG(falsePath))) res.append((eListboxPythonMultiContent.TYPE_TEXT, 50, 0, 1280, 30, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, str(name))) return res
def loadPicture(filename): printl2("", "__common__::loadPicture", "S") ptr = None if filename[-4:] == ".png": ptr = loadPNG(filename) elif filename[-4:] == ".jpg": ptr = loadJPG(filename) if not ptr: # kind of fallback if filetype is declared wrong ptr = loadPNG(filename) printl2("filename: " + str(filename), "__common__::loadPicture", "D") printl2("", "__common__::loadPicture", "S") return ptr
def loadPicture(filename): EnigmaLight_log("",None,"__common__::loadPicture()") ptr = None if filename is None: return ptr if filename[-4:] == ".png": ptr = loadPNG(filename) elif filename[-4:] == ".jpg": ptr = loadJPG(filename) if not ptr: # kind of fallback if filetype is declared wrong ptr = loadPNG(filename) return ptr
def SkinPartsListEntry(self,item_id,name,author="",rating="",date="",version="",total_votes="",item_type="",image_id="",image_token="",description="",screenname="",image_link="",isactive="",build="0"): res = [[item_id,name,author,rating,date,version,total_votes,item_type,image_id,image_token,description,screenname,isactive,image_link,build]] path = config.plugins.MyMetrix.SkinPartPath.value +item_type+"s/active/"+item_type+"_"+str(item_id)+"/" if os.path.exists(path): pngtype = metrixDefaults.PLUGIN_DIR + "images/"+item_type+"-on.png" res.append(MultiContentEntryText(pos=(40, 4), size=(367, 45), font=0, text=name,color=metrixDefaults.COLOR_INSTALLED)) else: pngtype = metrixDefaults.PLUGIN_DIR + "images/"+item_type+".png" res.append(MultiContentEntryText(pos=(40, 4), size=(367, 45), font=0, text=name)) png = metrixDefaults.PLUGIN_DIR + "images/vote"+rating+".png" res.append(MultiContentEntryPixmapAlphaTest(pos=(412, 9), size=(170, 32), png=loadPNG(png))) res.append(MultiContentEntryPixmapAlphaTest(pos=(3, 7), size=(32, 32), png=loadPNG(pngtype))) return res
def PackagesListEntry(self, item_id, name, author, rating, date, version, total_votes, item_type, image_id, image_token, description, file_id, file_token, previouspackage = '0', isactive = ''): res = [[item_id, name, author, rating, date, version, total_votes, item_type, image_id, image_token, description, file_id, file_token, isactive, previouspackage]] path = metrixDefaults.pathRoot() + 'packages/' + str(item_id) if os.path.exists(path): pngtype = '/usr/lib/enigma2/python/Plugins/Extensions/MyMetrix/images/package-on.png' else: pngtype = '/usr/lib/enigma2/python/Plugins/Extensions/MyMetrix/images/package.png' png = '/usr/lib/enigma2/python/Plugins/Extensions/MyMetrix/images/vote' + rating + '.png' res.append(MultiContentEntryPixmapAlphaTest(pos=(412, 9), size=(170, 32), png=loadPNG(png))) res.append(MultiContentEntryPixmapAlphaTest(pos=(3, 7), size=(32, 32), png=loadPNG(pngtype))) res.append(MultiContentEntryText(pos=(40, 4), size=(367, 45), font=0, text=name)) return res
def CCcamServerListEntry(name, color): res = [name] png = "/usr/share/enigma2/skin_default/buttons/key_%s.png" % color if fileExists(png): res.append(MultiContentEntryPixmapAlphaTest(pos=(0, 0), size=(35, 25), png=loadPNG(png))) res.append(MultiContentEntryText(pos=(40, 3), size=(500, 25), font=0, text=name)) return res
def PanelListDownloadListEntry(pdownload): res = [(pdownload.name)] finishText = _('Finished: ') if pdownload.finish_time is not None: finishText = _('Finished: ') + time.strftime("%b %d %Y %H:%M:%S", time.localtime(pdownload.finish_time)) sizeKB = util.BtoKB(pdownload.size) if sizeKB <= 1024 and sizeKB >= 0: size = ("%d KB " % sizeKB) elif sizeKB <= 1024 * 1024: size = ("%d MB " % util.BtoMB(pdownload.size)) else: size = ("%.2f GB " % util.BtoGB(pdownload.size)) sizeText = _('Size: ') + size stateText = pdownload.textState res.append(MultiContentEntryPixmapAlphaTest(pos=(5, 5), size=(35, 25), png=loadPNG(pdownload.thumb))) res.append(MultiContentEntryText(pos=(60, 5), size=(760, 30), font=0, flags=RT_HALIGN_LEFT, text=toUTF8(pdownload.name))) res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_RIGHT, text=sizeText, color=0xE6A800)) if pdownload.state == 'success_finished': res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_LEFT, text=finishText, color=0xE6A800)) res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_CENTER, text=stateText, color=0x00FF00)) elif pdownload.state == 'error_finished': res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_LEFT, text=finishText, color=0xE6A800)) res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_CENTER, text=stateText, color=0xff0000)) elif pdownload.state == 'downloading': res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_CENTER, text=stateText, color=0xE6A800)) return res
def getPictureEntryComponent(self,name, absolute, isDir): """ name={angezeigter Name}, absolute={vollstaendiger Pfad}, isDir={True,False} """ res = [ (absolute, isDir) ] res.append((eListboxPythonMultiContent.TYPE_TEXT, 35, 1, 200, 20, 0, 0, name)) if isDir: png = loadPNG("/usr/share/enigma2/extensions/directory.png") else: extension = name.split('.') extension = extension[-1].lower() if EXTENSIONS.has_key(extension): png = loadPNG("/usr/share/enigma2/extensions/" + EXTENSIONS[extension] + ".png") else: png = None if png is not None: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 2, 20, 20, png)) return res
def buildListboxEntry(self, stbSender, webSender, serviceref, status): size = self.l.getItemSize() if int(status) == 0: imageStatus = path = os.path.join(PIXMAP_PATH, "minus.png") else: imageStatus = path = os.path.join(PIXMAP_PATH, "plus.png") l = [ (stbSender, webSender, serviceref, status), ] pos = self.margin + self.iconPosX l.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, pos, self.iconPosY, self.iconSize, self.iconSize, loadPNG(imageStatus))) pos += self.iconSize + self.margin l.append( (eListboxPythonMultiContent.TYPE_TEXT, pos, 0, self.colWidthStb, self.itemHeight, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, stbSender)) pos += self.colWidthStb + self.margin l.append( (eListboxPythonMultiContent.TYPE_TEXT, pos, 0, self.colWidthWeb, self.itemHeight, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, webSender)) pos += self.colWidthWeb + self.margin l.append((eListboxPythonMultiContent.TYPE_TEXT, pos, 0, size.width() - pos, self.itemHeight, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, "", colorYellow)) return l
def OnDemandListEntry(self, name, jpg): res = [(name, jpg)] icon = "/usr/lib/enigma2/python/Plugins/Extensions/OnDemand/icons/%s.png" % jpg if fileExists(icon): res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 0), size=(100, 40), png=loadPNG(icon))) res.append(MultiContentEntryText(pos=(330, 0), size=(170, 40), font=0, text=name, flags=RT_HALIGN_RIGHT)) return res
def LoadPixmap(path, desktop=None, cached=None): if path[-4:] == ".png": # cache unless caller explicity requests to not cache ptr = loadPNG(path, 0, 0 if cached == False else 1) elif path[-4:] == ".jpg": # don't cache unless caller explicity requests caching ptr = loadJPG(path, 1 if cached == True else 0) elif path[-1:] == ".": # caching mechanism isn't suitable for multi file images, so it's explicitly disabled alpha = loadPNG(path + "a.png", 0, 0) ptr = loadJPG(path + "rgb.jpg", alpha, 0) else: raise Exception("neither .png nor .jpg, please fix file extension") if ptr and desktop: desktop.makeCompatiblePixmap(ptr) return ptr
def streamListEntry(entry): uriInfo = entry[1].get('uri') return [entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 1, 35, 35, loadPNG('%s/icons/%s' % (PLUGIN_PATH, str(entry[1].get('icon'))))), (eListboxPythonMultiContent.TYPE_TEXT, 45, 7, 360, 37, 0, RT_HALIGN_LEFT, entry[0]), (eListboxPythonMultiContent.TYPE_TEXT, 410, 7, 400, 37, 1, RT_HALIGN_LEFT, str(uriInfo.get('URL')))]
def PanelListEntrySD(name, idx, png='', textcolor=None): res = [(name)] if fileExists(png): res.append(MultiContentEntryPixmapAlphaTest(pos=(5, 5), size=(35, 25), png=loadPNG(png))) res.append(MultiContentEntryFormattedText(pos=(60, 5), size=(950, 30), fontSize=Size.MEDIUM, flags=RT_VALIGN_TOP, text=toString(name), color=textcolor)) else: res.append(MultiContentEntryFormattedText(pos=(5, 5), size=(330, 30), fontSize=Size.MEDIUM, flags=RT_VALIGN_TOP, text=toString(name), color=textcolor)) return res
def PanelListEntrySD(name, idx, png='', textcolor=0xffffff): res = [(name)] if fileExists(png): res.append(MultiContentEntryPixmapAlphaTest(pos=(5, 5), size=(35, 25), png=loadPNG(png))) res.append(MultiContentEntryText(pos=(60, 5), size=(550, 30), font=0, flags=RT_VALIGN_TOP, text=toUTF8(name), color=textcolor)) else: res.append(MultiContentEntryText(pos=(5, 5), size=(330, 30), font=0, flags=RT_VALIGN_TOP, text=toUTF8(name), color=textcolor)) return res
def ContextEntry(name, idx, png=''): res = [(name, idx)] if fileExists(png): res.append(MultiContentEntryPixmapAlphaTest(pos=(5, 0), size=(24, 24), png=loadPNG(png))) res.append(MultiContentEntryText(pos=(40, 0), size=(455, 24), font=0, flags=RT_VALIGN_CENTER, text=name)) else: res.append(MultiContentEntryText(pos=(5, 0), size=(490, 24), font=0, flags=RT_VALIGN_CENTER, text=name)) return res
def PackagesListEntry(self,item_id,name,author="",rating="",date="",version="",total_votes="",item_type="",image_link="",icon_link="",description="",file_link="",downloads="",previouspackage="0",date_modified="",build=0,isinstalled=False,updateavailable=False): res = [[item_id,name,author,rating,date,version,total_votes,item_type,image_link,icon_link,description,file_link,downloads,date_modified,build,isinstalled,updateavailable]] path = metrixDefaults.pathRoot()+"packages/"+str(item_id) if isinstalled: pngtype = metrixDefaults.PLUGIN_DIR + "images/package-on.png" if updateavailable: res.append(MultiContentEntryText(pos=(70, 4), size=(365, 45), font=0, text=name,color=metrixDefaults.COLOR_UPDATE_AVAILABLE)) else: res.append(MultiContentEntryText(pos=(70, 4), size=(365, 45), font=0, text=name,color=metrixDefaults.COLOR_INSTALLED)) else: pngtype = metrixDefaults.PLUGIN_DIR + "images/package.png" res.append(MultiContentEntryText(pos=(70, 4), size=(365, 45), font=0, text=name)) png = metrixDefaults.PLUGIN_DIR + "images/vote"+rating+".png" pngicon = metrixTools.webPixmap(icon_link,"openStoreIcon"+str(item_id),{'width':54}) res.append(MultiContentEntryPixmapAlphaBlend(pos=(445, 9), size=(185, 32), png=loadPNG(png))) res.append(MultiContentEntryPixmapAlphaBlend(pos=(5, 1), size=(54, 54), png=loadPNG(pngicon))) return res
def CategoryListEntry(self,name,value="0",icon = "DEFAULT"): if icon == "DEFAULT": icon = self.sort png = "/usr/lib/enigma2/python/Plugins/Extensions/MyMetrix/images/"+icon+".png" res = [[value,name]] res.append(MultiContentEntryPixmapAlphaTest(pos=(25, 6), size=(170, 32), png=loadPNG(png))) res.append(MultiContentEntryText(pos=(80, 4), size=(405, 45), font=0, text=_(name))) return res
def MenuEntry(name, picture): res = [(picture, name)] picture = resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/sifteam_panel/" + picture + ".png") #print picture if fileExists(picture): res.append(MultiContentEntryPixmapAlphaTest(pos=(0, 0), size=(48, 48), png=loadPNG(picture))) res.append(MultiContentEntryText(pos=(60, 10), size=(420, 38), font=0, text=name)) return res
def ContextEntryDisabled(name, idx, png='', separator=False): res = [(name, idx)] if separator: res.append(MultiContentEntryText(pos=(5, 12), size=(490, 1), font=0, flags=RT_VALIGN_CENTER, text=name, backcolor=0xffffff)) elif fileExists(png): res.append(MultiContentEntryPixmapAlphaTest(pos=(5, 0), size=(24, 24), png=loadPNG(png))) res.append(MultiContentEntryText(pos=(40, 0), size=(455, 24), font=0, flags=RT_VALIGN_CENTER, text=name, color=0x696969)) else: res.append(MultiContentEntryText(pos=(5, 0), size=(490, 24), font=0, flags=RT_VALIGN_CENTER, text=name, color=0x696969)) return res
def StoreMenuEntry(self,name,value="",type="screen",author="",version="",description="",isactive="",id=""): res = [[value,name,type,author,version,description,isactive,id]] pngtype = metrixDefaults.PLUGIN_DIR + "images/"+type+isactive+".png" if isactive == "": res.append(MultiContentEntryText(pos=(40, 4), size=(455, 45), font=0, text=name)) else: res.append(MultiContentEntryText(pos=(40, 4), size=(455, 45), font=0, text=name,color=metrixDefaults.COLOR_INSTALLED)) res.append(MultiContentEntryPixmapAlphaTest(pos=(3, 7), size=(32, 32), png=loadPNG(pngtype))) return res
def setItemsPerPage(self): global listscreen if self.listHeight > 0: if listscreen: itemHeight = self.listHeight / config.misc.graph_mepg.items_per_page_listscreen.getValue() else: itemHeight = self.listHeight / config.misc.graph_mepg.items_per_page.getValue() else: itemHeight = 54 # some default (270/5) if listscreen: self.instance.resize(eSize(self.listWidth, itemHeight * config.misc.graph_mepg.items_per_page_listscreen.getValue())) else: self.instance.resize(eSize(self.listWidth, itemHeight * config.misc.graph_mepg.items_per_page.getValue())) self.l.setItemHeight(itemHeight) self.nowEvPix = loadPNG(resolveFilename(SCOPE_CURRENT_SKIN, 'epg/CurrentEvent.png')) self.othEvPix = loadPNG(resolveFilename(SCOPE_CURRENT_SKIN, 'epg/OtherEvent.png')) self.selEvPix = loadPNG(resolveFilename(SCOPE_CURRENT_SKIN, 'epg/SelectedEvent.png')) self.recEvPix = loadPNG(resolveFilename(SCOPE_CURRENT_SKIN, 'epg/RecordingEvent.png')) self.curSerPix = loadPNG(resolveFilename(SCOPE_CURRENT_SKIN, 'epg/CurrentService.png'))
def DesignsListEntry(self, name, title, author, likes, date): res = [[name, title, author, likes, date]] png = '/usr/lib/enigma2/python/Plugins/Extensions/MyMetrix/images/vote.png' res.append(MultiContentEntryPixmapAlphaTest(pos=(552, 9), size=(32, 32), png=loadPNG(png))) res.append(MultiContentEntryText(pos=(3, 4), size=(380, 45), font=0, text=title)) res.append(MultiContentEntryText(pos=(486, 9), size=(60, 40), font=1, flags=RT_HALIGN_RIGHT, text=likes)) return res
def buildList(self): self['list'].l.setItemHeight(70) if config.plugins.vZapHistory.viewMode.value == 'menu': self['list'].l.setItemHeight(50) list = [] for x in self.servicelist.history: if len(x) == 2: ref = x[1] else: ref = x[2] png = loadPNG(self.findPicon(ref)) info = self.serviceHandler.info(ref) if info: name = info.getName(ref).replace('\xc2\x86', '').replace('\xc2\x87', '') event = info.getEvent(ref) if event is not None: eventName = event.getEventName() if eventName is None: eventName = '' else: eventName = eventName.replace('(18+)', '').replace('18+', '').replace('(16+)', '').replace('16+', '').replace('(12+)', '').replace('12+', '').replace('(7+)', '').replace('7+', '').replace('(6+)', '').replace('6+', '').replace('(0+)', '').replace('0+', '') try: begin = event.getBeginTime() if begin is not None: end = begin + event.getDuration() remaining = (end - int(time())) / 60 prefix = '' if remaining > 0: prefix = "+" local_begin = localtime(begin) local_end = localtime(end) bar = 0 perc = '' i = (100 * (int(time()) - begin)) / event.getDuration() if i < 101: bar = i durationTime = _("%02d.%02d - %02d.%02d (%s%d min)") % (local_begin[3],local_begin[4],local_end[3],local_end[4],prefix, remaining) except: durationTime = '' else: eventName = '' durationTime = '' descriptionName = '' bar = 0 else: name = 'N/A' eventName = '' durationTime = '' descriptionName = '' bar = 0 list.append(vZapHistoryBrowserListEntry(name, eventName, durationTime, bar, png)) list.reverse() self['list'].setList(list)
def CCcamServerListEntry(name, color): res = [name] if path.exists(resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/key_%s.png" % color)): png = resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/key_%s.png" % color) else: png = "/usr/share/enigma2/skin_default/buttons/key_%s.png" % color if fileExists(png): x, y, w, h = skin.parameters.get("ChoicelistIcon",(5*f, 0, 35*f, 25*f)) res.append(MultiContentEntryPixmapAlphaBlend(pos=(x, y), size=(w, h), png=loadPNG(png))) x, y, w, h = skin.parameters.get("ChoicelistName",(45*f, 2*f, 550*f, 25*f)) res.append(MultiContentEntryText(pos=(x, y), size=(w, h), font=0, text=name)) return res
def ChannelListEntryComponent(type, channelname, serviceref, eventid, eventname, starttime, endtime, usercount, percent): res = [(serviceref, eventid)] # PIXMAP / PICON pixmap = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") searchPaths = ('/usr/share/enigma2/picon/', '/media/cf/picon/', '/media/usb/picon/') srefstring = serviceref pos = srefstring.rfind(':') if pos != -1: srefstring = srefstring[:pos].rstrip(':').replace(':', '_') for path in searchPaths: pngname = path + srefstring + ".png" if fileExists(pngname): pixmap = pngname # Build Menu if type == "tvcharts": res.append( MultiContentEntryPixmapAlphaTest(pos=(8, 8), size=(100, 60), png=loadPNG(pixmap), flags=BT_SCALE)) res.append( MultiContentEntryText(pos=(130, 5), size=(480, 30), font=0, text="%s (Viewer: %s)" % (channelname, usercount))) res.append( MultiContentEntryText(pos=(130, 35), size=(480, 25), font=1, text=eventname)) elif type == "timercharts": res.append( MultiContentEntryPixmapAlphaTest(pos=(10, 10), size=(100, 60), png=loadPNG(pixmap), flags=BT_SCALE)) res.append( MultiContentEntryText(pos=(130, 5), size=(480, 28), font=0, text="%s (User: %s)" % (channelname, usercount))) res.append( MultiContentEntryText(pos=(130, 33), size=(480, 25), font=1, text=eventname)) res.append( MultiContentEntryText( pos=(130, 57), size=(480, 20), font=2, text="%s Uhr - %s Uhr (%smin)" % (strftime("%d.%m.%Y %H:%M", gmtime(starttime)), strftime("%H:%M", gmtime(endtime)), int((endtime - starttime) / 60)))) elif type == "moviecharts": res.append( MultiContentEntryPixmapAlphaTest(pos=(8, 8), size=(100, 60), png=loadPNG(pixmap), flags=BT_SCALE)) res.append( MultiContentEntryText(pos=(130, 5), size=(480, 30), font=0, text=eventname)) res.append( MultiContentEntryText(pos=(130, 33), size=(480, 25), font=1, text="Viewer: %s" % (usercount))) res.append( MultiContentEntryText( pos=(130, 57), size=(480, 20), font=2, text="%s Uhr - %s" % (strftime("%d.%m.%Y %H:%M", gmtime(starttime)), channelname))) return res
def PanelListEntry2(name, sizePanelX, png=''): res = [(name)] if fileExists(png): res.append(MultiContentEntryPixmapAlphaTest(pos=(5, 5), size=(35, 27), png=loadPNG(png))) res.append(MultiContentEntryText(pos=(60, 5), size=(sizePanelX - 60, 30), font=Font.REGULAR_SMALL, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=name)) return res
def buildList(entry): from SerienRecorder import serienRecMainPath (webSender, stbSender, altstbSender, status) = entry if int(status) == 0: imageStatus = "%simages/minus.png" % serienRecMainPath else: imageStatus = "%simages/plus.png" % serienRecMainPath return [entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 7 * skinFactor, 16 * skinFactor, 16 * skinFactor, loadPNG(imageStatus)), (eListboxPythonMultiContent.TYPE_TEXT, 40 * skinFactor, 0, 300 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, webSender), (eListboxPythonMultiContent.TYPE_TEXT, 350 * skinFactor, 0, 250 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, stbSender), (eListboxPythonMultiContent.TYPE_TEXT, 600 * skinFactor, 0, 250 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, altstbSender, parseColor('yellow').argb()) ]
def cMenuListEntry(name, idx): res = [name] png = '/usr/lib/enigma2/python/Plugins/Extensions/TuneinRadio/skin/icons/%s.png' % str(name) if fileExists(png): if enigmaos == 'oe2.0': res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 15), size=(278, 78), png=loadPNG(png))) else: res.append(MultiContentEntryPixmapAlphaTest(pos=(2, 15), size=(278, 78), png=loadPNG(png))) res.append(MultiContentEntryText(pos=(10, 3), size=(278, 90), font=0, text=' ')) return res
from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE, SCOPE_LANGUAGE, SCOPE_PLUGINS from Tools.LoadPixmap import LoadPixmap import gettext ################################################ grab_binary = "/usr/bin/grab" grab_picture = "/tmp/mosaic.jpg" grab_errorlog = "/tmp/mosaic.log" config_limits = (3, 30) config.plugins.Mosaic = ConfigSubsection() config.plugins.Mosaic.countdown = ConfigInteger(default=5, limits=config_limits) playingIcon = loadPNG( resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/ico_mp_play.png')) pausedIcon = loadPNG( resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/ico_mp_pause.png')) ################################################ lang = language.getLanguage() environ["LANGUAGE"] = lang[:2] gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE)) gettext.textdomain("enigma2") gettext.bindtextdomain( "Mosaic", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/Mosaic/locale/")) def _(txt):
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 = 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, 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 buildList(self, entry): (series, season, channel, utc_time, ID, marker_flag, fs_id, info) = entry serienRecMainPath = os.path.dirname(__file__) icon = imageNone = "%s/images/black.png" % serienRecMainPath imageNeu = "%s/images/neu.png" % serienRecMainPath if marker_flag == 1: setFarbe = parseColor('green').argb() elif marker_flag == 2: setFarbe = parseColor('red').argb() else: setFarbe = parseColor('foreground').argb() if str(season).isdigit() and int(season) == 1: icon = imageNeu foregroundColor = parseColor('foreground').argb() season = "Staffel %s" % str(season) weekdays = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"] xtime = time.strftime( weekdays[time.localtime(int(utc_time)).tm_wday] + ", %d.%m.%Y", time.localtime(int(utc_time))) if config.plugins.serienRec.showPicons.value != "0": picon = loadPNG(imageNone) if channel and self.serviceRefs.get(channel): # Get picon by reference or by name piconPath = self.piconLoader.getPicon( self.serviceRefs.get(channel)[0] if config.plugins. serienRec.showPicons.value == "1" else self.serviceRefs.get(channel)[1]) if piconPath: self.picloader = PicLoader(80 * skinFactor, 40 * skinFactor) picon = self.picloader.load(piconPath) self.picloader.destroy() return [ entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 10, 5, 80 * skinFactor, 40 * skinFactor, picon), (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 340 * skinFactor, 15 * skinFactor, 30 * skinFactor, 30 * skinFactor, loadPNG(icon)), (eListboxPythonMultiContent.TYPE_TEXT, 110 * skinFactor, 3, 230 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, channel, foregroundColor, foregroundColor), (eListboxPythonMultiContent.TYPE_TEXT, 110 * skinFactor, 29 * skinFactor, 200 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, xtime), (eListboxPythonMultiContent.TYPE_TEXT, 375 * skinFactor, 3, 500 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, series, setFarbe, setFarbe), (eListboxPythonMultiContent.TYPE_TEXT, 375 * skinFactor, 29 * skinFactor, 500 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, season) ] else: return [ entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 15, 15 * skinFactor, 30 * skinFactor, 30 * skinFactor, loadPNG(icon)), (eListboxPythonMultiContent.TYPE_TEXT, 50 * skinFactor, 3, 230 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, channel, foregroundColor, foregroundColor), (eListboxPythonMultiContent.TYPE_TEXT, 50 * skinFactor, 29 * skinFactor, 200 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, xtime), (eListboxPythonMultiContent.TYPE_TEXT, 300 * skinFactor, 3, 500 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, series, setFarbe, setFarbe), (eListboxPythonMultiContent.TYPE_TEXT, 300 * skinFactor, 29 * skinFactor, 500 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, season) ]
def buildPlanerList(self, entry): (regional, paytv, neu, prime, transmissionTime, url, serien_name, sender, staffel, episode, title, aufnahme, serieAdded, bereits_vorhanden, serien_id) = entry imageNone = "%simages/black.png" % SerienRecorder.serienRecMainPath imageNeu = "%simages/neu.png" % SerienRecorder.serienRecMainPath imageTimer = "%simages/timer.png" % SerienRecorder.serienRecMainPath imageHDD = "%simages/hdd_icon.png" % SerienRecorder.serienRecMainPath if serieAdded == 1: seriesColor = parseColor('green').argb() elif serieAdded == 2: seriesColor = parseColor('red').argb() else: seriesColor = None if aufnahme: seriesColor = parseColor('blue').argb() titleColor = timeColor = parseColor('foreground').argb() if int(neu) == 0: imageNeu = imageNone if bereits_vorhanden: imageHDDTimer = imageHDD elif aufnahme: imageHDDTimer = imageTimer else: imageHDDTimer = imageNone if config.plugins.serienRec.showPicons.value != "0": picon = loadPNG(imageNone) if sender and self.serviceRefs.get(sender): # Get picon by reference or name piconPath = self.piconLoader.getPicon( self.serviceRefs.get(sender)[0] if config.plugins. serienRec.showPicons.value == "1" else self.serviceRefs.get(sender)[1]) if piconPath: self.picloader = PicLoader(80 * skinFactor, 40 * skinFactor) picon = self.picloader.load(piconPath) self.picloader.destroy() return [ entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 5 * skinFactor, 80 * skinFactor, 40 * skinFactor, picon), (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 330 * skinFactor, 7 * skinFactor, 30 * skinFactor, 22 * skinFactor, loadPNG(imageNeu)), (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 330 * skinFactor, 30 * skinFactor, 30 * skinFactor, 22 * skinFactor, loadPNG(imageHDDTimer)), (eListboxPythonMultiContent.TYPE_TEXT, 100 * skinFactor, 3, 200 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, sender), (eListboxPythonMultiContent.TYPE_TEXT, 100 * skinFactor, 29 * skinFactor, 150 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, transmissionTime, timeColor, timeColor), (eListboxPythonMultiContent.TYPE_TEXT, 365 * skinFactor, 3, 500 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, serien_name, seriesColor, seriesColor), (eListboxPythonMultiContent.TYPE_TEXT, 365 * skinFactor, 29 * skinFactor, 500 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, title, titleColor, titleColor) ] else: return [ entry, (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 7, 30 * skinFactor, 22 * skinFactor, loadPNG(imageNeu)), (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 30 * skinFactor, 30 * skinFactor, 22 * skinFactor, loadPNG(imageHDDTimer)), (eListboxPythonMultiContent.TYPE_TEXT, 40 * skinFactor, 3, 280 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, sender), (eListboxPythonMultiContent.TYPE_TEXT, 40 * skinFactor, 29 * skinFactor, 150 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, transmissionTime, timeColor, timeColor), (eListboxPythonMultiContent.TYPE_TEXT, 340 * skinFactor, 3, 520 * skinFactor, 26 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, serien_name, seriesColor, seriesColor), (eListboxPythonMultiContent.TYPE_TEXT, 340 * skinFactor, 29 * skinFactor, 520 * skinFactor, 18 * skinFactor, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, title, titleColor, titleColor) ]
def show_list(h): # png1 = '/usr/lib/enigma2/python/Plugins/SatLodge/slManager/res/img/actcam.png' # png2 = '/usr/lib/enigma2/python/Plugins/SatLodge/slManager/res/img/defcam.png' png1 = plugin_path + 'res/img/actcam.png' png2 = plugin_path + 'res/img/defcam.png' cond = readCurrent_1() if HD.width() > 1280: res = [(h)] # cond = readCurrent_1() if cond == h: res.append( MultiContentEntryPixmapAlphaTest(pos=(5, 6), size=(51, 40), png=loadPNG(png1))) res.append( MultiContentEntryText(pos=(60, 2), size=(698, 50), font=7, text=h + ' (Active)', color=0xadff00, flags=RT_HALIGN_CENTER)) else: res.append( MultiContentEntryPixmapAlphaTest(pos=(5, 6), size=(51, 40), png=loadPNG(png2))) res.append( MultiContentEntryText(pos=(60, 2), size=(698, 50), font=7, text=h, flags=RT_HALIGN_CENTER)) return res else: res = [(h)] if cond == h: res.append( MultiContentEntryText(pos=(60, 2), size=(406, 40), font=2, text=h + ' (Active)', color=0xadff00, flags=RT_HALIGN_CENTER)) res.append( MultiContentEntryPixmapAlphaTest(pos=(5, 2), size=(51, 40), png=loadPNG(png1))) else: res.append( MultiContentEntryText(pos=(60, 2), size=(406, 40), font=2, text=h, flags=RT_HALIGN_CENTER)) res.append( MultiContentEntryPixmapAlphaTest(pos=(5, 2), size=(51, 40), png=loadPNG(png2))) return res
def PanelListDownloadListEntry(pdownload): res = [(pdownload.name)] finishText = _('Finished: ') if pdownload.finish_time is not None: finishText = _('Finished: ') + time.strftime( "%b %d %Y %H:%M:%S", time.localtime(pdownload.finish_time)) sizeKB = BtoKB(pdownload.size) if sizeKB <= 1024 and sizeKB >= 0: size = ("%d KB " % sizeKB) elif sizeKB <= 1024 * 1024: size = ("%d MB " % BtoMB(pdownload.size)) else: size = ("%.2f GB " % BtoGB(pdownload.size)) sizeText = _('Size: ') + size stateText = pdownload.textState res.append( MultiContentEntryPixmapAlphaTest(pos=(5, 5), size=(35, 25), png=loadPNG(pdownload.thumb))) res.append( MultiContentEntryText(pos=(60, 5), size=(760, 30), font=Font.REGULAR_MEDIUM, flags=RT_HALIGN_LEFT, text=toString(pdownload.name))) res.append( MultiContentEntryText(pos=(0, 38), size=(900, 18), font=Font.REGULAR_SMALL, flags=RT_VALIGN_TOP | RT_HALIGN_RIGHT, text=sizeText, color=0xE6A800)) if pdownload.state == 'success_finished': res.append( MultiContentEntryText(pos=(0, 38), size=(900, 18), font=Font.REGULAR_SMALL, flags=RT_VALIGN_TOP | RT_HALIGN_LEFT, text=finishText, color=0xE6A800)) res.append( MultiContentEntryText(pos=(0, 38), size=(900, 18), font=Font.REGULAR_SMALL, flags=RT_VALIGN_TOP | RT_HALIGN_CENTER, text=stateText, color=0x00FF00)) elif pdownload.state == 'error_finished': res.append( MultiContentEntryText(pos=(0, 38), size=(900, 18), font=Font.REGULAR_SMALL, flags=RT_VALIGN_TOP | RT_HALIGN_LEFT, text=finishText, color=0xE6A800)) res.append( MultiContentEntryText(pos=(0, 38), size=(900, 18), font=Font.REGULAR_SMALL, flags=RT_VALIGN_TOP | RT_HALIGN_CENTER, text=stateText, color=0xff0000)) elif pdownload.state == 'downloading': res.append( MultiContentEntryText(pos=(0, 38), size=(900, 18), font=Font.REGULAR_SMALL, flags=RT_VALIGN_TOP | RT_HALIGN_CENTER, text=stateText, color=0xE6A800)) return res
def buildMovieListEntry(self, serviceref, info, begin, data): showPicons = "picon" in config.usage.movielist_servicename_mode.getValue( ) switch = config.usage.show_icons_in_movielist.getValue() piconWidth = config.usage.movielist_piconwidth.getValue( ) if showPicons else 0 durationWidth = self.durationWidth if config.usage.load_length_of_movies_in_moviellist.getValue( ) else 0 width = self.l.getItemSize().width() dateWidth = self.dateWidth if not config.movielist.use_fuzzy_dates.getValue(): 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 - 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( 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.getValue(): 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.getValue(): 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( 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 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 + 425, 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 - 130, 0), size=(dateWidth + 130, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res