示例#1
0
文件: FileList.py 项目: zukon/enigma2
def MultiFileSelectEntryComponent(name, absolute=None, isDir=False, selected=False):
	res = [(absolute, isDir, selected, name)]
	if not name.startswith("<"):
		if selected:
			icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "icons/lock_on.png"))
		else:
			icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "icons/lock_off.png"))
		x, y, w, h = parameters.get("FileListMultiLock", applySkinFactor(2, 0, 25, 25))
		res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, icon))

	if isDir:
		png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "extensions/directory.png"))
	else:
		extension = name.split(".")
		extension = extension[-1].lower()
		if extension in EXTENSIONS:
			png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" + EXTENSIONS[extension] + ".png"))
		else:
			png = None

	if png is not None:
		x, y, w, h = parameters.get("FileListMultiIcon", applySkinFactor(30, 2, 20, 20))
		res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, png))
		x, y, w, h = parameters.get("FileListMultiName", applySkinFactor(55, 0, 470, 25))
		res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, name))
	else:
		x1, y1, w1, h1 = parameters.get("FileListMultiIcon", applySkinFactor(30, 2, 20, 20))
		x, y, w, h = parameters.get("FileListMultiName", applySkinFactor(55, 0, 470, 25))
		res.append((eListboxPythonMultiContent.TYPE_TEXT, x1, y, w, h, 0, RT_HALIGN_LEFT, name))
	return res
示例#2
0
 def layoutFinished(self):
     font = gFont("Console", applySkinFactor(16))
     if not int(fontRenderClass.getInstance().getLineHeight(font)):
         font = gFont("Regular", applySkinFactor(16))
     self["list"].instance.setFont(font)
     fontwidth = getTextBoundarySize(self.instance,
                                     font, self["list"].instance.size(),
                                     _(" ")).width()
     listwidth = int(self["list"].instance.size().width() / fontwidth) - 2
     if path.exists(self.logfile):
         for line in open(self.logfile).readlines():
             line = line.replace("\t", " " * 9)
             if len(line) > listwidth:
                 pos = 0
                 offset = 0
                 readyline = True
                 while readyline:
                     a = " " * offset + line[pos:pos + listwidth - offset]
                     self.log.append(a)
                     if len(line[pos + listwidth - offset:]):
                         pos += listwidth - offset
                         offset = 19
                     else:
                         readyline = False
             else:
                 self.log.append(line)
     else:
         self.log = [_("file can not displayed - file not found")]
     self["list"].setList(self.log)
示例#3
0
def PluginEntryComponent(plugin, width=440):
    png = plugin.icon or LoadPixmap(
        resolveFilename(SCOPE_CURRENT_SKIN, "icons/plugin.png"))
    nx, ny, nh = parameters.get("PluginBrowserName",
                                applySkinFactor(120, 5, 25))
    dx, dy, dh = parameters.get("PluginBrowserDescr",
                                applySkinFactor(120, 26, 17))
    ix, iy, iw, ih = parameters.get("PluginBrowserIcon",
                                    applySkinFactor(10, 5, 100, 40))
    return [
        plugin,
        MultiContentEntryText(pos=(nx, ny),
                              size=(width - nx, nh),
                              font=0,
                              text=plugin.name),
        MultiContentEntryText(pos=(nx, dy),
                              size=(width - dx, dh),
                              font=1,
                              text=plugin.description),
        MultiContentEntryPixmapAlphaBlend(pos=(ix, iy),
                                          size=(iw, ih),
                                          png=png,
                                          flags=BT_SCALE | BT_KEEP_ASPECT_RATIO
                                          | BT_HALIGN_CENTER
                                          | BT_VALIGN_CENTER)
    ]
