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
Exemple #2
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
Exemple #3
0
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
Exemple #4
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
Exemple #5
0
def PluginDownloadComponent(plugin, name, version=None, width=440):
    png = plugin.icon or LoadPixmap(
        resolveFilename(SCOPE_GUISKIN, "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 += "  (%s)" % version
    x, y, h = parameters.get("PluginBrowserDownloadName", (80, 5, 25))
    dx, dy, dh = parameters.get("PluginBrowserDownloadDescr", (80, 26, 17))
    ix, iy, iw, ih = parameters.get("PluginBrowserDownloadIcon",
                                    (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)
    ]
Exemple #6
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)
    ]
Exemple #7
0
 def buildList(self):
     self.list = []
     for c in config.plugins.Partnerbox.Entries:
         res = [c]
         x, y, w, h = parameters.get(
             "PartnerBoxEntryListName",
             (int(5 * SCALE), 0, int(200 * SCALE), int(24 * SCALE)))
         res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 1,
                     RT_HALIGN_LEFT | RT_VALIGN_CENTER, str(c.name.value)))
         ip = "%d.%d.%d.%d" % tuple(c.ip.value)
         x, y, w, h = parameters.get(
             "PartnerBoxEntryListIP",
             (int(214 * SCALE), 0, int(230 * SCALE), int(24 * SCALE)))
         res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 1,
                     RT_HALIGN_LEFT | RT_VALIGN_CENTER, str(ip)))
         port = "%d" % (c.port.value)
         x, y, w, h = parameters.get(
             "PartnerBoxEntryListPort",
             (int(400 * SCALE), 0, int(70 * SCALE), int(24 * SCALE)))
         res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 1,
                     RT_HALIGN_LEFT | RT_VALIGN_CENTER, str(port)))
         if int(c.enigma.value) == 0:
             e_type = "Enigma2"
         else:
             e_type = "Enigma1"
         x, y, w, h = parameters.get(
             "PartnerBoxEntryListType",
             (int(550 * SCALE), 0, int(100 * SCALE), int(24 * SCALE)))
         res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 1,
                     RT_HALIGN_LEFT | RT_VALIGN_CENTER, str(e_type)))
         self.list.append(res)
     self.l.setList(self.list)
     self.moveToIndex(0)
Exemple #8
0
	def __init__(self, list, enableWrapAround=True):
		MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)

		font1, size1 = skinparameter.get("WeatherPluginSearchResultListFont1", ('Regular', 20))
		font2, size2 = skinparameter.get("WeatherPluginSearchResultListFont2", ('Regular', 18))
		self.l.setFont(0, gFont(font1, size1))
		self.l.setFont(1, gFont(font2, size2))
Exemple #9
0
	def buildList(self, xml):
		root = cet_fromstring(xml)
		searchlocation = ""
		searchresult = ""
		weatherlocationcode = ""
		list = []
		for childs in root:
			if childs.tag == "weather":
				searchlocation = childs.attrib.get("weatherlocationname").encode("utf-8", 'ignore')
				searchresult = childs.attrib.get("weatherfullname").encode("utf-8", 'ignore')
				weatherlocationcode = childs.attrib.get("weatherlocationcode").encode("utf-8", 'ignore')
				if skinwidth == 1280:
					x1, y1, w1, h1 = skinparameter.get("WeatherPluginSearchlocation", (5, 0, 500, 20))
					x2, y2, w2, h2 = skinparameter.get("WeatherPluginSearchresult", (5, 22, 500, 20))
				else:
					x1, y1, w1, h1 = skinparameter.get("WeatherPluginSearchlocation", (5, 0, 500, 30))
					x2, y2, w2, h2 = skinparameter.get("WeatherPluginSearchresult", (5, 27, 500, 26))
					res = [
						(weatherlocationcode, searchlocation),
						(eListboxPythonMultiContent.TYPE_TEXT, x1, y1, w1, h1, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, searchlocation),
						(eListboxPythonMultiContent.TYPE_TEXT, x2, y2, w2, h2, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, searchresult),
					]

					list.append(res)
		self.list = list
		self.l.setList(list)
		self.moveToIndex(0)
