def __init__(self, session): Screen.__init__(self, session) self.iConsole = iConsole() self.skin = uniswitcher.skin self.setTitle(_("%s Switcher: - %s") % (config.plugins.usw.emu.value, config.plugins.usw.activeconf.value)) self.session = session self.indexpos = None self.list = [] self.servinactpng = LoadPixmap(path=resolveFilename(SCOPE_PLUGINS, "Extensions/epanel/images/serv.png")) self.servactpng = LoadPixmap(path=resolveFilename(SCOPE_PLUGINS, "Extensions/epanel/images/servact.png")) self["list"] = List(self.list) self.mList() self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions"], { "ok": self.run, "red": self.close, "green": self.restartsoft, "cancel": self.close }, -1) self["readServ"] = StaticText() self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText(_("Restart Softcam")) self["text"] = ScrollLabel("") self.listecm() self.Timer = eTimer() self.Timer.callback.append(self.listecm) self.Timer.start(1000*4, False)
def updateList(self): list = [] expandableIcon = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "icons/expandable-plugins.png")) expandedIcon = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "icons/expanded-plugins.png")) verticallineIcon = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "icons/verticalline-plugins.png")) self.plugins = {} for x in self.pluginlist: split = x[3].split('-', 1) if len(split) < 2: continue if not self.plugins.has_key(split[0]): self.plugins[split[0]] = [] self.plugins[split[0]].append((PluginDescriptor(name = x[3], description = x[2], icon = verticallineIcon), split[1], x[1])) temp = self.plugins.keys() if config.usage.sort_pluginlist.getValue(): temp.sort() for x in temp: if x in self.expanded: list.append(PluginCategoryComponent(x, expandedIcon, self.listWidth)) list.extend([PluginDownloadComponent(plugin[0], plugin[1], plugin[2], self.listWidth) for plugin in self.plugins[x]]) else: list.append(PluginCategoryComponent(x, expandableIcon, self.listWidth)) self.list = list self["list"].l.setList(list) self["text"] = Label(_("Downloading plugin information complete."))
def updateNetworkList(self): self.list = [] self.network = {} self.mounts = iAutoMount.getMountsList() # reloading mount list for x in self.networklist: if not self.network.has_key(x[2]): self.network[x[2]] = [] self.network[x[2]].append((NetworkDescriptor(name = x[1], description = x[2]), x)) self.network.keys().sort() for x in self.network.keys(): if self.network[x][0][1][3] == '00:00:00:00:00:00': self.device = 'unix' else: self.device = 'windows' if x in self.expanded: networkshares = self.getNetworkShares(x,self.network[x][0][1][1].strip(),self.device) hostentry = self.network[x][0][1] name = hostentry[2] + " ( " +hostentry[1].strip() + " )" expandedIcon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/host.png")) self.list.append(( hostentry, expandedIcon, name, None, None, None, None, None )) for share in networkshares: self.list.append(self.BuildNetworkShareEntry(share)) else: # HOSTLIST - VIEW hostentry = self.network[x][0][1] name = hostentry[2] + " ( " +hostentry[1].strip() + " )" expandableIcon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/host.png")) self.list.append(( hostentry, expandableIcon, name, None, None, None, None, None )) if len(self.list): for entry in self.list: entry[0][2]= "%3s.%3s.%3s.%3s" % tuple(entry[0][2].split(".")) self.list.sort(key=lambda x: x[0][2]) for entry in self.list: entry[0][2]= entry[0][2].replace(" ", "") self["list"].setList(self.list) self["list"].setIndex(self.listindex)
def DiskEntry(model, size, removable): if removable: picture = LoadPixmap(cached = True, path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/DeviceManager/icons/diskusb.png")); else: picture = LoadPixmap(cached = True, path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/DeviceManager/icons/disk.png")); return (picture, model, size)
def DiskEntry(model, size, removable): if removable: picture = LoadPixmap(cached = True, path = resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/sifteam_others/diskusb.png")); else: picture = LoadPixmap(cached = True, path = resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/sifteam_others/disk.png")); return (picture, model, size)
def changed(self, what): if self.instance: pngname = "" if what[0] != self.CHANGED_CLEAR: sname = self.source.text pos = sname.rfind(':') if pos != -1: sname = sname[:pos].rstrip(':').replace(':','_') pngname = self.nameCache.get(sname, "") if pngname == "": pngname = self.findPicon(sname) if pngname != "": self.nameCache[sname] = pngname if pngname == "": # no picon for service found pngname = self.nameCache.get("default", "") if pngname == "": # no default yet in cache.. pngname = self.findPicon("picon_default") if pngname == "": tmp = resolveFilename(SCOPE_CURRENT_SKIN, "picon_default.png") if fileExists(tmp): pngname = tmp else: pngname = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/picon_default.png") self.nameCache["default"] = pngname if self.pngname != pngname: self.instance.setPixmapFromFile(pngname) self.pngname = pngname
def collectAttributes(skinAttributes, node, context, skin_path_prefix=None, ignore=(), filenames=frozenset(("pixmap", "pointer", "seek_pointer", "backgroundPixmap", "selectionPixmap", "sliderPixmap", "scrollbarbackgroundPixmap"))): # walk all attributes size = None pos = None font = None for attrib, value in node.items(): if attrib not in ignore: if attrib in filenames: pngfile = resolveFilename(SCOPE_ACTIVE_SKIN, value, path_prefix=skin_path_prefix) if fileExists(resolveFilename(SCOPE_ACTIVE_LCDSKIN, value, path_prefix=skin_path_prefix)): pngfile = resolveFilename(SCOPE_ACTIVE_LCDSKIN, value, path_prefix=skin_path_prefix) value = pngfile # Bit of a hack this, really. When a window has a flag (e.g. wfNoBorder) # it needs to be set at least before the size is set, in order for the # window dimensions to be calculated correctly in all situations. # If wfNoBorder is applied after the size has been set, the window will fail to clear the title area. # Similar situation for a scrollbar in a listbox; when the scrollbar setting is applied after # the size, a scrollbar will not be shown until the selection moves for the first time if attrib == 'size': size = value.encode("utf-8") elif attrib == 'position': pos = value.encode("utf-8") elif attrib == 'font': font = value.encode("utf-8") skinAttributes.append((attrib, font)) else: skinAttributes.append((attrib, value.encode("utf-8"))) if pos is not None: pos, size = context.parse(pos, size, font) skinAttributes.append(('position', pos)) if size is not None: skinAttributes.append(('size', size))
def __init__(self, session): self.session = session Screen.__init__(self, session) self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "WizardActions", "ColorActions", "SetupActions", "NumberActions", "MenuActions"], { "ok" : self.keyOK, "cancel": self.keyCancel, "up" : self.keyUp, "down" : self.keyDown, "left" : self.keyLeft, "right" : self.keyRight, }, -1) self.streamBin = resolveFilename(SCOPE_PLUGINS, "usr/bin/rtmpdump") self.streamFile = resolveFilename(SCOPE_PLUGINS, "Extensions/OpenIPTV/chanels.xml") self.streamList = [] self.makeStreamList() self.streamMenuList = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent) self.streamMenuList.l.setFont(0, gFont('Regular', 22)) self.streamMenuList.l.setFont(1, gFont('Regular', 18)) self.streamMenuList.l.setItemHeight(37) self['streamlist'] = self.streamMenuList self.streamMenuList.setList(map(streamListEntry, self.streamList)) self.onLayoutFinish.append(self.layoutFinished) self.rtmpConsole = None self.beforeService = None self.currentService = None self.playerStoped = False self.serviceDoCommand = None self.keyLocked = False
def EgamiAddonMenuEntryComponent(name, description, long_description = None, pngname = 'default', width = 540): screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth == 1920: width = 1280 icons = 'iconsHD' else: width = 640 icons = 'icons' if fileExists(resolveFilename(SCOPE_CURRENT_SKIN) + 'egami_icons/' + pngname + '.png'): png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN) + 'egami_icons/' + pngname + '.png') else: png = LoadPixmap('/usr/lib/enigma2/python/EGAMI/' + icons + '/' + pngname + '.png') if png is None: png = LoadPixmap('/usr/lib/enigma2/python/EGAMI/' + icons + '/default.png') if screenwidth and screenwidth == 1920: return [(_(name), _(long_description)), MultiContentEntryText(pos=(100, 5), size=(width - 60, 35), font=0, text=_(name)), MultiContentEntryText(pos=(100, 40), size=(width - 60, 28), font=1, text=_(description)), MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(90, 90), png=png)] else: return [(_(name), _(long_description)), MultiContentEntryText(pos=(70, 5), size=(width - 60, 25), font=0, text=_(name)), MultiContentEntryText(pos=(70, 26), size=(width - 60, 17), font=1, text=_(description)), MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(45, 45), png=png)] return
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.picload.setPara((self.listWidth, itemHeight - 2 * self.eventBorderWidth, 0, 0, 1, 1, "#00000000")) self.picload.startDecode(resolveFilename(SCOPE_CURRENT_SKIN, 'epg/CurrentEvent.png'), 0, 0, False) self.nowEvPix = self.picload.getData() self.picload.startDecode(resolveFilename(SCOPE_CURRENT_SKIN, 'epg/OtherEvent.png'), 0, 0, False) self.othEvPix = self.picload.getData() self.picload.startDecode(resolveFilename(SCOPE_CURRENT_SKIN, 'epg/SelectedEvent.png'), 0, 0, False) self.selEvPix = self.picload.getData() self.picload.startDecode(resolveFilename(SCOPE_CURRENT_SKIN, 'epg/RecordingEvent.png'), 0, 0, False) self.recEvPix = self.picload.getData()
def changed(self, what): if self.instance: pngname = '' if (what[0] != self.CHANGED_CLEAR): sname = self.source.text sname = sname.upper() pngname = self.nameCache.get(sname, '') if (pngname == ''): pngname = self.findPicon(sname) if (pngname != ''): self.nameCache[sname] = pngname if (pngname == ''): pngname = self.nameCache.get('default', '') if (pngname == ''): pngname = self.findPicon('picon_default') if (pngname == ''): tmp = resolveFilename(SCOPE_CURRENT_SKIN, 'picon_default.png') if fileExists(tmp): pngname = tmp else: pngname = resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/picon_default.png') self.nameCache['default'] = pngname if self.pngname != pngname: if pngname: self.instance.setScale(1) self.instance.setPixmapFromFile(pngname) self.instance.show()
def buildInterfaceList(self,device,description,type ): divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) activepng = None devicepng = None enabled = iInputDevices.getDeviceAttribute(device, 'enabled') if type == 'remote': if config.misc.rcused.value == 0: if enabled: devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew-configured.png")) else: devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew.png")) else: if enabled: devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcold-configured.png")) else: devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcold.png")) elif type == 'keyboard': if enabled: devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_keyboard-configured.png")) else: devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_keyboard.png")) elif type == 'mouse': if enabled: devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_mouse-configured.png")) else: devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_mouse.png")) else: devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew.png")) return((device, description, devicepng, divpng))
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if getBoxType() in bw_lcd or config.lcd.picon_pack.value: pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() in bw_lcd or config.lcd.picon_pack.value: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() in bw_lcd or config.lcd.picon_pack.value: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'): pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'): tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'): pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def createMovieFolder(self): if not pathExists(resolveFilename(SCOPE_HDD)): try: makedirs(resolveFilename(SCOPE_HDD)) except OSError: return -1 return 0
def changed(self, what): if self.instance: pngname = '' if not what[0] is self.CHANGED_CLEAR: sname = self.source.text sname = sname.upper().replace('.', '').replace('\xc2\xb0', '') if sname.startswith('4097'): sname = sname.replace('4097', '1', 1) if ':' in sname: sname = '_'.join(sname.split(':')[:10]) pngname = self.nameCache.get(sname, '') if pngname is '': pngname = self.findPicon(sname) if not pngname is '': self.nameCache[sname] = pngname if pngname is '': pngname = self.nameCache.get('default', '') if pngname is '': pngname = self.findPicon('picon_default') if pngname is '': tmp = resolveFilename(SCOPE_CURRENT_SKIN, 'picon_default.png') if os.path.isfile(tmp): pngname = tmp else: pngname = resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/picon_default.png') self.nameCache['default'] = pngname if not self.pngname is pngname: self.picload = ePicLoad() self.picload.PictureData.get().append(self.piconShow) scale = AVSwitch().getFramebufferScale() #0=Width 1=Height 2=Aspect 3=use_cache 4=resize_type 5=Background(#AARRGGBB) #self.picload.setPara((self.instance.size().width(), self.instance.size().height(), 1, 1, False, 1, "#00000000")) self.picload.setPara((self.instance.size().width(), self.instance.size().height(), scale[0], scale[1], False, 1, "#00000000")) self.picload.startDecode(pngname) self.pngname = pngname
def VirtualKeyBoardEntryComponent(keys, selectedKey, shiftMode=False): key_bg = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_bg.png")) key_bg_width = key_bg.size().width() if shiftMode: key_images = KEY_IMAGES_SHIFT else: key_images = KEY_IMAGES res = [ (keys) ] x = 0 count = 0 for count, key in enumerate(keys): width = None png = key_images.get(key, None) if png: pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, png)) width = pixmap.size().width() res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=pixmap)) else: width = key_bg_width res.extend(( MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_bg), MultiContentEntryText(pos=(x, 0), size=(width, 45), font=0, text=key.encode("utf-8"), flags=RT_HALIGN_CENTER | RT_VALIGN_CENTER) )) if selectedKey == count: key_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_sel.png")) width = key_sel.size().width() res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_sel)) if width is not None: x += width else: x += 45 return res
def changed(self, what): if self.instance: pngname = '' if what[0] != self.CHANGED_CLEAR: sname = self.source.text pos = sname.rfind(':') if pos != -1: sname = sname[:pos].rstrip(':').replace(':', '_') pngname = self.nameCache.get(sname, '') if pngname == '': pngname = self.findPicon(sname) if pngname != '': self.nameCache[sname] = pngname if pngname == '': pngname = self.nameCache.get('default', '') if pngname == '': pngname = self.findPicon('picon_default') if pngname == '': tmp = resolveFilename(SCOPE_CURRENT_SKIN, 'picon_default.png') if fileExists(tmp): pngname = tmp else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, 'picon_default.png') self.nameCache['default'] = pngname if self.pngname != pngname: self.instance.setPixmapFromFile(pngname) self.pngname = pngname
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0,0) self.pngname = "" self.lastPath = None if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"): pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"): tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"): pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def BuildNetworkShareEntry(self,share): verticallineIcon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/verticalLine.png")) sharetype = share[0] localsharename = share[1] sharehost = share[2] if sharetype == 'smbShare': sharedir = share[3] sharedescription = share[5] else: sharedir = share[4] sharedescription = share[3] if sharetype == 'nfsShare': newpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/i-nfs.png")) else: newpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/i-smb.png")) self.isMounted = False for sharename, sharedata in self.mounts.items(): if sharedata['ip'] == sharehost: if sharetype == 'nfsShare' and sharedata['mounttype'] == 'nfs': if sharedir == sharedata['sharedir']: if sharedata["isMounted"] is True: self.isMounted = True if sharetype == 'smbShare' and sharedata['mounttype'] == 'cifs': if sharedir == sharedata['sharedir']: if sharedata["isMounted"] is True: self.isMounted = True if self.isMounted is True: isMountedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/ok.png")) else: isMountedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/cancel.png")) return((share, verticallineIcon, None, sharedir, sharedescription, newpng, isMountedpng))
def MultiFileSelectEntryComponent(name, absolute = None, isDir = False, selected = False): screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth == 1920: res = [(absolute, isDir, selected, name), (eListboxPythonMultiContent.TYPE_TEXT, 150, 3, 470, 60, 1, RT_HALIGN_LEFT, name)] else: res = [(absolute, isDir, selected, name), (eListboxPythonMultiContent.TYPE_TEXT, 55, 1, 470, 20, 0, RT_HALIGN_LEFT, name)] if isDir: png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "extensions/directory.png")) else: extension = name.split('.') extension = extension[-1].lower() if EXTENSIONS.has_key(extension): png = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "extensions/" + EXTENSIONS[extension] + ".png")) else: png = None if png is not None: if screenwidth and screenwidth == 1920: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 80, 5, 50, 50, png)) else: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 30, 2, 20, 20, png)) if not name.startswith('<'): if selected: icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "icons/lock_on.png")) else: icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "icons/lock_off.png")) if screenwidth and screenwidth == 1920: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 10, 5, 50, 50, icon)) else: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 2, 0, 25, 25, icon)) return res
def installSkin(self, directory, name): if self.blocking: copytree(directory, resolveFilename(SCOPE_SKIN)) self.installNext() else: if self.console.execute("cp -a %s %s" % (directory, resolveFilename(SCOPE_SKIN))): self.installNext()
def installCertificates(session, callback=None, l2k=None): print "[WebInterface] Installing SSL Certificates to %s" % resolveFilename(SCOPE_CONFIG) srvcert = "%sserver.pem" % resolveFilename(SCOPE_CONFIG) cacert = "%scacert.pem" % resolveFilename(SCOPE_CONFIG) scope_webif = "%sExtensions/WebInterface/" % resolveFilename(SCOPE_PLUGINS) source = "%setc/server.pem" % scope_webif target = srvcert ret = copyfile(source, target) if ret == 0: source = "%setc/cacert.pem" % scope_webif target = cacert ret = copyfile(source, target) if ret == 0 and callback != None: callback(session, l2k) if ret < 0: config.plugins.Webinterface.https.enabled.value = False config.plugins.Webinterface.https.enabled.save() # Start without https callback(session, l2k) # Inform the user session.open( MessageBox, "Couldn't install SSL-Certifactes for https access\nHttps access is now disabled!", MessageBox.TYPE_ERROR, )
def buildListEntry(self, enabled, name, type): if enabled: pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png")) else: pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_off.png")) return((pixmap, name, type))
def __init__(self, selChangedCB=None, timer=None, time_epoch=120, overjump_empty=True): self.cur_event = None self.cur_service = None self.offs = 0 self.timer = timer self.onSelChanged = [] if selChangedCB is not None: self.onSelChanged.append(selChangedCB) GUIComponent.__init__(self) self.l = eListboxPythonMultiContent() self.l.setItemHeight(54) self.l.setBuildFunc(self.buildEntry) if overjump_empty: self.l.setSelectableFunc(self.isSelectable) self.epgcache = eEPGCache.getInstance() self.clock_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "750S/icons/epgclock.png")) self.clock_add_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "750S/icons/epgclock_add.png")) self.clock_pre_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "750S/icons/epgclock_pre.png")) self.clock_post_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "750S/icons/epgclock_post.png")) self.clock_prepost_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "750S/icons/epgclock_prepost.png")) self.time_base = None self.time_epoch = time_epoch self.list = None self.event_rect = None self.foreColor = None self.foreColorSelected = None self.borderColor = None self.backColor = 0x586D88 self.backColorSelected = 0x808080 self.foreColorService = None self.backColorService = None
def installFavourites(self, directory, name): self.reloadFavourites = True if self.blocking: copyfile(directory + name, resolveFilename(SCOPE_CONFIG)) self.installNext() elif self.console.execute('cp %s %s' % (directory + name, resolveFilename(SCOPE_CONFIG))): self.installNext()
def loadProject(self, filename): #try: if not fileExists(filename): self.error = "xml file not found!" #raise AttributeError file = open(filename, "r") data = file.read().decode("utf-8").replace('&',"&").encode("ascii",'xmlcharrefreplace') file.close() projectfiledom = xml.dom.minidom.parseString(data) for node in projectfiledom.childNodes[0].childNodes: print "node:", node if node.nodeType == xml.dom.minidom.Element.nodeType: if node.tagName == 'settings': self.xmlAttributesToConfig(node, self.settings) elif node.tagName == 'titles': self.xmlGetTitleNodeRecursive(node) for key in self.filekeys: val = self.settings.dict()[key].getValue() if not fileExists(val): if val[0] != "/": if key.find("font") == 0: val = resolveFilename(SCOPE_FONTS)+val else: val = resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/"+val if fileExists(val): self.settings.dict()[key].setValue(val) continue self.error += "\n%s '%s' not found" % (key, val) #except AttributeError: #print "loadProject AttributeError", self.error #self.error += (" in project '%s'") % (filename) #return False return True
def __init__(self, selChangedCB = None, timer = None, time_epoch = 120, overjump_empty = True): GUIComponent.__init__(self) self.cur_event = None self.cur_service = None self.offs = 0 self.timer = timer self.last_time = time() self.onSelChanged = [ ] if selChangedCB is not None: self.onSelChanged.append(selChangedCB) self.l = eListboxPythonMultiContent() self.l.setBuildFunc(self.buildEntry) self.setOverjump_Empty(overjump_empty) self.epgcache = eEPGCache.getInstance() self.clocks = [ LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_add.png')), LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_pre.png')), LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock.png')), LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_prepost.png')), LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_post.png')) ] self.time_base = None self.time_epoch = time_epoch self.list = None self.select_rect = None self.event_rect = None self.service_rect = None self.picon_size = None self.currentlyPlaying = None self.showPicon = False self.showServiceTitle = True self.picload = ePicLoad() self.nowEvPix = None self.othEvPix = None self.selEvPix = None self.recEvPix = None self.curSerPix = None self.foreColor = 0xffffff self.foreColorSelected = 0xffc000 self.borderColor = 0x464445 self.backColor = 0x595959 self.backColorSelected = 0x808080 self.foreColorService = 0xffffff self.foreColorServiceSelected = 0xffffff self.backColorService = 0x000000 self.backColorServiceSelected = 0x508050 self.borderColorService = 0x000000 self.foreColorNow = 0xffffff self.backColorNow = 0x505080 self.foreColorRec = 0xffffff self.backColorRec = 0x805050 self.serviceFont = gFont("Regular", 20) self.entryFontName = "Regular" self.entryFontSize = 18 self.listHeight = None self.listWidth = None self.serviceBorderWidth = 1 self.serviceNamePadding = 0 self.eventBorderWidth = 1 self.eventNamePadding = 0
def __init__(self, session): Screen.__init__(self, session) self.setTitle(_("SoftCam manager")) self.Console = Console() self["key_red"] = StaticText(_("Stop")) self["key_green"] = StaticText(_("Start")) self["key_yellow"] = StaticText(_("Restart")) self["key_blue"] = StaticText(_("Setup")) self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], { "cancel": self.cancel, "ok": self.ok, "green": self.start, "red": self.stop, "yellow": self.restart, "blue": self.setup }) self["status"] = Label() self["list"] = List([]) checkconfigdir() self.actcam = config.plugins.AltSoftcam.actcam.value self.camstartcmd = "" self.actcampng = LoadPixmap(resolveFilename(SCOPE_PLUGINS, "Extensions/AlternativeSoftCamManager/images/actcam.png")) self.defcampng = LoadPixmap(resolveFilename(SCOPE_PLUGINS, "Extensions/AlternativeSoftCamManager/images/defcam.png")) self.stoppingTimer = eTimer() self.stoppingTimer.timeout.get().append(self.stopping) self.closestopTimer = eTimer() self.closestopTimer.timeout.get().append(self.closestop) self.createinfo() self.Timer = eTimer() self.Timer.callback.append(self.listecminfo) self.Timer.start(2000, False)
def TunerEntry(name, module, started): if started: picture = LoadPixmap(cached = True, path = resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png")); else: picture = LoadPixmap(cached = True, path = resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_off.png")); return (name, module, picture)
def __init__(self, session, title="", **kwargs): Screen.__init__(self, session) self.setTitle(_("Virtual KeyBoard")) self.keys_list = [] self.shiftkeys_list = [] self.lang = language.getLanguage() self.nextLang = None self.shiftMode = False self.selectedKey = 0 self.smsChar = None self.sms = NumericalTextInput(self.smsOK) self.key_bg = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_bg.png")) self.key_sel = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_sel.png")) self.key_backspace = LoadPixmap(path=resolveFilename( SCOPE_ACTIVE_SKIN, "buttons/vkey_backspace.png")) self.key_all = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_all.png")) self.key_clr = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_clr.png")) self.key_esc = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_esc.png")) self.key_ok = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_ok.png")) self.key_shift = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_shift.png")) self.key_shift_sel = LoadPixmap(path=resolveFilename( SCOPE_ACTIVE_SKIN, "buttons/vkey_shift_sel.png")) self.key_space = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_space.png")) self.key_left = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_left.png")) self.key_right = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, "buttons/vkey_right.png")) self.keyImages = { "BACKSPACE": self.key_backspace, "ALL": self.key_all, "EXIT": self.key_esc, "OK": self.key_ok, "SHIFT": self.key_shift, "SPACE": self.key_space, "LEFT": self.key_left, "RIGHT": self.key_right } self.keyImagesShift = { "BACKSPACE": self.key_backspace, "CLEAR": self.key_clr, "EXIT": self.key_esc, "OK": self.key_ok, "SHIFT": self.key_shift_sel, "SPACE": self.key_space, "LEFT": self.key_left, "RIGHT": self.key_right } self["country"] = StaticText("") self["header"] = Label() self["text"] = Input(currPos=len( kwargs.get("text", "").decode("utf-8", 'ignore')), allMarked=False, **kwargs) self["list"] = VirtualKeyBoardList([]) self["actions"] = NumberActionMap( [ "OkCancelActions", "WizardActions", "ColorActions", "KeyboardInputActions", "InputBoxActions", "InputAsciiActions" ], { "gotAsciiCode": self.keyGotAscii, "ok": self.okClicked, "OKLong": self.okLongClicked, "cancel": self.exit, "left": self.left, "right": self.right, "up": self.up, "down": self.down, "red": self.exit, "green": self.ok, "yellow": self.switchLang, "blue": self.shiftClicked, "deleteBackward": self.backClicked, "deleteForward": self.forwardClicked, "back": self.exit, "pageUp": self.cursorRight, "pageDown": self.cursorLeft, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, "0": self.keyNumberGlobal, }, -2) self.setLang() self.onExecBegin.append(self.setKeyboardModeAscii) self.onLayoutFinish.append(self.buildVirtualKeyBoard) self.onClose.append(self.__onClose)
from os import environ from Plugins.Plugin import PluginDescriptor from Screens.Screen import Screen from Components.Console import Console as iConsole from Components.Language import language from Components.config import config, getConfigListEntry, ConfigText, ConfigInteger, ConfigSubsection, configfile, ConfigSelection, ConfigPassword, NoSave from Components.ConfigList import ConfigListScreen from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE from Components.Sources.StaticText import StaticText import os import gettext from os import environ lang = language.getLanguage() environ["LANGUAGE"] = lang[:2] gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE)) gettext.textdomain("enigma2") gettext.bindtextdomain("m2b", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/m2b/locale/")) def _(txt): t = gettext.dgettext("m2b", txt) if t == txt: t = gettext.gettext(txt) return t def get_m3u_name(): m3u_name = [] #dirs = os.listdir("/tmp/") dirs = os.listdir(config.plugins.m2b.path.value) for m3u_file in dirs: if m3u_file.endswith(".m3u") or m3u_file.endswith(".xml"):
# ####################################################################### from Components.VariableText import VariableText from enigma import eLabel, eEPGCache from Components.config import config from Components.Language import language from os import environ from Tools.Directories import resolveFilename, SCOPE_LANGUAGE, SCOPE_PLUGINS from Renderer import Renderer from time import localtime import gettext lang = language.getLanguage() environ["LANGUAGE"] = lang[:2] gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE)) gettext.textdomain("enigma2") gettext.bindtextdomain( "MyMetrixLite", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/MyMetrixLite/locale/")) def _(txt): t = gettext.dgettext("MyMetrixLite", txt) if t == txt: t = gettext.gettext(txt) return t class MetrixHDNextEvent(Renderer, VariableText): def __init__(self):
def skin_user_skinname(): name = "skin_user_" + config.skin.primary_skin.value[:config.skin.primary_skin.value.rfind('/')] + ".xml" filename = resolveFilename(SCOPE_CONFIG, name) if fileExists(filename): return name return None
def loadSingleSkinData(desktop, skin, path_prefix): """loads skin data like colors, windowstyle etc.""" assert skin.tag == "skin", "root element in skin must be 'skin'!" for c in skin.findall("output"): id = c.attrib.get('id') if id: id = int(id) else: id = 0 if id == 0: # framebuffer for res in c.findall("resolution"): get_attr = res.attrib.get xres = get_attr("xres") if xres: xres = int(xres) else: xres = 720 yres = get_attr("yres") if yres: yres = int(yres) else: yres = 576 bpp = get_attr("bpp") if bpp: bpp = int(bpp) else: bpp = 32 #print "Resolution:", xres,yres,bpp from enigma import gMainDC gMainDC.getInstance().setResolution(xres, yres) desktop.resize(eSize(xres, yres)) if bpp != 32: # load palette (not yet implemented) pass if yres >= 1080: parameters["FileListName"] = (68,4,1000,34) parameters["FileListIcon"] = (7,4,52,37) parameters["FileListMultiName"] = (90,3,1000,32) parameters["FileListMultiIcon"] = (45, 4, 30, 30) parameters["FileListMultiLock"] = (2,0,36,36) parameters["ChoicelistDash"] = (0,3,1000,30) parameters["ChoicelistName"] = (68,3,1000,30) parameters["ChoicelistIcon"] = (7,0,52,38) parameters["PluginBrowserName"] = (180,8,38) parameters["PluginBrowserDescr"] = (180,42,25) parameters["PluginBrowserIcon"] = (15,8,150,60) parameters["PluginBrowserDownloadName"] = (120,8,38) parameters["PluginBrowserDownloadDescr"] = (120,42,25) parameters["PluginBrowserDownloadIcon"] = (15,0,90,76) parameters["ServiceInfo"] = (0,0,450,50) parameters["ServiceInfoLeft"] = (0,0,450,45) parameters["ServiceInfoRight"] = (450,0,1000,45) parameters["SelectionListDescr"] = (45,3,1000,32) parameters["SelectionListLock"] = (0,2,36,36) parameters["ConfigListSeperator"] = 300 parameters["VirtualKeyboard"] = (68,68) parameters["PartnerBoxEntryListName"] = (8,2,225,38) parameters["PartnerBoxEntryListIP"] = (180,2,225,38) parameters["PartnerBoxEntryListPort"] = (405,2,150,38) parameters["PartnerBoxEntryListType"] = (615,2,150,38) parameters["PartnerBoxTimerServicename"] = (0,0,45) parameters["PartnerBoxTimerName"] = (0,42,30) parameters["PartnerBoxE1TimerTime"] = (0,78,255,30) parameters["PartnerBoxE1TimerState"] = (255,78,255,30) parameters["PartnerBoxE2TimerTime"] = (0,78,225,30) parameters["PartnerBoxE2TimerState"] = (225,78,225,30) parameters["PartnerBoxE2TimerIcon"] = (1050,8,20,20) parameters["PartnerBoxE2TimerIconRepeat"] = (1050,38,20,20) parameters["PartnerBoxBouquetListName"] = (0,0,45) parameters["PartnerBoxChannelListName"] = (0,0,45) parameters["PartnerBoxChannelListTitle"] = (0,42,30) parameters["PartnerBoxChannelListTime"] = (0,78,225,30) parameters["HelpMenuListHlp"] = (0,0,900,42) parameters["HelpMenuListExtHlp0"] = (0,0,900,39) parameters["HelpMenuListExtHlp1"] = (0,42,900,30) parameters["AboutHddSplit"] = 1 parameters["DreamexplorerName"] = (62,0,1200,38) parameters["DreamexplorerIcon"] = (15,4,30,30) parameters["PicturePlayerThumb"] = (30,285,45,300,30,25) parameters["PlayListName"] = (38,2,1000,34) parameters["PlayListIcon"] = (7,7,24,24) parameters["SHOUTcastListItem"] = (30,27,35,96,35,33,60,32) for skininclude in skin.findall("include"): filename = skininclude.attrib.get("filename") if filename: skinfile = resolveFilename(SCOPE_CURRENT_SKIN, filename, path_prefix=path_prefix) if not fileExists(skinfile): skinfile = resolveFilename(SCOPE_SKIN_IMAGE, filename, path_prefix=path_prefix) if fileExists(skinfile): print "[SKIN] loading include:", skinfile loadSkin(skinfile) for c in skin.findall("colors"): for color in c.findall("color"): get_attr = color.attrib.get name = get_attr("name") color = get_attr("value") if name and color: colorNames[name] = parseColor(color) #print "Color:", name, color else: raise SkinError("need color and name, got %s %s" % (name, color)) for c in skin.findall("fonts"): for font in c.findall("font"): get_attr = font.attrib.get filename = get_attr("filename", "<NONAME>") name = get_attr("name", "Regular") scale = get_attr("scale") if scale: scale = int(scale) else: scale = 100 is_replacement = get_attr("replacement") and True or False render = get_attr("render") if render: render = int(render) else: render = 0 resolved_font = resolveFilename(SCOPE_FONTS, filename, path_prefix=path_prefix) if not fileExists(resolved_font): #when font is not available look at current skin path skin_path = resolveFilename(SCOPE_CURRENT_SKIN, filename) if fileExists(skin_path): resolved_font = skin_path addFont(resolved_font, name, scale, is_replacement, render) #print "Font: ", resolved_font, name, scale, is_replacement for alias in c.findall("alias"): get = alias.attrib.get try: name = get("name") font = get("font") size = int(get("size")) height = int(get("height", size)) # to be calculated some day width = int(get("width", size)) global fonts fonts[name] = (font, size, height, width) except Exception, ex: print "[SKIN] bad font alias", ex
# we do our best to always select the "right" value # skins are loaded in order of priority: skin with # highest priority is loaded last, usually the user-provided # skin. # currently, loadSingleSkinData (colors, bordersets etc.) # are applied one-after-each, in order of ascending priority. # the dom_skin will keep all screens in descending priority, # so the first screen found will be used. # example: loadSkin("nemesis_greenline/skin.xml") config.skin = ConfigSubsection() DEFAULT_SKIN = "GigabluePax/skin.xml" # DEFAULT_SKIN = SystemInfo["HasFullHDSkinSupport"] and "PLi-FullNightHD/skin.xml" or "PLi-HD/skin.xml" # on SD hardware, PLi-HD will not be available if not fileExists(resolveFilename(SCOPE_SKIN, DEFAULT_SKIN)): DEFAULT_SKIN = "om-black/skin.xml" config.skin.primary_skin = ConfigText(default=DEFAULT_SKIN) profile("LoadSkin") res = None name = skin_user_skinname() if name: res = addSkin(name, SCOPE_CONFIG) if not name or not res: addSkin('skin_user.xml', SCOPE_CONFIG) # some boxes lie about their dimensions addSkin('skin_box.xml') # add optional discrete second infobar
from Screens.MessageBox import MessageBox from Screens.Standby import TryQuitMainloop from Components.ActionMap import ActionMap from Components.Language import language from Components.Sources.StaticText import StaticText from Components.ConfigList import ConfigListScreen from Components.config import config, ConfigSubsection, getConfigListEntry, ConfigSelection from Tools.Directories import fileExists from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE from os import system, environ import gettext import os lang = language.getLanguage() environ["LANGUAGE"] = lang[:2] gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE)) gettext.textdomain("enigma2") gettext.bindtextdomain("SetupTechnoHD", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/SetupTechnoHD/locale")) def _(txt): t = gettext.dgettext("SetupTechnoHD", txt) if t == txt: t = gettext.gettext(txt) return t def SearchReplaceWrite(skinPartSearchAndReplace, source, target): inFile = open(source, "r") file_lines = inFile.readlines() inFile.close() outFile = open(target, "w") for skinLine in file_lines:
def localeInit(): gettext.bindtextdomain( "StartUpService", resolveFilename(SCOPE_PLUGINS, "SystemPlugins/StartUpService/locale"))
def updateList(self): self.list = [] mypath = resolveFilename(SCOPE_CURRENT_SKIN, "") if mypath == "/usr/share/enigma2/": mypath = "/usr/share/enigma2/skin_default/" mypixmap = mypath + "icons/infopanel_space.png" png = LoadPixmap(mypixmap) name = _("Devices Manager & Mountpoints") idx = 0 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/mountwizard.png" png = LoadPixmap(mypixmap) name = _("Network Browser & Mountpoints") idx = 1 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_samba.png" png = LoadPixmap(mypixmap) name = _("Dlna Browser & UPnP Client") idx = 2 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_samba.png" png = LoadPixmap(mypixmap) name = _("Dlna Server Minidlna") idx = 3 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_space.png" png = LoadPixmap(mypixmap) name = _("Usb Format Wizard") idx = 4 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/swapsettings.png" png = LoadPixmap(mypixmap) name = _("Swap File settings") idx = 5 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_osd.png" png = LoadPixmap(mypixmap) name = _("Osd settings") idx = 6 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_osd.png" png = LoadPixmap(mypixmap) name = _("Osd Position setup") idx = 7 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_osd.png" png = LoadPixmap(mypixmap) name = _("Osd 3D setup") idx = 8 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_samba.png" png = LoadPixmap(mypixmap) name = _("Internal Epg settings") idx = 9 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_cron.png" png = LoadPixmap(mypixmap) name = _("Record settings") idx = 10 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_space.png" png = LoadPixmap(mypixmap) name = _("Recording paths") idx = 11 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/infopanel_kmod.png" png = LoadPixmap(mypixmap) name = _("Subtitle settings") idx = 12 res = (name, png, idx) self.list.append(res) mypixmap = mypath + "icons/inadynsettings.png" png = LoadPixmap(mypixmap) name = _("Auto language settings") idx = 13 res = (name, png, idx) self.list.append(res) self["list"].list = self.list
from Components.Pixmap import Pixmap from Components.ProgressBar import ProgressBar from Components.ServiceEventTracker import ServiceEventTracker from Components.Sources.StaticText import StaticText from Tools.Directories import resolveFilename, SCOPE_PLUGINS from enigma import eTimer, ePicLoad, iPlayableService from .SCConfig import StalkerClient_SetupScreen from .SCEPG import StalkerClient_EPGSelection, StalkerClient_EventViewEPGSelect, StalkerEvent from .SCInfo import scthreads from .stalkerclient import stalker from time import localtime, strftime, time PLUGIN_PATH = resolveFilename(SCOPE_PLUGINS, "Extensions/StalkerClient") class StalkerClient_Player(Screen, InfoBarNotifications): skin_default_1080p = """ <screen name="stalkerclientplayer" flags="wfNoBorder" position="0,830" size="1920,250" title="StalkerClient Player" backgroundColor="#41000000" > <ePixmap position="270,40" size="117,72" pixmap="%s/channel_background.png" zPosition="-1" transparent="1" alphatest="blend" /> <widget name="channel_icon" position="311,58" zPosition="10" size="35,35" backgroundColor="#41000000" /> <widget name="channel_name" position="440,30" size="1010,60" font="Regular;48" halign="left" valign="center" foregroundColor="#ffffff" backgroundColor="#41000000" /> <widget name="channel_uri" position="440,100" size="1010,40" font="Regular;30" halign="left" valign="top" foregroundColor="#f4df8d" backgroundColor="#41000000" /> <widget name="eventNow_time" position="270,150" size="125,45" font="Regular;30" halign="center" valign="center" foregroundColor="#9c9c9c" backgroundColor="#41000000" /> <widget name="eventNow_name" position="440,150" size="830,45" font="Regular;32" halign="left" valign="center" foregroundColor="#9c9c9c" backgroundColor="#41000000" noWrap="1" /> <widget name="eventNow_remaining" position="1280,150" size="150,45" font="Regular;30" halign="right" valign="center" foregroundColor="#9c9c9c" backgroundColor="#41000000" /> <widget name="eventNext_time" position="270,195" size="125,45" font="Regular;30" halign="center" valign="center" foregroundColor="#9c9c9c" backgroundColor="#41000000" /> <widget name="eventNext_name" position="440,195" size="830,45" font="Regular;32" halign="left" valign="center" foregroundColor="#9c9c9c" backgroundColor="#41000000" noWrap="1" /> <widget name="eventNext_duration" position="1280,195" size="150,45" font="Regular;30" halign="right" valign="center" foregroundColor="#9c9c9c" backgroundColor="#41000000" />
if plz and ort: name += plz + ' ' + ort elif plz: name += plz elif ort: name += ort print(name) def simpleout(number, caller): # @UnusedVariable # pylint: disable=W0613 print(caller) try: reverseLookupFileName = resolveFilename( SCOPE_PLUGINS, "Extensions/FritzCall/reverselookup.xml") except ImportError: reverseLookupFileName = "reverselookup.xml" countries = {} reverselookupMtime = 0 class ReverseLookupAndNotifier(object): def __init__(self, number, outputFunction=out, charset="cp1252", countrycode="0049"): debug("reverse Lookup for %s!", number) if not countrycode:
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists( "/dev/dbox/lcd0") SystemInfo["LCDsymbol_circle_recording"] = fileCheck( "/proc/stb/lcd/symbol_circle") or getBoxType() in ( "hd51", "vs1500") and fileCheck("/proc/stb/lcd/symbol_recording") SystemInfo["LCDsymbol_timeshift"] = fileCheck("/proc/stb/lcd/symbol_timeshift") SystemInfo["LCDshow_symbols"] = (getBoxType().startswith("et9") or getBoxType() in ("hd51", "vs1500") ) and fileCheck("/proc/stb/lcd/show_symbols") SystemInfo["LCDsymbol_hdd"] = getBoxType() in ( "hd51", "vs1500") and fileCheck("/proc/stb/lcd/symbol_hdd") SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0") SystemInfo["LcdDisplay"] = fileExists("/dev/dbox/lcd0") SystemInfo["DeepstandbySupport"] = getBoxType() != "dm800" SystemInfo["OledDisplay"] = fileExists( resolveFilename(SCOPE_SKIN, 'lcd_skin/skin_lcd_default.xml')) SystemInfo["GraphicLCD"] = getBoxType() in ('quadbox2400') SystemInfo["GBWOL"] = fileExists("/usr/bin/gigablue_wol") SystemInfo["Fan"] = fileCheck("/proc/stb/fp/fan") SystemInfo["FanPWM"] = SystemInfo["Fan"] and fileCheck("/proc/stb/fp/fan_pwm") SystemInfo["StandbyLED"] = fileCheck("/proc/stb/power/standbyled") SystemInfo["PowerOffDisplay"] = getBoxType() not in ( 'formuler1') and fileCheck("/proc/stb/power/vfd") or fileCheck( "/proc/stb/lcd/vfd") #SystemInfo["WakeOnLAN"] = not HardwareInfo().get_device_model().startswith("et8000") and fileCheck("/proc/stb/power/wol") or fileCheck("/proc/stb/fp/wol") SystemInfo["HasExternalPIP"] = getMachineBuild() not in ( 'et9x00', 'et6x00', 'et5x00') and fileCheck("/proc/stb/vmpeg/1/external") SystemInfo["VideoDestinationConfigurable"] = fileExists( "/proc/stb/vmpeg/0/dst_left") SystemInfo["hasPIPVisibleProc"] = fileCheck("/proc/stb/vmpeg/1/visible") SystemInfo["hasTuners"] = getHasTuners() or fileCheck(
def localeInit(): gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
from Components.Label import Label from Components.Language import language from os import environ, listdir, remove, rename, system from skin import parseColor from Components.Pixmap import Pixmap from Components.Label import Label import gettext from enigma import ePicLoad from Tools.Directories import fileExists, resolveFilename, SCOPE_LANGUAGE, SCOPE_PLUGINS from Plugins.Extensions.Infopanel.Manager import NFRCamManager ############################################################# lang = language.getLanguage() environ["LANGUAGE"] = lang[:2] gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE)) gettext.textdomain("enigma2") gettext.bindtextdomain("OscamSmartcard", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/Infopanel/data/locale/")) def _(txt): t = gettext.dgettext("OscamSmartcard", txt) if t == txt: t = gettext.gettext(txt) return t def translateBlock(block): for x in TranslationHelper: if block.__contains__(x[0]): block = block.replace(x[0], x[1]) return block
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists( "/dev/dbox/lcd0") SystemInfo["LCDsymbol_circle_recording"] = fileCheck( "/proc/stb/lcd/symbol_circle") or getBoxType() in ( "hd51", "vs1500") and fileCheck("/proc/stb/lcd/symbol_recording") SystemInfo["LCDsymbol_timeshift"] = fileCheck("/proc/stb/lcd/symbol_timeshift") SystemInfo["LCDshow_symbols"] = (getBoxType().startswith("et9") or getBoxType() in ("hd51", "vs1500") ) and fileCheck("/proc/stb/lcd/show_symbols") SystemInfo["LCDsymbol_hdd"] = getBoxType() in ( "hd51", "vs1500") and fileCheck("/proc/stb/lcd/symbol_hdd") SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0") SystemInfo["LcdDisplay"] = fileExists("/dev/dbox/lcd0") SystemInfo["DeepstandbySupport"] = getBoxType() != "dm800" SystemInfo["OledDisplay"] = fileExists( resolveFilename(SCOPE_SKIN, 'display/lcd_skin/skin_lcd_default.xml')) SystemInfo["GraphicLCD"] = getBoxType() in ('quadbox2400', ) SystemInfo["GBWOL"] = fileExists("/usr/bin/gigablue_wol") SystemInfo["Fan"] = fileCheck("/proc/stb/fp/fan") SystemInfo["FanPWM"] = SystemInfo["Fan"] and fileCheck("/proc/stb/fp/fan_pwm") SystemInfo["PowerLED"] = fileCheck("/proc/stb/power/powerled") SystemInfo["StandbyLED"] = fileCheck("/proc/stb/power/standbyled") SystemInfo["SuspendLED"] = fileCheck("/proc/stb/power/suspendled") SystemInfo[ "Display"] = SystemInfo["FrontpanelDisplay"] or SystemInfo["StandbyLED"] SystemInfo["LedPowerColor"] = fileCheck("/proc/stb/fp/ledpowercolor") SystemInfo["LedStandbyColor"] = fileCheck("/proc/stb/fp/ledstandbycolor") SystemInfo["LedSuspendColor"] = fileCheck("/proc/stb/fp/ledsuspendledcolor") SystemInfo["Power4x7On"] = fileCheck("/proc/stb/fp/power4x7on") SystemInfo["Power4x7Standby"] = fileCheck("/proc/stb/fp/power4x7standby") SystemInfo["Power4x7Suspend"] = fileCheck("/proc/stb/fp/power4x7suspend")
def languageChanged(): plugins.clearPluginList() plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
def getDir(self, currentVal=None, defaultDir=None): if currentVal: return (currentVal.rstrip("/").rsplit("/", 1))[0] return defaultDir or (resolveFilename(SCOPE_PLUGINS) + "Extensions/DVDBurn/")
from enigma import eTimer, iPlayableService, iServiceInformation, eServiceReference, iServiceKeys, getDesktop from Screens.Screen import Screen from Screens.InfoBarGenerics import * from Screens.InfoBar import InfoBar from Screens.MessageBox import MessageBox from Screens.HelpMenu import HelpableScreen from Tools.BoundFunction import boundFunction from Tools.Directories import fileExists, resolveFilename, SCOPE_LANGUAGE, SCOPE_PLUGINS from EnhancedMovieCenter import _ from EMCTasker import emcDebugOut from DelayedFunction import DelayedFunction from MovieCenter import sidDVD, sidDVB SeekbarPlg = "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/Seekbar/plugin.py") # Overwrite Seekbar def EMCkeyOK(self): sel = self["config"].getCurrent()[1] if sel == self.positionEntry: if self.length: # seekTo() doesn't work for DVD Player oldPosition = self.seek.getPlayPosition()[1] newPosition = int(float(self.length[1]) / 100.0 * self.percent) if newPosition > oldPosition: pts = newPosition - oldPosition else: pts = -1 * (oldPosition - newPosition)
def __init__(self, eventList): GUIComponent.__init__(self) self.l = eListboxPythonMultiContent() self.l.setFont(0, gFont("Regular", 18)) self.l.setBuildFunc(self.buildResultEntry) self.l.setItemHeight(150) self.onSelectionChanged = [] self.resultlist = LoadPixmap( cached=True, path=resolveFilename( SCOPE_PLUGIN, 'Extensions/PrimeTimeManager/images/resultlist.png'), desktop=getDesktop(0)) self.favoritePixmap = LoadPixmap( cached=True, path=resolveFilename( SCOPE_PLUGIN, 'Extensions/PrimeTimeManager/images/favorite.png'), desktop=getDesktop(0)) self.clockPixmap = LoadPixmap( cached=True, path=resolveFilename( SCOPE_PLUGIN, 'Extensions/PrimeTimeManager/images/epgclock.png'), desktop=getDesktop(0)) self.clockOverlap = LoadPixmap( cached=True, path=resolveFilename( SCOPE_PLUGIN, 'Extensions/PrimeTimeManager/images/clockOverlap.png'), desktop=getDesktop(0)) self.clockNotrecord = LoadPixmap( cached=True, path=resolveFilename( SCOPE_PLUGIN, 'Extensions/PrimeTimeManager/images/clockNotrecord.png'), desktop=getDesktop(0)) self.noConflictPixmap = LoadPixmap( cached=True, path=resolveFilename( SCOPE_PLUGIN, 'Extensions/PrimeTimeManager/images/noConflict.png'), desktop=getDesktop(0)) self.arrowRightPixmap = LoadPixmap( cached=True, path=resolveFilename( SCOPE_PLUGIN, 'Extensions/PrimeTimeManager/images/right.png'), desktop=getDesktop(0)) self.deletePixmap = LoadPixmap( cached=True, path=resolveFilename( SCOPE_PLUGIN, 'Extensions/PrimeTimeManager/images/delete.png'), desktop=getDesktop(0)) if AUTOTIMER and config.plugins.PrimeTimeManager.UseAutotimer.value: self.autotimerPixmap = LoadPixmap( cached=True, path=resolveFilename(SCOPE_PLUGIN, 'Extensions/AutoTimer/plugin.png'), desktop=getDesktop(0)) self.l.setList(eventList) self.digitList = [] i = 0 while i <= 10: name = 'Extensions/PrimeTimeManager/images/digit_' + str( i) + '.png' digitPixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGIN, name), desktop=getDesktop(0)) self.digitList.append(digitPixmap) i += 1
def getRcFile(self, ext): remote = getRCName() f = resolveFilename(SCOPE_SKIN, 'rc_models/' + remote + '.' + ext) if not os.path.exists(f): f = resolveFilename(SCOPE_SKIN, 'rc_models/dmm1.' + ext) return f
def activateLanguage(self, index): try: if index not in self.lang: print "[Language] Selected language %s is not installed, fallback to en_US!" % index index = "en_US" Notifications.AddNotification( MessageBox, _("The selected langugage is unavailable - using en_US"), MessageBox.TYPE_INFO, timeout=3) lang = self.lang[index] print "[Language] Activating language " + lang[0] self.catalog = gettext.translation('enigma2', resolveFilename( SCOPE_LANGUAGE, ""), languages=[index], fallback=True) self.catalog.install(names=("ngettext", "pgettext")) self.activeLanguage = index for x in self.callbacks: if x: x() except: print "[Language] Selected language does not exist!" # These should always be C.UTF-8 (or POSIX if C.UTF-8 is unavaible) or program code might behave # differently depending on language setting try: locale.setlocale(locale.LC_CTYPE, ('C', 'UTF-8')) except: pass try: locale.setlocale(locale.LC_COLLATE, ('C', 'UTF-8')) except: try: locale.setlocale(locale.LC_COLLATE, ('POSIX', '')) except: pass # NOTE: we do not use LC_ALL, because LC_ALL will not set any of the categories, when one of the categories fails. # We'd rather try to set all available categories, and ignore the others for category in [ locale.LC_TIME, locale.LC_MONETARY, locale.LC_MESSAGES, locale.LC_NUMERIC ]: try: locale.setlocale(category, (self.getLanguage(), 'UTF-8')) except: pass # Also write a locale.conf as /home/root/.config/locale.conf to apply language to interactive shells as well: try: os.stat('/home/root/.config') except: os.mkdir('/home/root/.config') localeconf = open('/home/root/.config/locale.conf', 'w') for category in [ "LC_TIME", "LC_DATE", "LC_MONETARY", "LC_MESSAGES", "LC_NUMERIC", "LC_NAME", "LC_TELEPHONE", "LC_ADDRESS", "LC_PAPER", "LC_IDENTIFICATION", "LC_MEASUREMENT", "LANG" ]: if category == "LANG" or (category == "LC_DATE" and os.path.exists( '/usr/lib/locale/' + self.getLanguage() + '/LC_TIME')) or os.path.exists('/usr/lib/locale/' + self.getLanguage() + '/' + category): localeconf.write('export %s="%s.%s"\n' % (category, self.getLanguage(), "UTF-8")) else: if os.path.exists('/usr/lib/locale/C.UTF-8/' + category): localeconf.write('export %s="C.UTF-8"\n' % category) else: localeconf.write('export %s="POSIX"\n' % category) localeconf.close() # HACK: sometimes python 2.7 reverts to the LC_TIME environment value, so make sure it has the correct value os.environ["LC_TIME"] = self.getLanguage() + '.UTF-8' os.environ["LANGUAGE"] = self.getLanguage() + '.UTF-8' os.environ[ "GST_SUBTITLE_ENCODING"] = self.getGStreamerSubtitleEncoding()
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins( PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from %s import %s" % (selected[1], selected[2]) exec "self.session.open(%s)" % ",".join(selected[2:]) except Exception as e: print "[Hotkey] error during executing module %s, screen %s, %s" % ( selected[1], selected[2], e) import traceback traceback.print_exc() elif selected[0] == "SoftcamSetup" and SystemInfo[ "HasSoftcamInstalled"]: from Screens.SoftcamSetup import SoftcamSetup self.session.open(SoftcamSetup) elif selected[0] == "Setup": from Screens.Setup import Setup exec "self.session.open(Setup, \"%s\")" % selected[1] elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent( eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join( selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir( resolveFilename(SCOPE_PLUGINS, 'Extensions/PPanel')): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command): if ".hidden." in command: from enigma import eConsoleAppContainer eConsoleAppContainer().execute(command) else: from Screens.Console import Console self.session.open( Console, selected[1] + " shellscript", command, closeOnSuccess=selected[1].startswith('!'), showStartStopText=False) elif selected[0] == "Menu": from Screens.Menu import MainMenu, mdom root = mdom.getroot() for x in root.findall("menu"): y = x.find("id") if y is not None: id = y.get("val") if id and id == selected[1]: menu_screen = self.session.open(MainMenu, x) break
from enigma import ePicLoad, eTimer, getDesktop from Plugins.Plugin import PluginDescriptor from Screens.Screen import Screen from Tools.Directories import resolveFilename, pathExists, fileExists, SCOPE_MEDIA import os def getScale(): return AVSwitch().getFramebufferScale() config.pic = ConfigSubsection() config.pic.framesize = ConfigInteger(default=30, limits=(5, 99)) config.pic.slidetime = ConfigInteger(default=5, limits=(1, 60)) config.pic.resize = ConfigSelection(default="1", choices = [("0", _("simple")), ("1", _("better"))]) config.pic.cache = ConfigEnableDisable(default=True) config.pic.lastDir = ConfigText(default=resolveFilename(SCOPE_MEDIA)) config.pic.infoline = ConfigEnableDisable(default=True) config.pic.loop = ConfigEnableDisable(default=True) config.pic.bgcolor = ConfigSelection(default="#00000000", choices = [("#00000000", _("black")),("#009eb9ff", _("blue")),("#00ff5a51", _("red")), ("#00ffe875", _("yellow")), ("#0038FF48", _("green"))]) config.pic.textcolor = ConfigSelection(default="#0038FF48", choices = [("#00000000", _("black")),("#009eb9ff", _("blue")),("#00ff5a51", _("red")), ("#00ffe875", _("yellow")), ("#0038FF48", _("green"))]) config.pic.separator = NoSave(ConfigNothing()) try: from PIL import Image, ExifTags config.pic.autoRotate = NoSave(ConfigEnableDisable(default=True)) except Exception: config.pic.autoRotate = NoSave(ConfigEnableDisable(default=False)) def autorotate(path): image = Image.open(path) try:
from MenuList import MenuList from Tools.Directories import resolveFilename, SCOPE_ACTIVE_SKIN from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_VALIGN_CENTER, getDesktop from Tools.LoadPixmap import LoadPixmap import skin selectiononpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "icons/lock_on.png")) selectionoffpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "icons/lock_off.png")) def SelectionEntryComponent(description, value, index, selected): screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth == 1920: dx, dy, dw, dh = skin.parameters.get("SelectionListDescr",(80, 5, 900, 55)) res = [ (description, value, index, selected), (eListboxPythonMultiContent.TYPE_TEXT, dx, dy, dw, dh, 1, RT_HALIGN_LEFT, description) ] else: dx, dy, dw, dh = skin.parameters.get("SelectionListDescr",(25, 3, 650, 30)) res = [ (description, value, index, selected), (eListboxPythonMultiContent.TYPE_TEXT, dx, dy, dw, dh, 0, RT_HALIGN_LEFT, description) ] if selected: if screenwidth and screenwidth == 1920: ix, iy, iw, ih = skin.parameters.get("SelectionListLock",(10, 5, 50, 50)) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, ix, iy, iw, ih, selectiononpng)) else: ix, iy, iw, ih = skin.parameters.get("SelectionListLock",(0, 2, 25, 24)) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, ix, iy, iw, ih, selectiononpng)) else:
from CutListSupport import CutList from InfoBarSupport import InfoBarSupport from Components.Sources.EMCCurrentService import EMCCurrentService from ServiceSupport import ServiceCenter # Cover from Components.AVSwitch import AVSwitch from Components.Pixmap import Pixmap from enigma import ePicLoad from MovieCenter import sidDVD, sidDVB, toggleProgressService, getPosterPath from RecordingsControl import getRecording import NavigationInstance dvdPlayerPlg = "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/DVDPlayer/plugin.py") class EMCMoviePlayerSummary(Screen): def __init__(self, session, parent): Screen.__init__(self, session, parent) if hasattr(config.misc, "boxtype") and config.misc.boxtype.value == 'gbquad': self.skinName = ["EMCMoviePlayerSummaryGBHDQ"] else: self.skinName = ["EMCMoviePlayerSummary"] self["Service"] = EMCCurrentService(session.nav, parent) def getSkin():
# -*- coding: UTF-8 -*- import gettext import locale import os from time import time, localtime, strftime from Tools.Directories import SCOPE_LANGUAGE, resolveFilename LPATH = resolveFilename(SCOPE_LANGUAGE, "") Lpackagename = "enigma2-locale-" class Language: def __init__(self): gettext.install('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), unicode=0, codeset="utf-8") gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE)) gettext.textdomain("enigma2") self.activeLanguage = 0 self.catalog = None self.lang = {} self.InitLang() self.callbacks = [] def InitLang(self): self.langlist = [] self.langlistselection = [] self.ll = os.listdir(LPATH) # FIXME make list dynamically # name, iso-639 language, iso-3166 country. Please don't mix language&country!
def buildTimerEntry(self, timer, processed): screenwidth = getDesktop(0).size().width() height = self.l.getItemSize().height() width = self.l.getItemSize().width() res = [None] x = width / 2 res.append((eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, 3, width, self.rowSplit, 0, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, gettimerType(timer))) if timer.timerType == TIMERTYPE.AUTOSTANDBY or timer.timerType == TIMERTYPE.AUTODEEPSTANDBY: if self.iconRepeat and timer.autosleeprepeat != "once": res.append( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, self.rowSplit + (self.itemHeight - self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, self.iconRepeat)) icon = None if not processed: if timer.state == TimerEntry.StateWaiting: state = _("waiting") icon = self.iconWait elif timer.state == TimerEntry.StatePrepared or timer.state == TimerEntry.StateRunning: state = _("running...") icon = self.iconZapped elif timer.state == TimerEntry.StateEnded: state = _("done!") icon = self.iconDone else: state = _("<unknown>") icon = None else: state = _("done!") icon = self.iconDone autosleepwindow = "" if timer.autosleepwindow == 'yes': autosleepwindow = _("Time range:") + " " + FuzzyTime( timer.autosleepbegin)[1] + " ... " + FuzzyTime( timer.autosleepend)[1] + ", " res.append((eListboxPythonMultiContent.TYPE_TEXT, 150, 26, width - 150, self.itemHeight - self.rowSplit, 2, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, autosleepwindow + _("Delay:") + " " + str(timer.autosleepdelay) + "(" + _("mins") + ")")) else: res.append((eListboxPythonMultiContent.TYPE_TEXT, x + 24, 2, x - 2 - 24, self.itemHeight - self.rowSplit, 1, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, _('At End:') + ' ' + getafterEvent(timer))) days = (_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun")) begin = FuzzyTime(timer.begin) if timer.repeated: repeatedtext = [] flags = timer.repeated for x in (0, 1, 2, 3, 4, 5, 6): if flags & 1 == 1: repeatedtext.append(days[x]) flags >>= 1 if repeatedtext == [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ]: repeatedtext = _('Everyday') elif repeatedtext == [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri") ]: repeatedtext = _('Weekday') elif repeatedtext == [_("Sat"), _("Sun")]: repeatedtext = _('Weekend') else: repeatedtext = ", ".join(repeatedtext) if self.iconRepeat: res.append( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 2, self.rowSplit, 20, 20, self.iconRepeat)) else: repeatedtext = begin[0] # date text = repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)) res.append( (eListboxPythonMultiContent.TYPE_TEXT, 150, self.itemHeight - self.rowSplit, width - 150, self.rowSplit, 1, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, text)) icon = None if not processed: if timer.state == TimerEntry.StateWaiting: state = _("waiting") icon = self.iconWait elif timer.state == TimerEntry.StatePrepared: state = _("about to start") icon = self.iconPrepared elif timer.state == TimerEntry.StateRunning: state = _("running...") icon = self.iconZapped elif timer.state == TimerEntry.StateEnded: state = _("done!") icon = self.iconDone else: state = _("<unknown>") icon = None else: state = _("done!") icon = self.iconDone if timer.disabled: state = _("disabled") icon = self.iconDisabled if timer.failed: state = _("failed") icon = self.iconFailed res.append((eListboxPythonMultiContent.TYPE_TEXT, self.iconMargin + self.iconWidth, self.rowSplit, 150, height - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, state)) icon and res.append( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, (self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, icon)) line = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "div-h.png")) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0, height - 2, width, 2, line)) return res
def SaveList(list): jw = open(resolveFilename(SCOPE_PLUGINS, 'Extensions/NGsetting/Moduli/NGsetting/SelectBack'), 'w') for dir, name in list: jw.write(dir+'---'+name+'\n') jw.close()
def __init__(self, type=EPG_TYPE_SINGLE, selChangedCB=None, timer=None): self.days = (_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun")) self.timer = timer self.onSelChanged = [] if selChangedCB is not None: self.onSelChanged.append(selChangedCB) GUIComponent.__init__(self) self.type = type self.l = eListboxPythonMultiContent() self.eventItemFont = gFont("Regular", 22) self.eventTimeFont = gFont("Regular", 16) self.iconSize = 21 self.iconDistance = 2 self.colGap = 10 self.skinColumns = False self.tw = 90 self.dy = 0 if type == EPG_TYPE_SINGLE: self.l.setBuildFunc(self.buildSingleEntry) elif type == EPG_TYPE_MULTI: self.l.setBuildFunc(self.buildMultiEntry) else: assert (type == EPG_TYPE_SIMILAR) self.l.setBuildFunc(self.buildSimilarEntry) self.epgcache = eEPGCache.getInstance() self.clocks = [ LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_add.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_pre.png')), LoadPixmap( cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_prepost.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_post.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/zapclock_add.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/zapclock_pre.png')), LoadPixmap( cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/zapclock.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/zapclock_prepost.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/zapclock_post.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/zaprecclock_add.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/zaprecclock_pre.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/zaprecclock.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/zaprecclock_prepost.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/zaprecclock_post.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repepgclock_add.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repepgclock_pre.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repepgclock.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repepgclock_prepost.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repepgclock_post.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzapclock_add.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzapclock_pre.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzapclock.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzapclock_prepost.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzapclock_post.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzaprecclock_add.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzaprecclock_pre.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzaprecclock.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzaprecclock_prepost.png')), LoadPixmap(cached=True, path=resolveFilename( SCOPE_CURRENT_SKIN, 'skin_default/icons/repzaprecclock_post.png')) ]
def changed(self, what): if self.instance: pngname = '' if (what[0] != self.CHANGED_CLEAR): sname = "" service = self.source.service if service: feinfo = (service and service.frontendInfo()) if feinfo: frontendData = feinfo.getAll(True) if frontendData.get("tuner_type") == "DVB-S": try: sname = { 3590: "10W", 3560: "40W", 3550: "50W", 3530: "70W", 3520: "80W", 3475: "125W", 3460: "140W", 3450: "150W", 3420: "180W", 3380: "220W", 3355: "245W", 3325: "275W", 3300: "300W", 3285: "315W", 3170: "430W", 3150: "450W", 3070: "530W", 3045: "555W", 3020: "580W", 2990: "610W", 2900: "700W", 2880: "720W", 2875: "727W", 2860: "740W", 2810: "790W", 2780: "820W", 2690: "910W", 3592: "08W", 2985: "615W", 2830: "770W", 2630: "970W", 2500: "1100W", 2502: "1100W", 2410: "1190W", 2391: "1210W", 2390: "1210W", 2412: "1190W", 2310: "1290W", 2311: "1290W", 2120: "1480W", 1100: "1100E", 1101: "1100E", 1131: "1130E", 1440: "1440E", 1006: "1005E", 1030: "1030E", 1056: "1055E", 1082: "1082E", 881: "880E", 900: "900E", 901: "901E", 917: "915E", 950: "950E", 951: "950E", 765: "765E", 785: "785E", 800: "800E", 830: "830E", 852: "852E", 850: "850E", 750: "750E", 720: "720E", 705: "705E", 685: "685E", 620: "620E", 600: "600E", 570: "570E", 560: "560E", 530: "530E", 480: "480E", 450: "450E", 420: "420E", 400: "400E", 390: "390E", 380: "380E", 360: "360E", 335: "335E", 330: "330E", 328: "328E", 315: "315E", 310: "310E", 305: "305E", 285: "285E", 284: "282E", 282: "282E", 1220: "1220E", 1380: "1380E", 260: "260E", 255: "255E", 235: "235E", 215: "215E", 216: "216E", 210: "210E", 192: "192E", 160: "160E", 130: "130E", 100: "100E", 90: "90E", 70: "70E", 50: "50E", 49: "48E", 48: "48E", 30: "30E" }[frontendData.get("orbital_position", "None")] except Exception as e: pass pos = sname.rfind(':') if (pos != -1): sname = sname[:pos].rstrip(':').replace(':', '_') pngname = self.nameCache.get(sname, '') if (pngname == ''): pngname = self.findPicon(sname) if (pngname != ''): self.nameCache[sname] = pngname if (pngname == ''): pngname = self.nameCache.get('default', '') if (pngname == ''): tmp = resolveFilename(SCOPE_CURRENT_SKIN, self.picon_default) if fileExists(tmp): pngname = tmp else: pngname = resolveFilename( SCOPE_SKIN_IMAGE, 'skin_default/picon_default.png') self.nameCache['default'] = pngname if self.pngname != pngname: if pngname: self.instance.setScale(1) self.instance.setPixmapFromFile(pngname) self.instance.show()