示例#4
0
def PluginDownloadComponent(plugin, name, version=None, width=440):
    png = plugin.icon or LoadPixmap(
        resolveFilename(SCOPE_CURRENT_SKIN, "icons/plugin.png"))
    if version:
        if "+git" in version:
            # remove git "hash"
            version = "+".join(version.split("+")[:2])
        elif version.startswith('experimental-'):
            version = version[13:]
        name += "  (" + version + ")"
    x, y, h = parameters.get("PluginBrowserDownloadName",
                             applySkinFactor(80, 5, 25))
    dx, dy, dh = parameters.get("PluginBrowserDownloadDescr",
                                applySkinFactor(80, 26, 17))
    ix, iy, iw, ih = parameters.get("PluginBrowserDownloadIcon",
                                    applySkinFactor(10, 0, 60, 50))
    return [
        plugin,
        MultiContentEntryText(pos=(x, y),
                              size=(width - x, h),
                              font=0,
                              text=name),
        MultiContentEntryText(pos=(dx, dy),
                              size=(width - dx, dh),
                              font=1,
                              text=plugin.description),
        MultiContentEntryPixmapAlphaBlend(pos=(ix, iy), size=(iw, ih), png=png)
    ]
示例#5
0
def ServiceInfoListEntry(a, b="", valueType=TYPE_TEXT, param=4, altColor=False):
	print "b:", b
	if not isinstance(b, str):
		if valueType == TYPE_VALUE_HEX:
			b = ("%0" + str(param) + "X") % to_unsigned(b)
		elif valueType == TYPE_VALUE_FREQ:
			b = "%s MHz" % (b / 1000)
		elif valueType == TYPE_VALUE_FREQ_FLOAT:
			b = "%.3f MHz" % (b / 1000.0)
		elif valueType == TYPE_VALUE_BITRATE:
			b = "%s KSymbols/s" % (b / 1000)
		elif valueType == TYPE_VALUE_HEX_DEC:
			b = ("%0" + str(param) + "X (%d)") % (to_unsigned(b), b)
		elif valueType == TYPE_VALUE_ORBIT_DEC:
			direction = 'E'
			if b > 1800:
				b = 3600 - b
				direction = 'W'
			b = ("%d.%d%s") % (b // 10, b % 10, direction)
		else:
			b = str(b)
	xa, ya, wa, ha = parameters.get("ServiceInfoLeft", applySkinFactor(0, 0, 300, 25))
	xb, yb, wb, hb = parameters.get("ServiceInfoRight", applySkinFactor(300, 0, 600, 25))
	color = parameters.get("ServiceInfoAltColor", (0x00FFBF00)) # alternative foreground color
	res = [None]
	if b:
		res.append((eListboxPythonMultiContent.TYPE_TEXT, xa, ya, wa, ha, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, a))
		res.append((eListboxPythonMultiContent.TYPE_TEXT, xb, yb, wb, hb, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, b))
	else:
		res.append((eListboxPythonMultiContent.TYPE_TEXT, xa, ya, wa + wb, ha, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, a, color if altColor is True else None)) # spread horizontally
	return res
示例#6
0
def FileEntryComponent(name, absolute=None, isDir=False):
    res = [(absolute, isDir)]
    x, y, w, h = parameters.get("FileListName",
                                applySkinFactor(35, 1, 470, 20))
    res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0,
                RT_HALIGN_LEFT, name))
    if isDir:
        png = LoadPixmap(cached=True,
                         path=resolveFilename(SCOPE_CURRENT_SKIN,
                                              "extensions/directory.png"))
    else:
        extension = name.split('.')
        extension = extension[-1].lower()
        if extension in EXTENSIONS:
            png = LoadPixmap(
                resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" +
                                EXTENSIONS[extension] + ".png"))
        else:
            png = None
    if png is not None:
        x, y, w, h = parameters.get("FileListIcon",
                                    applySkinFactor(10, 2, 20, 20))
        res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w,
                    h, png))

    return res
示例#7
0
    def __init__(self, graphic=False):
        GUIComponent.__init__(self)
        self.graphic = graphic
        self.l = eListboxPythonMultiContent()
        self.l.setBuildFunc(self.buildEntry)
        self.onSelChanged = []

        self.foreColor = 0xffffff
        self.foreColorSelected = 0xffffff
        self.backColor = 0x2D455E
        self.backColorSelected = 0xd69600

        self.borderColor = 0xC0C0C0
        self.borderWidth = 1

        self.othPix = None
        self.selPix = None
        self.graphicsloaded = False

        self.bouquetFontName = "Regular"
        self.bouquetFontSize = applySkinFactor(20)

        self.itemHeight = applySkinFactor(31)
        self.listHeight = None
        self.listWidth = None

        self.bouquetNamePadding = 3
        self.bouquetNameAlign = "left"
        self.bouquetNameWrap = "no"