Exemple #10
0
def ZapHistoryBrowserListEntry(serviceName, eventName):
    res = [serviceName]
    DESKTOP_WIDTH = getDesktop(0).size().width()
    if DESKTOP_WIDTH <= 1280:
        x1, y1, w1, h1 = skinparameter.get("ZapHistoryBrowserServiceName",
                                           (0, 0, 560, 22))
        x2, y2, w2, h2 = skinparameter.get("ZapHistoryBrowserEventName",
                                           (0, 22, 560, 18))
        res.append(
            MultiContentEntryText(pos=(x1, y1),
                                  size=(w1, h1),
                                  font=0,
                                  text=serviceName))
        res.append(
            MultiContentEntryText(pos=(x2, y2),
                                  size=(w2, h2),
                                  font=1,
                                  text=eventName))
    else:
        x1, y1, w1, h1 = skinparameter.get("ZapHistoryBrowserServiceName",
                                           (2, 1, 840, 38))
        x2, y2, w2, h2 = skinparameter.get("ZapHistoryBrowserEventName",
                                           (2, 40, 840, 33))
        res.append(
            MultiContentEntryText(pos=(x1, y1),
                                  size=(w1, h1),
                                  font=0,
                                  text=serviceName))
        res.append(
            MultiContentEntryText(pos=(x2, y2),
                                  size=(w2, h2),
                                  font=1,
                                  text=eventName))
    return res
Exemple #11
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)
	]
def SelectionEntryComponent(description, value, index, selected):
    dx, dy, dw, dh = parameters.get("SelectionListDescr", (45, 0, 650, 30))
    res = [(description, value, index, selected),
           (eListboxPythonMultiContent.TYPE_TEXT, dx, dy, dw, dh, 0,
            RT_HALIGN_LEFT | RT_VALIGN_CENTER, description)]
    global icons
    icon = icons[0] if selected else icons[1]
    ix, iy, iw, ih = parameters.get("SelectionListLock", (10, 2, 26, 26))
    res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, ix, iy, iw,
                ih, icon, None, None, BT_SCALE | BT_KEEP_ASPECT_RATIO))
    return res
Exemple #13
0
	def __init__(self, list, enableWrapAround = True):
		MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
		if skinwidth == 1280:
			font1, size1 = skinparameter.get("WeatherPluginEntryListFont1", ('Regular', 20))
			font2, size2 = skinparameter.get("WeatherPluginEntryListFont2", ('Regular', 18))
			self.l.setFont(0, gFont(font1, size1))
			self.l.setFont(1, gFont(font2, size2))
		else:
			font1, size1 = skinparameter.get("WeatherPluginEntryListFont1", ('Regular', 28))
			font2, size2 = skinparameter.get("WeatherPluginEntryListFont2", ('Regular', 26))
			self.l.setFont(0, gFont(font1, size1))
			self.l.setFont(1, gFont(font2, size2))
Exemple #14
0
    def __init__(self, list, enableWrapAround=True):
        MenuList.__init__(self, list, enableWrapAround,
                          eListboxPythonMultiContent)

        fs1 = 20 if HD.width() < 1920 else 30
        fs2 = 18 if HD.width() < 1920 else 28
        font1, size1 = skinparameter.get("WeatherPluginSearchResultListFont1",
                                         ('Regular', fs1))
        font2, size2 = skinparameter.get("WeatherPluginSearchResultListFont2",
                                         ('Regular', fs2))
        self.l.setFont(0, gFont(font1, size1))
        self.l.setFont(1, gFont(font2, size2))
Exemple #15
0
	def __init__(self, list, session=None):
		GUIComponent.__init__(self)
		self.l = eListboxPythonConfigContent()
		seperation = parameters.get("ConfigListSeperator", 200)
		self.l.setSeperation(seperation)
		height, space = parameters.get("ConfigListSlider", (17, 0))
		self.l.setSlider(height, space)
		self.timer = eTimer()
		self.list = list
		self.onSelectionChanged = []
		self.current = None
		self.session = session
Exemple #16
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 = parameters.get("PlayListName", applySkinFactor(25, 1, 470, 22))
		res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_VALIGN_CENTER, text))
		try:
			png = self.icons[state]
			x, y, w, h = parameters.get("PlayListIcon", applySkinFactor(5, 3, 16, 16))
			res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, x, y, w, h, png))
		except:
				pass
		return res
	def __init__(self, list, enableWrapAround=False):
		MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
		DESKTOP_WIDTH = getDesktop(0).size().width()
		if DESKTOP_WIDTH <= 1280:
			font1, size1 = skinparameter.get("ZapHistoryBrowserListFont1", ('Regular', 20))
			font2, size2 = skinparameter.get("ZapHistoryBrowserListFont2", ('Regular', 18))
			self.l.setFont(0, gFont(font1, size1))
			self.l.setFont(1, gFont(font2, size2))
			self.l.setItemHeight(40)
		else:
			font1, size1 = skinparameter.get("ZapHistoryBrowserListFont1", ('Regular', 30))
			font2, size2 = skinparameter.get("ZapHistoryBrowserListFont2", ('Regular', 27))
			self.l.setFont(0, gFont(font1, size1))
			self.l.setFont(1, gFont(font2, size2))
			self.l.setItemHeight(75)
