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
def applySkin(self, desktop, parent): attribs = [] for (attrib, value) in self.skinAttributes: if attrib == "NumberOfItems": self.numberOfItems = int(value) attribs.append((attrib, value)) if attrib == "noLabel": self.hideLabel = int(value) attribs.append((attrib, value)) if attrib == "numOfSpaces": self.numOfSpaces = int(value) attribs.append((attrib, value)) if attrib == "timeColor": self.timecolor = Hex2strColor(parseColor(value).argb()) attribs.append((attrib, value)) if attrib == "labelColor": self.labelcolor = Hex2strColor(parseColor(value).argb()) attribs.append((attrib, value)) if attrib == "foregroundColor": self.foregroundColor = Hex2strColor(parseColor(value).argb()) attribs.append((attrib, value)) for (attrib, value) in attribs: self.skinAttributes.remove((attrib, value)) if self.timecolor == "": # fallback to foregroundColor self.timecolor = self.foregroundColor if self.labelcolor == "": # fallback to foregroundColor self.labelcolor = self.foregroundColor return Renderer.applySkin(self, desktop, parent)
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)
def createCryptoPowerVU(self, info): available_caids = info.getInfoObject(iServiceInformation.sCAIDs) if int('0xe00', 16) <= int(self.current_caid, 16) <= int('0xeff', 16): color = Hex2strColor(self.cryptocolors[0]) else: color = Hex2strColor(self.cryptocolors[1]) try: for caid in available_caids: if int('0xe00', 16) <= caid <= int('0xeff', 16): color = Hex2strColor(self.cryptocolors[2]) except: pass res = color + 'P' res += Hex2strColor(self.cryptocolors[3]) return res
def updateHddState(self, force=False): prev_state = self.isActive string = "" state = False if self.hdd_list: for hdd in self.hdd_list: if string and not self.notDiskLetterName: string += " " if (hdd[1].max_idle_time or force) and not hdd[1].isSleeping(): state = True if not self.notDiskLetterName: string += Hex2strColor(state and self.colors[1] or self.colors[0]) name = "I" if not hdd[1].internal: name = "E" elif not hdd[1].rotational: name = "S" string += name if not state: if self.allVisible: if self.notDiskLetterName: string = Hex2strColor(self.colors[0]) string += _("standby ") self.isActive = False idle = self.standby_time else: if self.notDiskLetterName: string = Hex2strColor(self.colors[1]) string += _("active ") self.isActive = True idle = self.idle_time if self.idle_time: timeout = len(self.hdd_list) > 1 and self.standby_time or idle self.timer.start(timeout * 100, True) else: self.isActive = False if string: string = _("Disk state: ") + string self.state_text = string if prev_state != self.isActive or force: if SystemInfo["LCDsymbol_hdd"]: open(SystemInfo["LCDsymbol_hdd"], "w").write(self.isActive and "1" or "0") self.changed((self.CHANGED_ALL, ))
def changed(self, what): if what == True or what[0] == self.CHANGED_SPECIFIC and what[ 1] == iPlayableService.evStart: string = "" NUM_CI = SystemInfo["CommonInterface"] if NUM_CI and NUM_CI > 0: if self.eDVBCIUIInstance: for slot in range(NUM_CI): state = self.eDVBCIUIInstance.getState(slot) if state == 1 and self.no_visible_state1: continue add_num = True if string: string += " " if state != -1: if state == 0: if not self.allVisible: string += "" add_num = False else: string += Hex2strColor( self.colors[0]) # no module elif state == 1: string += Hex2strColor( self.colors[1]) # init module elif state == 2: string += Hex2strColor( self.colors[2]) # module ready else: if not self.allVisible: string += "" add_num = False else: string += Hex2strColor(self.colors[3]) # error if add_num: string += "%d" % (slot + 1) if string: string = _("CI slot: ") + string self.text = string
def ShowECMInformation(self): from Components.Converter.PliExtraInfo import caid_data self.setTitle(_("Service Info: ECM Info")) tlist = [] provid = "" for caid in sorted(set( self.info.getInfoObject(iServiceInformation.sCAIDPIDs)), key=lambda x: (x[0], x[1])): CaIdDescription = _("Undefined") extra_info = "" for caid_entry in caid_data: if int(caid_entry[0], 16) <= caid[0] <= int(caid_entry[1], 16): CaIdDescription = caid_entry[2] break if caid[2]: if CaIdDescription == "Seca": provid = caid[2][:4] if CaIdDescription == "Nagra": provid = caid[2][-4:] if CaIdDescription == "Via": provid = caid[2][-6:] if provid: extra_info = "provid=%s" % provid else: extra_info = "extra data=%s" % caid[2] from Tools.GetEcmInfo import GetEcmInfo ecmdata = GetEcmInfo().getEcmData() color = Hex2strColor( parameters.get( "ServiceInfoEcmColor", 0x00ffbf00)) if caid[1] == int( ecmdata[3], 16) and caid[0] == int(ecmdata[1], 16) else "" tlist.append( ServiceInfoListEntry("%sECMPid %04X (%d) %04X-%s %s" % (color, caid[1], caid[1], caid[0], CaIdDescription, extra_info))) if not tlist: tlist.append(ServiceInfoListEntry(_("No ECMPids available"))) tlist.append(ServiceInfoListEntry(_("(FTA Service)"))) self["infolist"].l.setList(tlist)
def getText(self): value = config.misc.showrotorposition.value if SystemInfo["isRotorTuner"] and value != "no": if value.isdigit(): nim_text = nimmanager.rotorLastPositionForNim(int(value), number=False) if nim_text == _("undefined"): def frontendRotorPosition(slot): for x in nimmanager.nim_slots: if x.slot == slot: rotorposition = x.config.lastsatrotorposition.value if rotorposition.isdigit(): return orbpos(int(rotorposition)) return "" saved_text = frontendRotorPosition(int(value)) if saved_text: nim_text = saved_text return "%s:%s" % (Hex2strColor(self.colors[0]) + chr(ord("A") + int(value)), Hex2strColor(self.colors[1]) + nim_text) elif value == "all": all_text = "" for x in nimmanager.nim_slots: print("[RotorPosition] slot is %s" % x.slot) nim_text = nimmanager.rotorLastPositionForNim(x.slot, number=False) if nim_text != _("rotor is not used"): if nim_text == _("undefined"): rotorposition = x.config.lastsatrotorposition.value if rotorposition.isdigit(): nim_text = orbpos(int(rotorposition)) all_text += "%s:%s " % (Hex2strColor(self.colors[0]) + chr(ord("A") + x.slot), Hex2strColor(self.colors[1]) + nim_text) return all_text self.LastRotorPos = config.misc.lastrotorposition.value (rotor, tuner) = self.isMotorizedTuner() if rotor: self.actualizeCfgLastRotorPosition() if value == "withtext": return _("Rotor: ") + orbpos(config.misc.lastrotorposition.value) if value == "tunername": active_tuner = self.getActiveTuner() if tuner != active_tuner: return "%s:%s" % (Hex2strColor(self.colors[0]) + chr(ord("A") + tuner), Hex2strColor(self.colors[1]) + orbpos(config.misc.lastrotorposition.value)) return "" return orbpos(config.misc.lastrotorposition.value) return ""