示例#8
0
	def __init__(self, list, enableWrapAround=True):
		MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
		font = fonts.get("PluginBrowser0", applySkinFactor("Regular", 20, 50))
		self.l.setFont(0, gFont(font[0], font[1]))
		self.l.setItemHeight(font[2])
		font = fonts.get("PluginBrowser1", applySkinFactor("Regular", 16))
		self.l.setFont(1, gFont(font[0], font[1]))
示例#9
0
def ChoiceEntryComponent(key=None, text=None):
	text = ["--"] if text is None else text
	res = [text]
	if text[0] == "--":
		x, y, w, h = parameters.get("ChoicelistDash", applySkinFactor(0, 0, 800, 25))
		res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, "-" * 200))
	else:
		if key:
			x, y, w, h = parameters.get("ChoicelistName", applySkinFactor(45, 0, 800, 25))
			res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, text[0]))
			if key == "dummy":
				png = None
			elif key == "expandable":
				png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "icons/expandable.png"))
			elif key == "expanded":
				png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "icons/expanded.png"))
			elif key == "verticalline":
				png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "icons/verticalline.png"))
			elif key == "bullet":
				png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "icons/bullet.png"))
			else:
				png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "buttons/key_%s.png" % key))
			if png:
				x, y, w, h = parameters.get("ChoicelistIcon", applySkinFactor(5, 0, 35, 25))
				res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, png))
		else:
			x, y, w, h = parameters.get("ChoicelistNameSingle", applySkinFactor(5, 0, 800, 25))
			res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, text[0]))
	return res
示例#10
0
def PluginEntryComponent(plugin, width=440):
    if plugin.icon is None:
        png = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN,
                                         "icons/plugin.png"))
    else:
        png = plugin.icon
    nx, ny, nh = skin.parameters.get(
        "PluginBrowserName",
        (skin.applySkinFactor(120), skin.applySkinFactor(5),
         skin.applySkinFactor(25)))
    dx, dy, dh = skin.parameters.get(
        "PluginBrowserDescr",
        (skin.applySkinFactor(120), skin.applySkinFactor(26),
         skin.applySkinFactor(17)))
    ix, iy, iw, ih = skin.parameters.get(
        "PluginBrowserIcon",
        (skin.applySkinFactor(10), skin.applySkinFactor(5),
         skin.applySkinFactor(100), skin.applySkinFactor(40)))
    return [
        plugin,
        MultiContentEntryText(pos=(nx, ny),
                              size=(width - nx, nh),
                              font=0,
                              text=plugin.name),
        MultiContentEntryText(pos=(nx, dy),
                              size=(width - dx, dh),
                              font=1,
                              text=plugin.description),
        MultiContentEntryPixmapAlphaBlend(pos=(ix, iy),
                                          size=(iw, ih),
                                          png=png,
                                          flags=BT_SCALE | BT_KEEP_ASPECT_RATIO
                                          | BT_HALIGN_CENTER
                                          | BT_VALIGN_CENTER)
    ]
示例#11
0
	def __init__(self, directory, showDirectories = True, showFiles = True, showMountpoints = True, matchingPattern = None, useServiceRef = False, inhibitDirs = False, inhibitMounts = False, isTop = False, enableWrapAround = False, additionalExtensions = None):
		MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
		self.additional_extensions = additionalExtensions
		self.mountpoints = []
		self.current_directory = None
		self.current_mountpoint = None
		self.useServiceRef = useServiceRef
		self.showDirectories = showDirectories
		self.showMountpoints = showMountpoints
		self.showFiles = showFiles
		self.isTop = isTop
		# example: matching .nfi and .ts files: "^.*\.(nfi|ts)"
		if matchingPattern:
			self.matchingPattern = re.compile(matchingPattern)
		else:
			self.matchingPattern = None
		self.inhibitDirs = inhibitDirs or []
		self.inhibitMounts = inhibitMounts or []

		self.refreshMountpoints()
		self.changeDir(directory)
		font = skin.fonts.get("FileList", ("Regular", skin.applySkinFactor(18), skin.applySkinFactor(23)))
		self.l.setFont(0, gFont(font[0], font[1]))
		self.l.setItemHeight(font[2])
		self.serviceHandler = eServiceCenter.getInstance()