Exemple #18
0
	def __init__(self, type):
		Converter.__init__(self, type)
		self.LastRotorPos = config.misc.lastrotorposition.value
		config.misc.lastrotorposition.addNotifier(self.forceChanged, initial_call=False)
		config.misc.showrotorposition.addNotifier(self.show_hide, initial_call=False)
		self.sec = eDVBSatelliteEquipmentControl.getInstance()
		self.colors = parameters.get("RotorPositionColors", (0x0000f0f0, 0x00f0f0f0)) # tuner letter, nim_text
Exemple #19
0
 def recalcEntrySize(self):
     esize = self.l.getItemSize()
     width = esize.width()
     height = esize.height()
     fontSize = self.eventFontSize + config.epgselection.multi.eventfs.value
     servScale, timeScale, durScale, wideScale = parameters.get(
         "EPGMultiColumnScales",
         (config.epgselection.multi.servicewidth.value, 6.0, 4.5, 1.5))
     servW = int(fontSize * servScale)
     timeW = int(fontSize * timeScale)
     durW = int(fontSize * durScale)
     left, servWidth, sepWidth, timeWidth, progHeight, breakWidth, durWidth, gapWidth = parameters.get(
         "EPGMultiColumnSpecs",
         (0, servW, 10, timeW, height - 12, 10, durW, 10))
     if config.usage.time.wide.value:
         timeWidth = int(timeWidth * wideScale)
     self.serviceRect = eRect(left, 0, servWidth, height)
     left += servWidth + sepWidth
     self.startEndRect = eRect(left, 0, timeWidth, height)
     progTop = int((height - progHeight) / 2)
     self.progressRect = eRect(left, progTop, timeWidth, progHeight)
     left += timeWidth + breakWidth
     self.durationRect = eRect(left, 0, durWidth, height)
     left += durWidth + gapWidth
     self.descrRect = eRect(left, 0, width - left, height)
Exemple #20
0
	def buildList(self):
		list = []
		for c in config.plugins.WeatherPlugin.Entry:

			x1, y1, w1, h1 = skinparameter.get("WeatherPluginCity", (5, 0, 400, 20))
			x2, y2, w2, h2 = skinparameter.get("WeatherPluginDegreetype", (410, 0, 80, 20))
			res = [
				c,
				(eListboxPythonMultiContent.TYPE_TEXT, x1, y1, w1, h1, 1, RT_HALIGN_LEFT | RT_VALIGN_CENTER, str(c.city.value)),
				(eListboxPythonMultiContent.TYPE_TEXT, x2, y2, w2, h2, 1, RT_HALIGN_LEFT | RT_VALIGN_CENTER, str(c.degreetype .value)),
			]

			list.append(res)
		self.list = list
		self.l.setList(list)
		self.moveToIndex(0)
Exemple #21
0
def LoadPixmap(path, desktop=None, cached=None, width=0, height=0):
    if path[-4:] == ".png":
        # cache unless caller explicity requests to not cache
        ptr = loadPNG(path, 0, 0 if cached is False else 1)
    elif path[-4:] == ".jpg":
        # don't cache unless caller explicity requests caching
        ptr = loadJPG(path, 1 if cached is True else 0)
    elif path[-4:] == ".svg":
        from skin import parameters, getSkinFactor  # imported here to avoid circular import
        autoscale = int(parameters.get(
            "AutoscaleSVG",
            -1))  # skin_default only == -1, disabled == 0 or enabled == 1
        scale = height == 0 and (autoscale == -1 and "/skin_default/" in path
                                 or autoscale == 1) and getSkinFactor() or 0
        ptr = loadSVG(path, 0 if cached is False else 1, width, height, scale)
    elif path[-1:] == ".":
        # caching mechanism isn't suitable for multi file images, so it's explicitly disabled
        alpha = loadPNG(path + "a.png", 0, 0)
        ptr = loadJPG(path + "rgb.jpg", alpha, 0)
    else:
        raise Exception(
            "Neither .png nor .jpg nor .svg, please fix file extension")
    if ptr and desktop:
        desktop.makeCompatiblePixmap(ptr)
    return ptr