示例#12
0
def PluginCategoryComponent(name, png, width=440):
	x, y, h = parameters.get("PluginBrowserDownloadName", applySkinFactor(80, 5, 25))
	ix, iy, iw, ih = parameters.get("PluginBrowserDownloadIcon", applySkinFactor(10, 0, 60, 50))
	return [
		name,
		MultiContentEntryText(pos=(x, y), size=(width - x, h), font=0, text=name),
		MultiContentEntryPixmapAlphaBlend(pos=(ix, iy), size=(iw, ih), png=png)
	]
示例#13
0
 def __init__(self, list, selection=0, enableWrapAround=False):
     MenuList.__init__(self, list, enableWrapAround,
                       eListboxPythonMultiContent)
     font = skin.fonts.get(
         "ChoiceList",
         ("Regular", skin.applySkinFactor(20), skin.applySkinFactor(25)))
     self.l.setFont(0, gFont(font[0], font[1]))
     self.l.setItemHeight(font[2])
     self.ItemHeight = font[2]
     self.selection = selection
示例#14
0
 def __init__(self, list=None, enableWrapAround=False):
     MenuList.__init__(self,
                       list or [],
                       enableWrapAround,
                       content=eListboxPythonMultiContent)
     font = skin.fonts.get(
         "SelectionList",
         ("Regular", skin.applySkinFactor(20), skin.applySkinFactor(30)))
     self.l.setFont(0, gFont(font[0], font[1]))
     self.l.setItemHeight(font[2])
示例#15
0
	def __init__(self, preselectedFiles, directory, showMountpoints = False, matchingPattern = None, showDirectories = True, showFiles = True,  useServiceRef = False, inhibitDirs = False, inhibitMounts = False, isTop = False, enableWrapAround = False, additionalExtensions = None):
		if preselectedFiles is None:
			self.selectedFiles = []
		else:
			self.selectedFiles = preselectedFiles
		FileList.__init__(self, directory, showMountpoints = showMountpoints, matchingPattern = matchingPattern, showDirectories = showDirectories, showFiles = showFiles,  useServiceRef = useServiceRef, inhibitDirs = inhibitDirs, inhibitMounts = inhibitMounts, isTop = isTop, enableWrapAround = enableWrapAround, additionalExtensions = additionalExtensions)
		self.changeDir(directory)
		font = skin.fonts.get("FileListMulti", ("Regular", skin.applySkinFactor(20), skin.applySkinFactor(25)))
		self.l.setFont(0, gFont(font[0], font[1]))
		self.l.setItemHeight(font[2])
		self.onSelectionChanged = [ ]
示例#16
0
	def __init__(self, list, session=None):
		GUIComponent.__init__(self)
		self.l = eListboxPythonConfigContent()
		seperation = parameters.get("ConfigListSeperator", applySkinFactor(200))
		self.l.setSeperation(seperation)
		height, space = parameters.get("ConfigListSlider", (applySkinFactor(17), applySkinFactor(0)))
		self.l.setSlider(height, space)
		self.timer = eTimer()
		self.list = list
		self.onSelectionChanged = []
		self.current = None
		self.session = session
示例#17
0
	def PlaylistEntryComponent(self, serviceref, state):
		res = [ serviceref ]
		text = serviceref.getName()
		if text is "":
			text = path.split(serviceref.getPath().split('/')[-1])[1]
		x, y, w, h = skin.parameters.get("PlayListName",(skin.applySkinFactor(25), skin.applySkinFactor(1), skin.applySkinFactor(470), skin.applySkinFactor(22)))
		res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_VALIGN_CENTER, text))
		try:
			png = self.icons[state]
			x, y, w, h = skin.parameters.get("PlayListIcon",(skin.applySkinFactor(5), skin.applySkinFactor(3), skin.applySkinFactor(16), skin.applySkinFactor(16)))
			res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, x, y, w, h, png))
		except:
				pass
		return res
示例#18
0
	def __init__(self, enableWrapAround = False):
		MenuList.__init__(self, [], enableWrapAround, eListboxPythonMultiContent)
		font = skin.fonts.get("PlayList", ("Regular", skin.applySkinFactor(18), skin.applySkinFactor(23)))
		self.l.setFont(0, gFont(font[0], font[1]))
		self.l.setItemHeight(font[2])
		self.currPlaying = -1
		self.oldCurrPlaying = -1
		self.serviceHandler = eServiceCenter.getInstance()
		self.state = STATE_NONE
		self.icons = [
			LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "icons/ico_mp_play.png")),
			LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "icons/ico_mp_pause.png")),
			LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "icons/ico_mp_stop.png")),
			LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "icons/ico_mp_rewind.png")),
			LoadPixmap(path=resolveFilename(SCOPE_ACTIVE_SKIN, "icons/ico_mp_forward.png")),
		]
示例#19
0
	def __init__(self, session, epgConfig, selChangedCB=None):
		EPGListBase.__init__(self, session, selChangedCB)

		self.epgConfig = epgConfig
		self.eventFontName = "Regular"
		self.eventFontSize = applySkinFactor(18)
		self.l.setBuildFunc(self.buildEntry)
示例#20
0
def SelectionEntryComponent(description, value, index, selected):
    dx, dy, dw, dh = parameters.get("SelectionListDescr",
                                    applySkinFactor(25, 5, 650, 30))
    res = [(description, value, index, selected),
           (eListboxPythonMultiContent.TYPE_TEXT, dx, dy, dw, dh, 0,
            RT_HALIGN_LEFT, description)]
    if selected:
        ix, iy, iw, ih = parameters.get("SelectionListLock",
                                        applySkinFactor(0, 2, 25, 24))
        res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, ix, iy,
                    iw, ih, selectiononpng))
    else:
        ix, iy, iw, ih = parameters.get("SelectionListLockOff",
                                        applySkinFactor(0, 2, 25, 24))
        res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, ix, iy,
                    iw, ih, selectionoffpng))
    return res
示例#21
0
 def __init__(self, source):
     GUIComponent.__init__(self)
     self.l = eListboxPythonMultiContent()
     self.list = source
     self.l.setList(self.list)
     font = fonts.get("ServiceInfo", applySkinFactor("Regular", 21, 25))
     self.l.setFont(0, gFont(font[0], font[1]))
     self.l.setItemHeight(font[2])
示例#22
0
def ServiceInfoListEntry(a, b="", valueType=TYPE_TEXT, param=4):
    print "b:", b
    if not isinstance(b, str):
        if valueType == TYPE_VALUE_HEX:
            b = ("%0" + str(param) + "X") % to_unsigned(b)
        elif valueType == TYPE_VALUE_FREQ:
            b = "%s MHz" % (b / 1000)
        elif valueType == TYPE_VALUE_FREQ_FLOAT:
            b = "%.3f MHz" % (b / 1000.0)
        elif valueType == TYPE_VALUE_BITRATE:
            b = "%s KSymbols/s" % (b / 1000)
        elif valueType == TYPE_VALUE_HEX_DEC:
            b = ("%0" + str(param) + "X (%d)") % (to_unsigned(b), b)
        elif valueType == TYPE_VALUE_ORBIT_DEC:
            direction = 'E'
            if b > 1800:
                b = 3600 - b
                direction = 'W'
            b = ("%d.%d%s") % (b // 10, b % 10, direction)
        else:
            b = str(b)
    x, y, w, h = parameters.get("ServiceInfo", applySkinFactor(0, 0, 300, 30))
    xa, ya, wa, ha = parameters.get("ServiceInfoLeft",
                                    applySkinFactor(0, 0, 300, 25))
    xb, yb, wb, hb = parameters.get("ServiceInfoRight",
                                    applySkinFactor(300, 0, 600, 25))
    if b:
        return [
            #PyObject *type, *px, *py, *pwidth, *pheight, *pfnt, *pstring, *pflags;
            (eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0,
             RT_HALIGN_LEFT, ""),
            (eListboxPythonMultiContent.TYPE_TEXT, xa, ya, wa, ha, 0,
             RT_HALIGN_LEFT, a),
            (eListboxPythonMultiContent.TYPE_TEXT, xb, yb, wb, hb, 0,
             RT_HALIGN_LEFT, b)
        ]
    else:
        return [
            #PyObject *type, *px, *py, *pwidth, *pheight, *pfnt, *pstring, *pflags;
            (eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0,
             RT_HALIGN_LEFT, ""),
            (eListboxPythonMultiContent.TYPE_TEXT, xa, ya, wa + wb, ha + hb, 0,
             RT_HALIGN_LEFT, a)
        ]
 def __init__(self, tree=None, enableWrapAround=False):
     'tree is expected to be a list of categories'
     MenuList.__init__(self, [],
                       enableWrapAround,
                       content=eListboxPythonMultiContent)
     font = fonts.get("SelectionList", applySkinFactor("Regular", 20, 30))
     self.l.setFont(0, gFont(font[0], font[1]))
     self.l.setItemHeight(font[2])
     self.tree = tree or []
     self.updateFlatList()
示例#24
0
def SelectionEntryComponent(description, value, index, selected):
    dx, dy, dw, dh = parameters.get("SelectionListDescr",
                                    applySkinFactor(25, 3, 650, 30))
    res = [(description, value, index, selected),
           (eListboxPythonMultiContent.TYPE_TEXT, dx, dy, dw, dh, 0,
            RT_HALIGN_LEFT, description)]
    if selected:
        selectionpng = LoadPixmap(cached=True,
                                  path=resolveFilename(SCOPE_CURRENT_SKIN,
                                                       "icons/lock_on.png"))
    else:
        selectionpng = LoadPixmap(cached=True,
                                  path=resolveFilename(SCOPE_CURRENT_SKIN,
                                                       "icons/lock_off.png"))
    ix, iy, iw, ih = parameters.get("SelectionListLock",
                                    applySkinFactor(0, 2, 25, 24))
    res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, ix, iy, iw,
                ih, selectionpng))
    return res