Exemple #22
0
    def createCryptoBar(self, info):
        res = ""
        available_caids = info.getInfoObject(iServiceInformation.sCAIDs)
        colors = parameters.get("PliExtraInfoColors", (
            0x0000FF00, 0x00FFFF00, 0x007F7F7F,
            0x00FFFFFF))  # "found", "not found", "available", "default" colors

        for caid_entry in caid_data:
            if int(caid_entry[0], 16) <= int(self.current_caid, 16) <= int(
                    caid_entry[1], 16):
                color = Hex2strColor(colors[0])  # green
            else:
                color = Hex2strColor(colors[2])  # grey
                try:
                    for caid in available_caids:
                        if int(caid_entry[0], 16) <= caid <= int(
                                caid_entry[1], 16):
                            color = Hex2strColor(colors[1])  # yellow
                except:
                    pass

            if color != Hex2strColor(colors[2]) or caid_entry[4]:
                if res: res += " "
                res += color + caid_entry[3]

        res += Hex2strColor(
            colors[3]
        )  # white (this acts like a color "reset" for following strings
        return res
Exemple #23
0
 def __init__(self, type):
     Converter.__init__(self, type)
     args = type.lower().split(",")
     self.notDiskLetterName = "nolettername" in args
     self.allVisible = "allvisible" in args
     if "internalall" in args:
         self.type = self.INTERNAL_ALL
     elif "internalhdd" in args:
         self.type = self.INTERNAL_HDD
     elif "internalssd" in args:
         self.type = self.INTERNAL_SSD
     elif "external" in args:
         self.type = self.EXTERNAL
     else:
         self.type = self.ALL
     self.standby_time = 150
     self.isActive = False
     self.state_text = ""
     self.isHDD()
     self.timer = eTimer()
     self.timer.callback.append(self.updateHddState)
     self.idle_time = int(config.usage.hdd_standby.value)
     config.usage.hdd_standby.addNotifier(self.setStandbyTime,
                                          initial_call=False)
     self.colors = parameters.get(
         "HddStateColors",
         (0x00FFFF00, 0x0000FF00))  # standby - yellow, active - green
     if self.hdd_list:
         self.updateHddState(force=True)
     if self.onPartitionAddRemove not in harddiskmanager.on_partition_list_change:
         harddiskmanager.on_partition_list_change.append(
             self.onPartitionAddRemove)
Exemple #24
0
	def recalcEntrySize(self):
		esize = self.l.getItemSize()
		width = esize.width()
		height = esize.height()
		fontSize = self.eventFontSize + self.epgConfig.eventfs.value
		dateScale, timesScale, wideScale = parameters.get("EPGSingleColumnScales", (5.7, 6.0, 1.5))
		dateW = int(fontSize * dateScale)
		timesW = int(fontSize * timesScale)
		left, dateWidth, sepWidth, timesWidth, breakWidth = parameters.get("EPGSingleColumnSpecs", (0, dateW, 5, timesW, 20))
		if config.usage.time.wide.value:
			timesWidth = int(timesWidth * wideScale)
		self._weekdayRect = eRect(left, 0, dateWidth, height)
		left += dateWidth + sepWidth
		self._datetimeRect = eRect(left, 0, timesWidth, height)
		left += timesWidth + breakWidth
		self._descrRect = eRect(left, 0, width - left, height)
		self.showend = True  # This is not an unused variable. It is a flag used by EPGSearch plugin
Exemple #25
0
def FileEntryComponent(name, absolute=None, isDir=False):
	res = [(absolute, isDir)]
	x, y, w, h = parameters.get("FileListName", (35, 0, 600, 20))
	res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, name))
	if isDir:
		png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_GUISKIN, "extensions/directory.png"))
	else:
		extension = name.split(".")
		extension = extension[-1].lower()
		if extension in EXTENSIONS:
			png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_GUISKIN, "extensions/%s.png" % EXTENSIONS[extension]))
		else:
			png = None
	if png is not None:
		x, y, w, h = parameters.get("FileListIcon", (10, 0, 20, 20))
		res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, png, None, None, BT_SCALE | BT_VALIGN_CENTER))
	return res