def loadSettings():
    global cat_desc_loc, entry_desc_loc, cat_icon_loc, entry_icon_loc

    # expandable list (skin parameters defined by the plugin)
    x, y, w, h = parameters.get("ExpandableListDescr",
                                applySkinFactor(40, 3, 650, 30))
    cat_desc_loc = (x, y, w, h)
    x, y, w, h = parameters.get("ExpandableListIcon",
                                applySkinFactor(0, 2, 30, 25))
    cat_icon_loc = (x, y, w, h)

    indent = x + w  # indentation for the selection list entries

    # selection list (skin parameters also used in enigma2)
    x, y, w, h = parameters.get("SelectionListDescr",
                                applySkinFactor(25, 3, 650, 30))
    entry_desc_loc = (x + indent, y, w - indent, h)
    x, y, w, h = parameters.get("SelectionListLock",
                                applySkinFactor(0, 2, 25, 24))
    entry_icon_loc = (x + indent, y, w, h)
示例#26
0
def ChoiceEntryComponent(key=None, text=["--"]):
    res = [text]
    if text[0] == "--":
        x, y, w, h = skin.parameters.get(
            "ChoicelistDash",
            (skin.applySkinFactor(0), skin.applySkinFactor(2),
             skin.applySkinFactor(800), skin.applySkinFactor(25)))
        res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0,
                    RT_HALIGN_LEFT, "-" * 200))
    else:
        x, y, w, h = skin.parameters.get(
            "ChoicelistName",
            (skin.applySkinFactor(45), skin.applySkinFactor(2),
             skin.applySkinFactor(800), skin.applySkinFactor(25)))
        res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0,
                    RT_HALIGN_LEFT, text[0]))
        if key:
            if key == "expandable":
                pngfile = resolveFilename(SCOPE_ACTIVE_SKIN,
                                          "icons/expandable.png")
            elif key == "expanded":
                pngfile = resolveFilename(SCOPE_ACTIVE_SKIN,
                                          "icons/expanded.png")
            elif key == "verticalline":
                pngfile = resolveFilename(SCOPE_ACTIVE_SKIN,
                                          "icons/verticalline.png")
            elif key == "bullet":
                pngfile = resolveFilename(SCOPE_ACTIVE_SKIN,
                                          "icons/bullet.png")
            else:
                pngfile = resolveFilename(SCOPE_ACTIVE_SKIN,
                                          "buttons/key_%s.png" % key)
            if fileExists(pngfile):
                png = LoadPixmap(pngfile)
                x, y, w, h = skin.parameters.get(
                    "ChoicelistIcon",
                    (skin.applySkinFactor(5), skin.applySkinFactor(0),
                     png.size().width(), png.size().height()))
                res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND,
                            x, y, w, h, png))
    return res
示例#27
0
 def buildEntry(self, service, eventId, beginTime, duration, eventName):
     timer, matchType = self.session.nav.RecordTimer.isInTimer(
         service, beginTime, duration)
     timerIcon, autoTimerIcon = self.getPixmapsForTimer(timer, matchType)
     r1 = self._weekdayRect
     r2 = self._datetimeRect
     r3 = self._descrRect
     split = int(r2.width() * 0.55)
     t = localtime(beginTime)
     et = localtime(beginTime + duration)
     res = [
         None,  # No private data needed.
         (eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(),
          r1.width(), r1.height(), 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER,
          strftime(config.usage.date.dayshort.value, t)),
         (eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), split,
          r2.height(), 0, RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
          strftime(config.usage.time.short.value + " -", t)),
         (eListboxPythonMultiContent.TYPE_TEXT, r2.left() + split, r2.top(),
          r2.width() - split, r2.height(), 0,
          RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
          strftime(config.usage.time.short.value, et))
     ]
     eventW = r3.width()
     if timerIcon:
         clockSize = applySkinFactor(17)
         eventW -= clockSize
         res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND,
                     r3.left() + r3.width() - clockSize,
                     (r3.height() - clockSize) / 2, clockSize, clockSize,
                     timerIcon))
         if autoTimerIcon:
             eventW -= clockSize
             res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND,
                         r3.left() + r3.width() - clockSize * 2,
                         (r3.height() - clockSize) / 2, clockSize,
                         clockSize, autoTimerIcon))
     res.append(
         (eListboxPythonMultiContent.TYPE_TEXT, r3.left(), r3.top(), eventW,
          r3.height(), 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, eventName))
     return res
示例#28
0
	def buildEntry(self, service, eventId, beginTime, duration, EventName, nowTime, serviceName, changeCount):
		r1 = self.serviceRect
		r2 = self.startEndRect
		r3 = self.progressRect
		r4 = self.durationRect
		r5 = self.descrRect
		res = [
			None,  # No private data needed.
			(eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, serviceName)
		]
		if beginTime is not None:
			if nowTime < beginTime:
				begin = localtime(beginTime)
				end = localtime(beginTime + duration)
				split = int(r2.width() * 0.55)
				res.extend((
					(eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), split, r2.height(), 0, RT_HALIGN_RIGHT | RT_VALIGN_CENTER, strftime(config.usage.time.short.value + " - ", begin)),
					(eListboxPythonMultiContent.TYPE_TEXT, r2.left() + split, r2.top(), r2.width() - split, r2.height(), 0, RT_HALIGN_RIGHT | RT_VALIGN_CENTER, strftime(config.usage.time.short.value, end))
				))
				remaining = duration // SECS_IN_MIN
				prefix = ""
			else:
				percent = (nowTime - beginTime) * 100 // duration
				remaining = ((beginTime + duration) - int(time())) // SECS_IN_MIN
				prefix = "" if remaining <= 0 else "+"
				res.append((eListboxPythonMultiContent.TYPE_PROGRESS, r3.left(), r3.top(), r3.width(), r3.height(), percent))
			res.append((eListboxPythonMultiContent.TYPE_TEXT, r4.left(), r4.top(), r4.width(), r4.height(), 0, RT_HALIGN_RIGHT | RT_VALIGN_CENTER, _("%s%d Min") % (prefix, remaining)))
			width = r5.width()
			timer, matchType = self.session.nav.RecordTimer.isInTimer(service, beginTime, duration)
			if timer:
				clockSize = applySkinFactor(17)
				width -= clockSize // 2 if matchType == 0 else clockSize
				timerIcon, autoTimerIcon = self.getPixmapsForTimer(timer, matchType)
				res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, r5.left() + width, (r5.height() - clockSize) // 2, clockSize, clockSize, timerIcon))
				if autoTimerIcon:
					width -= clockSize + 1
					res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, r5.left() + width, (r5.height() - clockSize) // 2, clockSize, clockSize, autoTimerIcon))
				width -= 5
			res.append((eListboxPythonMultiContent.TYPE_TEXT, r5.left(), r5.top(), width, r5.height(), 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, EventName))
		return res