Exemple #26
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
Exemple #27
0
	def __init__(self):
		Renderer.__init__(self)
		VariableText.__init__(self)
		self.eDVBCIUIInstance = eDVBCI_UI.getInstance()
		self.eDVBCIUIInstance and self.eDVBCIUIInstance.ciStateChanged.get().append(self.ciModuleStateChanged)
		self.text = ""
		self.allVisible = False
		self.no_visible_state1 = "ciplushelper" in popen("top -n 1").read()
		self.colors = parameters.get("CiModuleControlColors", (0x007F7F7F, 0x00FFFF00, 0x0000FF00, 0x00FF2525)) # "state 0 (no module) gray", "state 1 (init module) yellow", "state 2 (module ready) green", "state -1 (error) red"
Exemple #28
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)
        ]
Exemple #29
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
Exemple #30
0
	def getText(self):
		assert self.type not in (self.LOCK, self.SLOT_NUMBER), "the text output of FrontendInfo cannot be used for lock info"
		percent = None
		swapsnr = config.usage.swap_snr_on_osd.value
		colors = parameters.get("FrontendInfoColors", (0x0000FF00, 0x00FFFF00, 0x007F7F7F)) # tuner active, busy, available colors
		if self.type == self.BER: # as count
			count = self.source.ber
			if count is not None:
				return str(count)
			else:
				return _("N/A")
		elif self.type == self.AGC:
			percent = self.source.agc
		elif (self.type == self.SNR and not swapsnr) or (self.type == self.SNRdB and swapsnr):
			percent = self.source.snr
		elif self.type == self.SNR or self.type == self.SNRdB:
			if self.source.snr_db is not None:
				return _("%3.01f dB") % (self.source.snr_db / 100.0)
			elif self.source.snr is not None: #fallback to normal SNR...
				percent = self.source.snr
		elif self.type == self.TUNER_TYPE:
			return self.source.frontend_type or _("Unknown")
		elif self.type == self.STRING:
			string = ""
			for n in nimmanager.nim_slots:
				if n.enabled:
					if n.slot == self.source.slot_number:
						color = Hex2strColor(colors[0])
					elif self.source.tuner_mask & 1 << n.slot:
						color = Hex2strColor(colors[1])
					elif len(nimmanager.nim_slots) <= self.space_for_tuners or n.isFBCRoot() or self.show_all_non_link_tuners and not(n.isFBCLink() or n.internally_connectable):
						color = Hex2strColor(colors[2])
					else:
						continue
					if string and len(nimmanager.nim_slots) <= self.space_for_tuners_with_spaces:
						string += " "
					string += color + chr(ord("A")+n.slot)
			return string
		if self.type == self.USE_TUNERS_STRING:
			string = ""
			for n in nimmanager.nim_slots:
				if n.enabled:
					if n.slot == self.source.slot_number:
						color = Hex2strColor(colors[0])
					elif self.source.tuner_mask & 1 << n.slot:
						color = Hex2strColor(colors[1])
					else:
						continue
					if string:
						string += " "
					string += color + chr(ord("A") + n.slot)
			return string
		if percent is None:
			return _("N/A")
		return "%d %%" % (percent * 100 / 65535)