示例#29
0
	def __init__(self, helplist, callback):
		GUIComponent.__init__(self)
		self.onSelChanged = [ ]
		self.l = eListboxPythonMultiContent()
		self.callback = callback
		self.extendedHelp = False

		l = [ ]
		
		sortlist = []
		for (actionmap, context, actions) in helplist:
			for (action, help) in actions:
				if hasattr(help, '__call__'):
					help = help()
				if not help:
					continue
				sortlist.append((actionmap, context, action, help))
		# Sort by description text (main and extended), then by action (this puts numeric actions in ascending order).
		sortlist.sort(key=lambda helpItem: (map(str.lower, helpItem[3] if isinstance(helpItem[3], (tuple, list)) else [helpItem[3]]), helpItem[2]))
		
		for (actionmap, context, action, help) in sortlist:
				buttons = queryKeyBinding(context, action)

				# do not display entries which are not accessible from keys
				if not len(buttons):
					continue

				name = None
				flags = 0

				for n in buttons:
					(name, flags) = (getKeyDescription(n[0]), n[1])
					if name is not None:
						break

				# only show entries with keys that are available on the used rc
				if name is None:
					continue

				if flags & 8: # for long keypresses, prepend l_ into the key name.
					name = (name[0], "long")

				entry = [ (actionmap, context, action, name ) ]

				if isinstance(help, list):
					self.extendedHelp = True
					print "extendedHelpEntry found"
					x, y, w, h = skin.parameters.get("HelpMenuListExtHlp0",(skin.applySkinFactor(5), 0, skin.applySkinFactor(595), skin.applySkinFactor(28)))
					x1, y1, w1, h1 = skin.parameters.get("HelpMenuListExtHlp1",(skin.applySkinFactor(5), skin.applySkinFactor(34), skin.applySkinFactor(595), skin.applySkinFactor(22)))
					entry.extend((
						(eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, 0, help[0]),
						(eListboxPythonMultiContent.TYPE_TEXT, x1, y1, w1, h1, 1, 0, help[1])
					))
				else:
					x, y, w, h = skin.parameters.get("HelpMenuListHlp",(skin.applySkinFactor(5), 0, skin.applySkinFactor(595), skin.applySkinFactor(28)))
					entry.append( (eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, 0, help) )

				l.append(entry)

		self.l.setList(l)
		if self.extendedHelp is True:
			font = skin.fonts.get("HelpMenuListExt0", ("Regular", skin.applySkinFactor(24), skin.applySkinFactor(56)))
			self.l.setFont(0, gFont(font[0], font[1]))
			self.l.setItemHeight(font[2])
			font = skin.fonts.get("HelpMenuListExt1", ("Regular", skin.applySkinFactor(18)))
			self.l.setFont(1, gFont(font[0], font[1]))
		else:
			font = skin.fonts.get("HelpMenuList", ("Regular", skin.applySkinFactor(24), skin.applySkinFactor(28)))
			self.l.setFont(0, gFont(font[0], font[1]))
			self.l.setItemHeight(font[2])
示例#30
0
    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", applySkinFactor(22))
        self.eventTimeFont = gFont("Regular", applySkinFactor(16))
        self.iconSize = applySkinFactor(21)
        self.iconDistance = applySkinFactor(2)
        self.colGap = applySkinFactor(10)
        self.skinColumns = False
        self.tw = applySkinFactor(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,
                                            'icons/epgclock_add.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/epgclock_pre.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/epgclock.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/epgclock_prepost.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/epgclock_post.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zapclock_add.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zapclock_pre.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zapclock.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zapclock_prepost.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zapclock_post.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zaprecclock_add.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zaprecclock_pre.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zaprecclock.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zaprecclock_prepost.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/zaprecclock_post.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repepgclock_add.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repepgclock_pre.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repepgclock.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repepgclock_prepost.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repepgclock_post.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repzapclock_add.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repzapclock_pre.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repzapclock.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repzapclock_prepost.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repzapclock_post.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repzaprecclock_add.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repzaprecclock_pre.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repzaprecclock.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(
                           SCOPE_CURRENT_SKIN,
                           'icons/repzaprecclock_prepost.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/repzaprecclock_post.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/pipclock_add.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/pipclock_pre.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/pipclock.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/pipclock_prepost.png')),
            LoadPixmap(cached=True,
                       path=resolveFilename(SCOPE_CURRENT_SKIN,
                                            'icons/pipclock_post.png'))
        ]