Exemple #31
0
	def __init__(self, type=EPG_TYPE_SINGLE, selChangedCB=None, timer=None):
		EPGList.__init__(self, type, selChangedCB, timer)
		self.listSizeWidth = None
		self.screenwidth = getDesktop(0).size().width()
		if self.screenwidth and self.screenwidth == 1920:
			self.posx, self.posy , self.picx, self.picy, self.gap = skinparameter.get("EpgListIcon", (2,13,25,25,2))
		else:
			self.posx, self.posy , self.picx, self.picy, self.gap = skinparameter.get("EpgListIcon", (1,11,23,23,1))
		self.l.setBuildFunc(self.buildEPGSearchEntry)

		if PartnerBoxIconsEnabled:
			# Partnerbox Clock Icons
			self.partnerbox_clocks = [
				LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "Extensions/EPGSearch/icons/epgclock_add.png")),
				LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "Extensions/EPGSearch/icons/epgclock_pre.png")),
				LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "Extensions/EPGSearch/icons/epgclock.png")),
				LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "Extensions/EPGSearch/icons/epgclock_prepost.png")),
				LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "Extensions/EPGSearch/icons/epgclock_post.png")),
				LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "Extensions/EPGSearchicons/epgclock_add.png"))
			]
	def buildListboxEntry(self, timer):
		if not timer.enabled:
			icon = self.iconDisabled
		else:
			icon = self.iconEnabled
		if timer.justplay:
			rectypeicon = self.iconZapped
		else:
			rectypeicon = self.iconRecording

		height = self.l.getItemSize().height()
		width = self.l.getItemSize().width()
		iconMargin = self.iconMargin
		statusIconHeight = self.statusIconHeight
		statusIconWidth = self.statusIconWidth
		typeIconHeight = self.typeIconHeight
		typeIconWidth = self.typeIconWidth
		rowHeight = self.rowHeight
		rowSplit1 = self.rowSplit1
		rowSplit2 = self.rowSplit2
		channel = []
		for t in timer.services:
			channel.append(ServiceReference(t).getServiceName())
		if len(channel) >0 :
			channel = ", ".join(channel)
		else:
			channel = _('All channels')

		res = [ None ]
		if icon:
			if skinparms:
				x, y, w, h = parameters.get("AutotimerEnabledIcon",(iconMargin, 0, statusIconHeight, statusIconWidth))
			else:
				x, y, w, h = (iconMargin, 0, statusIconHeight, statusIconWidth)
			res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, icon))
		if rectypeicon:
			if skinparms:
				x, y, w, h = parameters.get("AutotimerRecordIcon",(iconMargin+statusIconWidth+iconMargin, 3, statusIconHeight, typeIconWidth))
			else:
				x, y, w, h = (iconMargin+statusIconWidth+iconMargin, 3, statusIconHeight, typeIconWidth)
			res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, rectypeicon))

		if timer.hasTimespan():
			nowt = time()
			now = localtime(nowt)
			begintime = int(mktime((now.tm_year, now.tm_mon, now.tm_mday, timer.timespan[0][0], timer.timespan[0][1], 0, now.tm_wday, now.tm_yday, now.tm_isdst)))
			endtime = int(mktime((now.tm_year, now.tm_mon, now.tm_mday, timer.timespan[1][0], timer.timespan[1][1], 0, now.tm_wday, now.tm_yday, now.tm_isdst)))
			timespan = (("  %s ... %s") % (FuzzyTime(begintime)[1], FuzzyTime(endtime)[1]))
		else:
			timespan = _("  Any time")
		res.append((eListboxPythonMultiContent.TYPE_TEXT, float(width)/10*4.5, 2, width-float(width)/10*4.5, rowHeight, 1, RT_HALIGN_RIGHT|RT_VALIGN_BOTTOM, timespan))

		if TextBoundary:
			timespanWidth = getTextBoundarySize(self.instance, self.EventNameFont, self.l.getItemSize(), timespan).width()
		else:
			timespanWidth = float(width)/10*2
		res.append((eListboxPythonMultiContent.TYPE_TEXT, statusIconWidth+typeIconWidth+iconMargin*3, 2, width-statusIconWidth-typeIconWidth-iconMargin*3- timespanWidth, rowHeight, 1, RT_HALIGN_LEFT|RT_VALIGN_BOTTOM, timer.name))

		if timer.hasTimeframe():
			begin = strftime("%a, %d %b", localtime(timer.getTimeframeBegin()))
			end = strftime("%a, %d %b", localtime(timer.getTimeframeEnd()))
			timeframe = (("%s ... %s") % (begin, end))
			res.append((eListboxPythonMultiContent.TYPE_TEXT, iconMargin, rowSplit1, float(width)/10*4.5, rowHeight, 2, RT_HALIGN_LEFT|RT_VALIGN_TOP, timeframe))

		if timer.include[3]:
			total = len(timer.include[3])
			count = 0
			days = []
			while count+1 <= total:
				day = timer.include[3][count]
				day = {
					'0': _("Mon"),
					'1': _("Tue"),
					'2': _("Wed"),
					'3': _("Thur"),
					'4': _("Fri"),
					'5': _("Sat"),
					'6': _("Sun"),
					"weekend": _("Weekend"),
					"weekday": _("Weekday")
					}[day]
				days.append(day)
				count += 1
			days = ', '.join(days)
		else:
			days = _("Everyday")
		res.append((eListboxPythonMultiContent.TYPE_TEXT, float(width)/10*5.5, rowSplit1, width-float(width)/10*5.5, rowHeight, 2, RT_HALIGN_RIGHT|RT_VALIGN_TOP, days))
		res.append((eListboxPythonMultiContent.TYPE_TEXT, iconMargin, rowSplit2, width-(iconMargin*2), rowHeight, 0, RT_HALIGN_LEFT|RT_VALIGN_TOP, channel))
		try:
			devide = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "div-h.png"))
		except:
			devide = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
		res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0, height-2, width, 2, devide))
		return res