How to use formatLine method in green

Best Python code snippet using green

Information.py

Source:Information.py Github

copy

Full Screen

...150 def getSummaryInformation(self):151 pass152 def createSummary(self):153 return InformationSummary154def formatLine(style, left, right=None):155 styleLen = len(style)156 leftStartColor = "" if styleLen > 0 and style[0] == "B" else "\c%08x" % (INFO_COLOR.get(style[0], "P") if styleLen > 0 else INFO_COLOR["P"])157 leftEndColor = "" if leftStartColor == "" else "\c%08x" % INFO_COLOR["N"]158 leftIndent = " " * int(style[1]) if styleLen > 1 and style[1].isdigit() else ""159 rightStartColor = "" if styleLen > 2 and style[2] == "B" else "\c%08x" % (INFO_COLOR.get(style[2], "V") if styleLen > 2 else INFO_COLOR["V"])160 rightEndColor = "" if rightStartColor == "" else "\c%08x" % INFO_COLOR["N"]161 rightIndent = " " * int(style[3]) if styleLen > 3 and style[3].isdigit() else ""162 if right is None:163 colon = "" if styleLen > 0 and style[0] in ("M", "P", "V") else ":"164 return "%s%s%s%s%s" % (leftIndent, leftStartColor, left, colon, leftEndColor)165 return "%s%s%s:%s|%s%s%s%s" % (leftIndent, leftStartColor, left, leftEndColor, rightIndent, rightStartColor, right, rightEndColor)166class BenchmarkInformation(InformationBase):167 def __init__(self, session):168 InformationBase.__init__(self, session)169 self.setTitle(_("Benchmark Information"))170 self.skinName.insert(0, "BenchmarkInformation")171 self.console = Console()172 self.cpuTypes = []173 self.cpuDhrystones = _("Calculating benchmark...")174 self.cpuBenchmark = _("Calculating benchmark...")175 self.cpuRating = _("Calculating rating...")176 self.ramBenchmark = _("Calculating benchmark...")177 def fetchInformation(self):178 self.informationTimer.stop()179 self.cpuTypes = []180 lines = []181 lines = fileReadLines("/proc/cpuinfo", lines)182 for line in lines:183 if line.startswith("model name"):184 self.cpuTypes.append([x.strip() for x in line.split(":")][1])185 self.console.ePopen(("/usr/bin/dhry", "/usr/bin/dhry"), self.cpuBenchmarkFinished)186 # Serialise the tests for better accuracy.187 # self.console.ePopen(("/usr/bin/streambench", "/usr/bin/streambench"), self.ramBenchmarkFinished)188 for callback in self.onInformationUpdated:189 callback()190 def cpuBenchmarkFinished(self, result, retVal, extraArgs):191 for line in result.split("\n"):192 if line.startswith("Dhrystones per Second"):193 self.cpuDhrystones = "%s Dhrystones per second" % [x.strip() for x in line.split(":")][1]194 if line.startswith("Open Vision DMIPS"):195 self.cpuBenchmark = "%s DMIPS per core" % [x.strip() for x in line.split(":")][1]196 if line.startswith("Open Vision CPU status"):197 self.cpuRating = [x.strip() for x in line.split(":")][1]198 # Serialise the tests for better accuracy.199 self.console.ePopen(("/usr/bin/streambench", "/usr/bin/streambench"), self.ramBenchmarkFinished)200 for callback in self.onInformationUpdated:201 callback()202 def ramBenchmarkFinished(self, result, retVal, extraArgs):203 for line in result.split("\n"):204 if line.startswith("Open Vision copy rate"):205 self.ramBenchmark = "%s MB/s copy rate" % [x.strip() for x in line.split(":")][1]206 for callback in self.onInformationUpdated:207 callback()208 def refreshInformation(self):209 self.cpuDhrystones = _("Calculating benchmark...")210 self.cpuBenchmark = _("Calculating benchmark...")211 self.cpuRating = _("Calculating rating...")212 self.ramBenchmark = _("Calculating benchmark...")213 self.informationTimer.start(25)214 for callback in self.onInformationUpdated:215 callback()216 def displayInformation(self):217 info = []218 info.append(formatLine("H", "%s %s %s" % (_("Benchmark for"), SystemInfo["MachineBrand"], SystemInfo["MachineModel"])))219 info.append("")220 for index, cpu in enumerate(self.cpuTypes):221 info.append(formatLine("P1", _("CPU / Core %d type") % index, cpu))222 info.append("")223 info.append(formatLine("P1", _("CPU Dhrystones"), self.cpuDhrystones))224 info.append(formatLine("P1", _("CPU benchmark"), self.cpuBenchmark))225 info.append(formatLine("P1", _("CPU rating"), self.cpuRating))226 info.append("")227 info.append(formatLine("P1", _("RAM benchmark"), self.ramBenchmark))228 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))229 def getSummaryInformation(self):230 return "Benchmark Information"231class BoxBrandingInformation(InformationBase):232 def __init__(self, session):233 InformationBase.__init__(self, session)234 self.setTitle(_("BoxBranding Information"))235 self.skinName.insert(0, "BoxBrandingInformation")236 def displayInformation(self):237 info = []238 info.append(formatLine("H", "%s %s %s" % (_("BoxBranding information for"), SystemInfo["MachineBrand"], SystemInfo["MachineModel"])))239 info.append("")240 for method in sorted(boxbranding.__dict__.keys()):241 if callable(getattr(boxbranding, method)):242 info.append(formatLine("P1", method, getattr(boxbranding, method)()))243 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))244 def getSummaryInformation(self):245 return "Build Information"246class CommitLogInformation(InformationBase):247 def __init__(self, session):248 InformationBase.__init__(self, session)249 self.baseTitle = _("Commit Information")250 self.setTitle(self.baseTitle)251 self.skinName.insert(0, "CommitLogInformation")252 self["commitActions"] = HelpableActionMap(self, ["NavigationActions"], {253 "left": (self.previousCommit, _("Display previous commit log")),254 "right": (self.nextCommit, _("Display next commit log")),255 }, prio=0, description=_("Commit Information Actions"))256 try:257 branch = "?sha=" + "-".join(about.getEnigmaVersionString().split("-")[3:])258 except Exception as err:259 branch = ""260 self.projects = [261 ("OpenVision Enigma2", "https://api.github.com/repos/OpenVisionE2/enigma2-openvision/commits%s" % branch),262 ("OpenVision OpenEmbedded", "https://api.github.com/repos/OpenVisionE2/revision/commits"),263 ("Enigma2 Plugins", "https://api.github.com/repos/OpenVisionE2/enigma2-plugins/commits"),264 ("Extra Plugins", "https://api.github.com/repos/OpenVisionE2/extra-plugins/commits"),265 ("OpenWebIF", "https://api.github.com/repos/OpenVisionE2/OpenWebif/commits"),266 ("OpenVision Core Plugin", "https://api.github.com/repos/OpenVisionE2/openvision-core-plugin/commits"),267 ("Backup Suite Plugin", "https://api.github.com/repos/OpenVisionE2/BackupSuite/commits"),268 ("OctEtFHD Skin", "https://api.github.com/repos/OpenVisionE2/OctEtFHD-skin/commits")269 ]270 self.project = 0271 self.cachedProjects = {}272 self.log = _("Retrieving %s commit log, please wait...") % self.projects[self.project][0]273 def previousCommit(self):274 self.project = self.project == 0 and len(self.projects) - 1 or self.project - 1275 self.log = _("Retrieving %s commit log, please wait...") % self.projects[self.project][0]276 self.informationTimer.start(25)277 def nextCommit(self):278 self.project = self.project != len(self.projects) - 1 and self.project + 1 or 0279 self.log = _("Retrieving %s commit log, please wait...") % self.projects[self.project][0]280 self.informationTimer.start(25)281 def fetchInformation(self):282 # Limit the number of fetches per minute!283 self.informationTimer.stop()284 name = self.projects[self.project][0]285 url = self.projects[self.project][1]286 log = []287 try:288 try:289 rawLog = loads(urlopen(url, timeout=10, context=_create_unverified_context()).read())290 except Exception as err:291 rawLog = loads(urlopen(url, timeout=10).read())292 for data in rawLog:293 date = datetime.strptime(data["commit"]["committer"]["date"], "%Y-%m-%dT%H:%M:%SZ").strftime("%x %X")294 creator = data["commit"]["author"]["name"]295 title = data["commit"]["message"]296 if log:297 log.append("")298 log.append("%s %s" % (date, creator))299 log.append(title)300 if log:301 log = "\n".join(log).encode("UTF-8", "ignore") if PY2 else "\n".join(log)302 self.cachedProjects[name] = log303 else:304 log = _("The %s commit log contains no information.") % name305 except Exception as err:306 log.append(_("Error '%s' encountered retrieving the %s commit logs!") % (str(err), name))307 log.append("")308 log.append(_("The %s commit logs can't be retrieved, please try again later.") % name)309 log.append("")310 log.append(_("Access to the %s commit logs requires an internet connection.") % name)311 log = "\n".join(log)312 self.log = log313 for callback in self.onInformationUpdated:314 callback()315 def refreshInformation(self):316 # Limit the number of fetches per minute!317 self.cachedProjects = {}318 self.log = _("Retrieving %s commit log, please wait...") % self.projects[self.project][0]319 self.informationTimer.start(25)320 for callback in self.onInformationUpdated:321 callback()322 def displayInformation(self):323 name = self.projects[self.project][0]324 self.setTitle("%s - %s" % (self.baseTitle, name))325 if name in self.cachedProjects:326 self["information"].setText(self.cachedProjects[name])327 elif self.log:328 self["information"].setText(self.log)329 else:330 self["information"].setText(_("The %s commit log contains no information.") % name)331class GeolocationInformation(InformationBase):332 def __init__(self, session):333 InformationBase.__init__(self, session)334 self.setTitle(_("Geolocation Information"))335 self.skinName.insert(0, "GeolocationInformation")336 def displayInformation(self):337 info = []338 geolocationData = geolocation.getGeolocationData(fields="continent,country,regionName,city,lat,lon,timezone,currency,isp,org,mobile,proxy,query", useCache=False)339 if geolocationData.get("status", None) == "success":340 info.append(formatLine("H", _("Location information")))341 info.append("")342 continent = geolocationData.get("continent", None)343 if continent:344 info.append(formatLine("P1", _("Continent"), continent))345 country = geolocationData.get("country", None)346 if country:347 info.append(formatLine("P1", _("Country"), country))348 state = geolocationData.get("regionName", None)349 if state:350 info.append(formatLine("P1", _("State"), state))351 city = geolocationData.get("city", None)352 if city:353 info.append(formatLine("P1", _("City"), city))354 latitude = geolocationData.get("lat", None)355 if latitude:356 info.append(formatLine("P1", _("Latitude"), latitude))357 longitude = geolocationData.get("lon", None)358 if longitude:359 info.append(formatLine("P1", _("Longitude"), longitude))360 info.append("")361 info.append(formatLine("H", _("Local information")))362 info.append("")363 timezone = geolocationData.get("timezone", None)364 if timezone:365 info.append(formatLine("P1", _("Timezone"), timezone))366 currency = geolocationData.get("currency", None)367 if currency:368 info.append(formatLine("P1", _("Currency"), currency))369 info.append("")370 info.append(formatLine("H", _("Connection information")))371 info.append("")372 isp = geolocationData.get("isp", None)373 if isp:374 ispOrg = geolocationData.get("org", None)375 if ispOrg:376 info.append(formatLine("P1", _("ISP"), "%s (%s)" % (isp, ispOrg)))377 else:378 info.append(formatLine("P1", _("ISP"), isp))379 mobile = geolocationData.get("mobile", None)380 info.append(formatLine("P1", _("Mobile connection"), (_("Yes") if mobile else _("No"))))381 proxy = geolocationData.get("proxy", False)382 info.append(formatLine("P1", _("Proxy detected"), (_("Yes") if proxy else _("No"))))383 publicIp = geolocationData.get("query", None)384 if publicIp:385 info.append(formatLine("P1", _("Public IP"), publicIp))386 else:387 info.append(_("Geolocation information cannot be retrieved, please try again later."))388 info.append("")389 info.append(_("Access to geolocation information requires an internet connection."))390 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))391 def getSummaryInformation(self):392 return "Geolocation Information"393class ImageInformation(InformationBase):394 def __init__(self, session):395 InformationBase.__init__(self, session)396 self.setTitle(_("OpenVision Information"))397 self.skinName.insert(0, "ImageInformation")398 self["key_yellow"] = StaticText(_("Commit Logs"))399 self["key_blue"] = StaticText(_("Translation"))400 self["receiverActions"] = HelpableActionMap(self, ["ColorActions"], {401 "yellow": (self.showCommitLogs, _("Show latest commit log information")),402 "blue": (self.showTranslation, _("Show translation information"))403 }, prio=0, description=_("OpenVision Information Actions"))404 self.copyright = str("\xc2\xb0")405 self.resolutions = {406 480: _("NTSC"),407 576: _("PAL"),408 720: _("HD"),409 1080: _("FHD"),410 2160: _("4K"),411 4320: _("8K"),412 8640: _("16K")413 }414 def showCommitLogs(self):415 self.session.openWithCallback(self.informationWindowClosed, CommitLogInformation)416 def showTranslation(self):417 self.session.openWithCallback(self.informationWindowClosed, TranslationInformation)418 def displayInformation(self):419 info = []420 info.append(formatLine("M", _("Copyright %s 2018-%s Team OpenVision") % (u"\u00A9", localtime()[0])))421 info.append("")422 info.append(formatLine("M", _("OpenVision is an open source project with no commercial funding.")))423 info.append(formatLine("M", _("The team relies on donations to fund OpenVision development.")))424 info.append(formatLine("M", _("If you would like to support us then please consider donating.")))425 info.append("")426 info.append(formatLine("M", _("Donate at %s") % "https://forum.openvision.tech/app.php/donate"))427 info.append("")428 visionVersion = fileReadLine("/etc/openvision/visionversion", boxbranding.getVisionVersion())429 info.append(formatLine("P1", _("OpenVision version"), visionVersion))430 visionRevision = fileReadLine("/etc/openvision/visionrevision", boxbranding.getVisionRevision())431 info.append(formatLine("P1", _("OpenVision revision"), visionRevision))432 if config.misc.OVupdatecheck.value:433 ovUrl = "https://raw.githubusercontent.com/OpenVisionE2/revision/master/%s.conf" % ("new" if boxbranding.getVisionVersion().startswith("10") else "old")434 try:435 ovResponse = urlopen(ovUrl)436 ovRevision = ovResponse.read().decode() if PY2 else ovResponse.read()437 ovRevisionUpdate = ovRevision[1:]438 except Exception as err:439 ovRevisionUpdate = _("Requires internet connection")440 else:441 ovRevisionUpdate = _("Disabled in configuration")442 info.append(formatLine("P1", _("Latest revision on github"), ovRevisionUpdate))443 visionLanguage = fileReadLine("/etc/openvision/visionlanguage")444 if visionLanguage:445 info.append(formatLine("P1", _("OpenVision language"), visionLanguage))446 info.append(formatLine("P1", _("OpenVision module"), about.getVisionModule()))447 multibootFlag = _("Yes") if fileReadLine("/etc/openvision/multiboot", "1") else _("No")448 info.append(formatLine("P1", _("Soft multiboot"), multibootFlag))449 info.append(formatLine("P1", _("Flash type"), about.getFlashType()))450 xResolution = getDesktop(0).size().width()451 yResolution = getDesktop(0).size().height()452 info.append(formatLine("P1", _("Skin & Resolution"), "%s [%s (%s x %s)]") % (config.skin.primary_skin.value.split('/')[0], self.resolutions.get(yResolution, "Unknown"), xResolution, yResolution))453 info.append("")454 info.append(formatLine("H", _("Enigma2 information")))455 info.append("")456 # [WanWizard] Removed until we find a reliable way to determine the installation date457 # info.append(_("Installed:|%s") % about.getFlashDateString())458 enigmaVersion = about.getEnigmaVersionString()459 enigmaVersion = enigmaVersion.rsplit("-", enigmaVersion.count("-") - 2)460 if len(enigmaVersion) == 3:461 enigmaVersion = "%s (%s-%s)" % (enigmaVersion[0], enigmaVersion[2], enigmaVersion[1].capitalize())462 else:463 enigmaVersion = "%s (%s)" % (enigmaVersion[0], enigmaVersion[1].capitalize())464 info.append(formatLine("P1", _("Enigma2 version"), enigmaVersion))465 info.append(formatLine("P1", _("Enigma2 revision"), getE2Rev()))466 info.append(formatLine("P1", _("GitHub commit"), getE2Rev().split("+")[1]))467 info.append(formatLine("P1", _("Last update"), about.getUpdateDateString()))468 info.append(formatLine("P1", _("Enigma2 (re)starts"), config.misc.startCounter.value))469 info.append(formatLine("P1", _("Enigma2 debug level"), eGetEnigmaDebugLvl()))470 mediaService = fileReadLine("/etc/openvision/mediaservice")471 if mediaService:472 info.append(formatLine("P1", _("Media service"), mediaService.replace("enigma2-plugin-systemplugins-", "")))473 info.append("")474 info.append(formatLine("H", _("Build information")))475 info.append("")476 info.append(formatLine("P1", _("Image"), boxbranding.getImageDistro()))477 info.append(formatLine("P1", _("Image build/branch"), boxbranding.getImageBuild()))478 info.append(formatLine("P1", _("Image build date"), about.getBuildDateString()))479 info.append(formatLine("P1", _("Image architecture"), boxbranding.getImageArch()))480 if boxbranding.getImageFolder():481 info.append(formatLine("P1", _("Image folder"), boxbranding.getImageFolder()))482 if boxbranding.getImageFileSystem():483 info.append(formatLine("P1", _("Image file system"), boxbranding.getImageFileSystem().strip()))484 info.append(formatLine("P1", _("Feed URL"), boxbranding.getFeedsUrl()))485 info.append(formatLine("P1", _("Compiled by"), boxbranding.getDeveloperName()))486 info.append("")487 info.append(formatLine("H", _("Software information")))488 info.append("")489 info.append(formatLine("P1", _("GStreamer version"), about.getGStreamerVersionString().replace("GStreamer", "")))490 info.append(formatLine("P1", _("FFmpeg version"), about.getFFmpegVersionString()))491 info.append(formatLine("P1", _("Python version"), about.getPythonVersionString()))492 bootId = fileReadLine("/proc/sys/kernel/random/boot_id")493 if bootId:494 info.append(formatLine("P1", _("Boot ID"), bootId))495 uuId = fileReadLine("/proc/sys/kernel/random/uuid")496 if uuId:497 info.append(formatLine("P1", _("Boot ID"), uuId))498 info.append("")499 info.append(formatLine("H", _("Boot information")))500 info.append("")501 if boxbranding.getMachineMtdBoot():502 info.append(formatLine("P1", _("MTD boot"), boxbranding.getMachineMtdBoot()))503 if boxbranding.getMachineMtdRoot():504 info.append(formatLine("P1", _("MTD root"), boxbranding.getMachineMtdRoot()))505 if boxbranding.getMachineMtdKernel():506 info.append(formatLine("P1", _("MTD kernel"), boxbranding.getMachineMtdKernel()))507 if boxbranding.getMachineRootFile():508 info.append(formatLine("P1", _("Root file"), boxbranding.getMachineRootFile()))509 if boxbranding.getMachineKernelFile():510 info.append(formatLine("P1", _("Kernel file"), boxbranding.getMachineKernelFile()))511 if boxbranding.getMachineMKUBIFS():512 info.append(formatLine("P1", _("MKUBIFS"), boxbranding.getMachineMKUBIFS()))513 if boxbranding.getMachineUBINIZE():514 info.append(formatLine("P1", _("UBINIZE"), boxbranding.getMachineUBINIZE()))515 if SystemInfo["HiSilicon"]:516 info.append("")517 info.append(formatLine("H", _("HiSilicon specific information")))518 info.append("")519 packageList = check_output(["/usr/bin/opkg", "list-installed"])520 packageList = packageList.split("\n")521 revision = self.findPackageRevision("grab", packageList)522 if revision and revision != "r0":523 info.append(formatLine("P1", _("Grab"), revision))524 revision = self.findPackageRevision("hihalt", packageList)525 if revision:526 info.append(formatLine("P1", _("Halt"), revision))527 revision = self.findPackageRevision("libs", packageList)528 if revision:529 info.append(formatLine("P1", _("Libs"), revision))530 revision = self.findPackageRevision("partitions", packageList)531 if revision:532 info.append(formatLine("P1", _("Partitions"), revision))533 revision = self.findPackageRevision("reader", packageList)534 if revision:535 info.append(formatLine("P1", _("Reader"), revision))536 revision = self.findPackageRevision("showiframe", packageList)537 if revision:538 info.append(formatLine("P1", _("Showiframe"), revision))539 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))540 def findPackageRevision(self, package, packageList):541 revision = None542 data = [x for x in packageList if "-%s" % package in x]543 if data:544 data = data[0].split("-")545 if len(data) >= 4:546 revision = data[3]547 return revision548 def getSummaryInformation(self):549 return "OpenVision Information"550class MemoryInformation(InformationBase):551 def __init__(self, session):552 InformationBase.__init__(self, session)553 self.setTitle(_("Memory Information"))554 self.skinName.insert(0, "MemoryInformation")555 self["clearActions"] = HelpableActionMap(self, ["ColorActions"], {556 "yellow": (self.clearMemoryInformation, _("Clear the virtual memory caches"))557 }, prio=0, description=_("Memory Information Actions"))558 self["key_yellow"] = StaticText(_("Clear"))559 def displayInformation(self):560 info = []561 memInfo = fileReadLines("/proc/meminfo")562 info.append(formatLine("H", _("RAM (Summary)")))563 info.append("")564 for line in memInfo:565 key, value, units = [x for x in line.split()]566 if key == "MemTotal:":567 info.append(formatLine("P1", _("Total memory"), "%s %s" % (value, units)))568 if key == "MemFree:":569 info.append(formatLine("P1", _("Free memory"), "%s %s" % (value, units)))570 if key == "Buffers:":571 info.append(formatLine("P1", _("Buffers"), "%s %s" % (value, units)))572 if key == "Cached:":573 info.append(formatLine("P1", _("Cached"), "%s %s" % (value, units)))574 if key == "SwapTotal:":575 info.append(formatLine("P1", _("Total swap"), "%s %s" % (value, units)))576 if key == "SwapFree:":577 info.append(formatLine("P1", _("Free swap"), "%s %s" % (value, units)))578 info.append("")579 info.append(formatLine("H", _("FLASH")))580 info.append("")581 stat = statvfs("/")582 diskSize = stat.f_blocks * stat.f_frsize583 diskFree = stat.f_bfree * stat.f_frsize584 diskUsed = diskSize - diskFree585 info.append(formatLine("P1", _("Total flash"), "%s (%s)" % (scaleNumber(diskSize), scaleNumber(diskSize, "Iec"))))586 info.append(formatLine("P1", _("Used flash"), "%s (%s)" % (scaleNumber(diskUsed), scaleNumber(diskUsed, "Iec"))))587 info.append(formatLine("P1", _("Free flash"), "%s (%s)" % (scaleNumber(diskFree), scaleNumber(diskFree, "Iec"))))588 info.append("")589 info.append(formatLine("H", _("RAM (Details)")))590 info.append("")591 for line in memInfo:592 key, value, units = [x for x in line.split()]593 info.append(formatLine("P1", key[:-1], "%s %s" % (value, units)))594 info.append("")595 info.append(formatLine("P1", _("The detailed information is intended for developers only.")))596 info.append(formatLine("P1", _("Please don't panic if you see values that look suspicious.")))597 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))598 def clearMemoryInformation(self):599 eConsoleAppContainer().execute(*["/bin/sync", "/bin/sync"])600 fileWriteLine("/proc/sys/vm/drop_caches", "3")601 self.informationTimer.start(25)602 for callback in self.onInformationUpdated:603 callback()604 def getSummaryInformation(self):605 return "Memory Information Data"606class MultiBootInformation(InformationBase):607 def __init__(self, session):608 InformationBase.__init__(self, session)609 self.setTitle(_("MultiBoot Information"))610 self.skinName.insert(0, "MemoryInformation")611 def fetchInformation(self):612 self.informationTimer.stop()613 for callback in self.onInformationUpdated:614 callback()615 def displayInformation(self):616 info = []617 info.append(_("This screen is not yet available."))618 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))619 def getSummaryInformation(self):620 return "MultiBoot Information Data"621class NetworkInformation(InformationBase):622 def __init__(self, session):623 InformationBase.__init__(self, session)624 self.setTitle(_("Network Information"))625 self.skinName = ["NetworkInformation", "WlanStatus"]626 self["key_yellow"] = StaticText(_("WAN Geolocation"))627 self["geolocationActions"] = HelpableActionMap(self, ["ColorActions"], {628 "yellow": (self.useGeolocation, _("Use geolocation to get WAN information")),629 }, prio=0, description=_("Network Information Actions"))630 self.console = Console()631 self.interfaceData = {}632 self.geolocationData = []633 self.ifconfigAttributes = {634 "Link encap": "encapsulation",635 "HWaddr": "mac",636 "inet addr": "addr",637 "Bcast": "brdaddr",638 "Mask": "nmask",639 "inet6 addr": "addr6",640 "Scope": "scope",641 "MTU": "mtu",642 "Metric": "metric",643 "RX packets": "rxPackets",644 "rxerrors": "rxErrors",645 "rxdropped": "rxDropped",646 "rxoverruns": "rxOverruns",647 "rxframe": "rxFrame",648 "TX packets": "txPackets",649 "txerrors": "txErrors",650 "txdropped": "txDropped",651 "txoverruns": "txOverruns",652 "collisions": "txCollisions",653 "txqueuelen": "txQueueLen",654 "RX bytes": "rxBytes",655 "TX bytes": "txBytes"656 }657 self.iwconfigAttributes = {658 "interface": "interface",659 "standard": "standard",660 "ESSID": "ssid",661 "Mode": "mode",662 "Frequency": "frequency",663 "Access Point": "accessPoint",664 "Bit Rate": "bitrate",665 "Tx-Power": "transmitPower",666 "Retry short limit": "retryLimit",667 "RTS thr": "rtsThrottle",668 "Fragment thr": "fragThrottle",669 "Encryption key": "encryption",670 "Power Management": "powerManagement",671 "Link Quality": "signalQuality",672 "Signal level": "signalStrength",673 "Rx invalid nwid": "rxInvalidNwid",674 "Rx invalid crypt": "rxInvalidCrypt",675 "Rx invalid frag": "rxInvalidFrag",676 "Tx excessive retries": "txExcessiveReties",677 "Invalid misc": "invalidMisc",678 "Missed beacon": "missedBeacon"679 }680 self.ethtoolAttributes = {681 "Speed": "speed",682 "Duplex": "duplex",683 "Transceiver": "transceiver",684 "Auto-negotiation": "autoNegotiation",685 "Link detected": "link"686 }687 def useGeolocation(self):688 geolocationData = geolocation.getGeolocationData(fields="isp,org,mobile,proxy,query", useCache=False)689 info = []690 if geolocationData.get("status", None) == "success":691 info.append("")692 info.append(formatLine("H", _("WAN connection information")))693 isp = geolocationData.get("isp", None)694 if isp:695 ispOrg = geolocationData.get("org", None)696 if ispOrg:697 info.append(formatLine("P1", _("ISP"), "%s (%s)" % (isp, ispOrg)))698 else:699 info.append(formatLine("P1", _("ISP"), isp))700 mobile = geolocationData.get("mobile", None)701 info.append(formatLine("P1", _("Mobile connection"), (_("Yes") if mobile else _("No"))))702 proxy = geolocationData.get("proxy", False)703 info.append(formatLine("P1", _("Proxy detected"), (_("Yes") if proxy else _("No"))))704 publicIp = geolocationData.get("query", None)705 if publicIp:706 info.append(formatLine("P1", _("Public IP"), publicIp))707 else:708 info.append(_("Geolocation information cannot be retrieved, please try again later."))709 info.append("")710 info.append(_("Access to geolocation information requires an internet connection."))711 self.geolocationData = info712 for callback in self.onInformationUpdated:713 callback()714 def fetchInformation(self):715 self.informationTimer.stop()716 for interface in sorted([x for x in listdir("/sys/class/net") if not self.isBlacklisted(x)]):717 self.interfaceData[interface] = {}718 self.console.ePopen(("/sbin/ifconfig", "/sbin/ifconfig", interface), self.ifconfigInfoFinished, extra_args=interface)719 if iNetwork.isWirelessInterface(interface):720 self.console.ePopen(("/sbin/iwconfig", "/sbin/iwconfig", interface), self.iwconfigInfoFinished, extra_args=interface)721 else:722 self.console.ePopen(("/usr/sbin/ethtool", "/usr/sbin/ethtool", interface), self.ethtoolInfoFinished, extra_args=interface)723 for callback in self.onInformationUpdated:724 callback()725 def isBlacklisted(self, interface):726 for type in ("lo", "wifi", "wmaster", "sit", "tun", "sys", "p2p"):727 if interface.startswith(type):728 return True729 return False730 def ifconfigInfoFinished(self, result, retVal, extraArgs): # This temporary code borrowed and adapted from the new but unreleased Network.py!731 if retVal == 0:732 capture = False733 data = ""734 for line in result.split("\n"):735 if line.startswith("%s " % extraArgs):736 capture = True737 if "HWaddr " in line:738 line = line.replace("HWaddr ", "HWaddr:")739 data += line740 continue741 if capture and line.startswith(" "):742 if " Scope:" in line:743 line = line.replace(" Scope:", " ")744 elif "X packets:" in line:745 pos = line.index("X packets:")746 direction = line[pos - 1:pos].lower()747 line = "%s%s" % (line[0:pos + 10], line[pos + 10:].replace(" ", " %sx" % direction))748 elif " txqueuelen" in line:749 line = line.replace(" txqueuelen:", " txqueuelen:")750 data += line751 continue752 if line == "":753 break754 data = list(filter(None, [x.strip().replace("=", ":", 1) for x in data.split(" ")]))755 data[0] = "interface:%s" % data[0]756 # print("[Network] DEBUG: Raw network data %s." % data)757 for item in data:758 if ":" not in item:759 flags = item.split()760 self.interfaceData[extraArgs]["up"] = True if "UP" in flags else False761 self.interfaceData[extraArgs]["status"] = "up" if "UP" in flags else "down" # Legacy status flag.762 self.interfaceData[extraArgs]["running"] = True if "RUNNING" in flags else False763 self.interfaceData[extraArgs]["broadcast"] = True if "BROADCAST" in flags else False764 self.interfaceData[extraArgs]["multicast"] = True if "MULTICAST" in flags else False765 continue766 key, value = item.split(":", 1)767 key = self.ifconfigAttributes.get(key, None)768 if key:769 value = value.strip()770 if value.startswith("\""):771 value = value[1:-1]772 if key == "addr6":773 if key not in self.interfaceData[extraArgs]:774 self.interfaceData[extraArgs][key] = []775 self.interfaceData[extraArgs][key].append(value)776 else:777 self.interfaceData[extraArgs][key] = value778 for callback in self.onInformationUpdated:779 callback()780 def iwconfigInfoFinished(self, result, retVal, extraArgs): # This temporary code borrowed and adapted from the new but unreleased Network.py!781 if retVal == 0:782 capture = False783 data = ""784 for line in result.split("\n"):785 if line.startswith("%s " % extraArgs):786 capture = True787 data += line788 continue789 if capture and line.startswith(" "):790 data += line791 continue792 if line == "":793 break794 data = list(filter(None, [x.strip().replace("=", ":", 1) for x in data.split(" ")]))795 data[0] = "interface:%s" % data[0]796 data[1] = "standard:%s" % data[1]797 for item in data:798 if ":" not in item:799 continue800 key, value = item.split(":", 1)801 key = self.iwconfigAttributes.get(key, None)802 if key:803 value = value.strip()804 if value.startswith("\""):805 value = value[1:-1]806 self.interfaceData[extraArgs][key] = value807 if "encryption" in self.interfaceData[extraArgs]:808 self.interfaceData[extraArgs]["encryption"] = _("Disabled or WPA/WPA2") if self.interfaceData[extraArgs]["encryption"] == "off" else _("Enabled")809 if "standard" in self.interfaceData[extraArgs] and "no wireless extensions" in self.interfaceData[extraArgs]["standard"]:810 del self.interfaceData[extraArgs]["standard"]811 self.interfaceData[extraArgs]["wireless"] = False812 else:813 self.interfaceData[extraArgs]["wireless"] = True814 if "ssid" in self.interfaceData[extraArgs]:815 self.interfaceData[extraArgs]["SSID"] = self.interfaceData[extraArgs]["ssid"]816 for callback in self.onInformationUpdated:817 callback()818 def ethtoolInfoFinished(self, result, retVal, extraArgs): # This temporary code borrowed and adapted from the new but unreleased Network.py!819 if retVal == 0:820 for line in result.split("\n"):821 if "Speed:" in line:822 self.interfaceData[extraArgs]["speed"] = line.split(":")[1][:-4].strip()823 if "Duplex:" in line:824 self.interfaceData[extraArgs]["duplex"] = _(line.split(":")[1].strip().capitalize())825 if "Transceiver:" in line:826 self.interfaceData[extraArgs]["transeiver"] = _(line.split(":")[1].strip().capitalize())827 if "Auto-negotiation:" in line:828 self.interfaceData[extraArgs]["autoNegotiation"] = line.split(":")[1].strip().lower() == "on"829 if "Link detected:" in line:830 self.interfaceData[extraArgs]["link"] = line.split(":")[1].strip().lower() == "yes"831 for callback in self.onInformationUpdated:832 callback()833 def displayInformation(self):834 info = []835 hostname = fileReadLine("/proc/sys/kernel/hostname")836 info.append(formatLine("H0H", _("Hostname"), hostname))837 for interface in sorted(list(self.interfaceData.keys())):838 info.append("")839 info.append(formatLine("H", _("Interface '%s'") % interface, iNetwork.getFriendlyAdapterName(interface)))840 if "up" in self.interfaceData[interface]:841 info.append(formatLine("P1", _("Status"), (_("Up") if self.interfaceData[interface]["up"] else _("Down"))))842 if self.interfaceData[interface]["up"]:843 if "addr" in self.interfaceData[interface]:844 info.append(formatLine("P1", _("IP address"), self.interfaceData[interface]["addr"]))845 if "nmask" in self.interfaceData[interface]:846 info.append(formatLine("P1", _("Netmask"), self.interfaceData[interface]["nmask"]))847 if "brdaddr" in self.interfaceData[interface]:848 info.append(formatLine("P1", _("Broadcast address"), self.interfaceData[interface]["brdaddr"]))849 if "addr6" in self.interfaceData[interface]:850 for addr6 in self.interfaceData[interface]["addr6"]:851 addr, scope = addr6.split()852 info.append(formatLine("P1", _("IPv6 address"), _("%s - Scope: %s") % (addr, scope)))853 if "mac" in self.interfaceData[interface]:854 info.append(formatLine("P1", _("MAC address"), self.interfaceData[interface]["mac"]))855 if "speed" in self.interfaceData[interface]:856 info.append(formatLine("P1", _("Speed"), "%s Mbps" % self.interfaceData[interface]["speed"]))857 if "duplex" in self.interfaceData[interface]:858 info.append(formatLine("P1", _("Duplex"), self.interfaceData[interface]["duplex"]))859 if "mtu" in self.interfaceData[interface]:860 info.append(formatLine("P1", _("MTU"), self.interfaceData[interface]["mtu"]))861 if "link" in self.interfaceData[interface]:862 info.append(formatLine("P1", _("Link detected"), (_("Yes") if self.interfaceData[interface]["link"] else _("No"))))863 if "ssid" in self.interfaceData[interface]:864 info.append(formatLine("P1", _("SSID"), self.interfaceData[interface]["ssid"]))865 if "standard" in self.interfaceData[interface]:866 info.append(formatLine("P1", _("Standard"), self.interfaceData[interface]["standard"]))867 if "encryption" in self.interfaceData[interface]:868 info.append(formatLine("P1", _("Encryption"), self.interfaceData[interface]["encryption"]))869 if "frequency" in self.interfaceData[interface]:870 info.append(formatLine("P1", _("Frequency"), self.interfaceData[interface]["frequency"]))871 if "accessPoint" in self.interfaceData[interface]:872 info.append(formatLine("P1", _("Access point"), self.interfaceData[interface]["accessPoint"]))873 if "bitrate" in self.interfaceData[interface]:874 info.append(formatLine("P1", _("Bit rate"), self.interfaceData[interface]["bitrate"]))875 if "signalQuality" in self.interfaceData[interface]:876 info.append(formatLine("P1", _("Signal quality"), self.interfaceData[interface]["signalQuality"]))877 if "signalStrength" in self.interfaceData[interface]:878 info.append(formatLine("P1", _("Signal strength"), self.interfaceData[interface]["signalStrength"]))879 if "rxBytes" in self.interfaceData[interface] or "txBytes" in self.interfaceData[interface]:880 info.append("")881 info.append(formatLine("P1", _("Bytes received"), self.interfaceData[interface]["rxBytes"]))882 info.append(formatLine("P1", _("Bytes sent"), self.interfaceData[interface]["txBytes"]))883 info += self.geolocationData884 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))885class ReceiverInformation(InformationBase):886 def __init__(self, session):887 InformationBase.__init__(self, session)888 self.setTitle(_("Receiver Information"))889 self.skinName.insert(0, "ReceiverInformation")890 self["key_yellow"] = StaticText(_("System"))891 self["key_blue"] = StaticText(_("Benchmark"))892 self["receiverActions"] = HelpableActionMap(self, ["ColorActions"], {893 "yellow": (self.showSystem, _("Show system information")),894 "blue": (self.showBenchmark, _("Show benchmark information"))895 }, prio=0, description=_("Receiver Information Actions"))896 self.degree = str("\xc2\xb0C")897 def showSystem(self):898 self.session.openWithCallback(self.informationWindowClosed, SystemInformation)899 def showBenchmark(self):900 self.session.openWithCallback(self.informationWindowClosed, BenchmarkInformation)901 def displayInformation(self):902 model = SystemInfo["MachineModel"]903 info = []904 info.append(formatLine("H", _("Hardware information")))905 info.append("")906 stbPlatform = boxbranding.getMachineBuild()907 info.append(formatLine("P1", _("Hardware"), "%s %s" % (SystemInfo["MachineBrand"], SystemInfo["MachineModel"])))908 if stbPlatform != model:909 info.append(formatLine("P1", _("Platform"), stbPlatform))910 try:911 procModel = getBoxProc()912 except Exception as err:913 procModel = boxbranding.getMachineProcModel()914 if procModel != model:915 info.append(formatLine("P1", _("Proc model"), procModel))916 procModelType = getBoxProcType()917 if procModelType and procModelType != "unknown":918 info.append(formatLine("P1", _("Hardware type"), procModelType))919 hwSerial = getHWSerial()920 if hwSerial:921 info.append(formatLine("P1", _("Hardware serial"), (hwSerial if hwSerial != "unknown" else about.getCPUSerial())))922 hwRelease = fileReadLine("/proc/stb/info/release")923 if hwRelease:924 info.append(formatLine("P1", _("Factory release"), hwRelease))925 info.append(formatLine("P1", _("Brand/Meta"), SystemInfo["MachineBrand"]))926 if not boxbranding.getDisplayType().startswith(" "):927 info.append(formatLine("P1", _("Front panel type"), boxbranding.getDisplayType()))928 fpVersion = getFPVersion()929 if fpVersion and fpVersion != "unknown":930 info.append(formatLine("P1", _("Front processor version"), fpVersion))931 info.append("")932 info.append(formatLine("H", _("Processor information")))933 info.append("")934 info.append(formatLine("P1", _("CPU"), about.getCPUInfoString()))935 info.append(formatLine("P1", _("CPU brand"), about.getCPUBrand()))936 socFamily = boxbranding.getSoCFamily()937 if socFamily:938 info.append(formatLine("P1", _("SoC family"), socFamily))939 info.append(formatLine("P1", _("CPU architecture"), about.getCPUArch()))940 if boxbranding.getImageFPU():941 info.append(formatLine("P1", _("FPU"), boxbranding.getImageFPU()))942 if boxbranding.getImageArch() == "aarch64":943 info.append(formatLine("P1", _("MultiLib"), (_("Yes") if boxbranding.getHaveMultiLib() == "True" else _("No"))))944 info.append("")945 info.append(formatLine("H", _("Remote control information")))946 info.append("")947 boxRcType = getBoxRCType()948 if boxRcType:949 if boxRcType == "unknown":950 if isfile("/usr/bin/remotecfg"):951 info.append(_("RC type:|%s") % _("Amlogic remote"))952 elif isfile("/usr/sbin/lircd"):953 info.append(_("RC type:|%s") % _("LIRC remote"))954 else:955 info.append(formatLine("P1", _("RC type"), boxRcType))956 customCode = fileReadLine("/proc/stb/ir/rc/customcode")957 if customCode:958 info.append(formatLine("P1", _("RC custom code"), customCode))959 info.append(formatLine("P1", _("RC code"), boxbranding.getRCType()))960 info.append(formatLine("P1", _("RC name"), boxbranding.getRCName()))961 info.append(formatLine("P1", _("RC ID number"), boxbranding.getRCIDNum()))962 info.append("")963 info.append(formatLine("H", _("Driver and kernel information")))964 info.append("")965 info.append(formatLine("P1", _("Drivers version"), about.getDriverInstalledDate()))966 info.append(formatLine("P1", _("Kernel version"), boxbranding.getKernelVersion()))967 moduleLayout = popen("find /lib/modules/ -type f -name 'openvision.ko' -exec modprobe --dump-modversions {} \; | grep 'module_layout' | cut -c-11").read().strip()968 info.append(formatLine("P1", _("Kernel module layout"), (moduleLayout if moduleLayout else _("N/A"))))969 deviceId = fileReadLine("/proc/device-tree/amlogic-dt-id")970 if deviceId:971 info.append(formatLine("P1", _("Device id"), deviceId))972 givenId = fileReadLine("/proc/device-tree/le-dt-id")973 if givenId:974 info.append(formatLine("P1", _("Given device id"), givenId))975 info.append("")976 info.append(formatLine("H", _("Tuner information")))977 info.append("")978 nims = nimmanager.nimListCompressed()979 for count in range(len(nims)):980 tuner, type = [x.strip() for x in nims[count].split(":", 1)]981 info.append(formatLine("P1", tuner, type))982 info.append("")983 info.append(formatLine("H", _("Storage information")))984 info.append("")985 stat = statvfs("/")986 diskSize = stat.f_blocks * stat.f_frsize987 info.append(formatLine("P1", _("Internal flash"), "%s (%s)" % (scaleNumber(diskSize), scaleNumber(diskSize, "Iec"))))988 # hddList = storageManager.HDDList()989 hddList = harddiskmanager.HDDList()990 if hddList:991 for hdd in hddList:992 hdd = hdd[1]993 capacity = hdd.diskSize() * 1000000994 info.append(formatLine("P1", hdd.model(), "%s (%s)" % (scaleNumber(capacity), scaleNumber(capacity, "Iec"))))995 else:996 info.append(formatLine("H", _("No hard disks detected.")))997 info.append("")998 info.append(formatLine("H", _("Network information")))999 info.append("")1000 for x in about.GetIPsFromNetworkInterfaces():1001 info.append(formatLine("P1", x[0], x[1]))1002 info.append("")1003 info.append(formatLine("H", _("Uptime"), about.getBoxUptime()))1004 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))1005 def getSummaryInformation(self):1006 return "Receiver Information"1007class StorageInformation(InformationBase):1008 def __init__(self, session):1009 InformationBase.__init__(self, session)1010 self.setTitle(_("Storage Information"))1011 self.skinName.insert(0, "StorageInformation")1012 self["information"].setText(_("Retrieving network server information, please wait..."))1013 self.mountInfo = []1014 self.console = Console()1015 def fetchInformation(self):1016 self.informationTimer.stop()1017 self.console.ePopen("df -mh | grep -v '^Filesystem'", self.fetchComplete)1018 for callback in self.onInformationUpdated:1019 callback()1020 def fetchComplete(self, result, retVal, extraArgs=None):1021 result = result.decode().replace("\n ", " ").split("\n") if PY2 else result.replace("\n ", " ").split("\n")1022 self.mountInfo = []1023 for line in result:1024 line = line.strip()1025 if not line:1026 continue1027 data = line.split()1028 if data[0].startswith("192") or data[0].startswith("//192"):1029 # data[0] = ipAddress, data[1] = mountTotal, data[2] = mountUsed, data[3] = mountFree, data[4] = percetageUsed, data[5] = mountPoint.1030 self.mountInfo.append(data)1031 if isdir("/media/autofs"):1032 for entry in sorted(listdir("/media/autofs")):1033 path = pathjoin("/media/autofs", entry)1034 keep = True1035 for data in self.mountInfo:1036 if data[5] == path:1037 keep = False1038 break1039 if keep:1040 self.mountInfo.append(["", 0, 0, 0, "N/A", path])1041 for callback in self.onInformationUpdated:1042 callback()1043 def displayInformation(self):1044 info = []1045 info.append(formatLine("H", _("Detected storage devices")))1046 info.append("")1047 partitions = sorted(harddiskmanager.getMountedPartitions(), key=lambda partitions: partitions.device)1048 for partition in partitions:1049 if partition.mountpoint == "/":1050 info.append(formatLine("H1", "/dev/root", partition.description))1051 stat = statvfs("/")1052 diskSize = stat.f_blocks * stat.f_frsize1053 diskFree = stat.f_bfree * stat.f_frsize1054 diskUsed = diskSize - diskFree1055 info.append(formatLine("P2", _("Mountpoint"), partition.mountpoint))1056 info.append(formatLine("P2", _("Capacity"), "%s (%s)" % (scaleNumber(diskSize), scaleNumber(diskSize, "Iec"))))1057 info.append(formatLine("P2", _("Used"), "%s (%s)" % (scaleNumber(diskUsed), scaleNumber(diskUsed, "Iec"))))1058 info.append(formatLine("P2", _("Free"), "%s (%s)" % (scaleNumber(diskFree), scaleNumber(diskFree, "Iec"))))1059 break1060 # hddList = storageManager.HDDList()1061 hddList = harddiskmanager.HDDList()1062 if hddList:1063 for hdd in hddList:1064 hdd = hdd[1]1065 info.append("")1066 info.append(formatLine("H1", hdd.getDeviceName(), hdd.bus()))1067 info.append(formatLine("P2", _("Model"), hdd.model()))1068 diskSize = hdd.diskSize() * 10000001069 info.append(formatLine("P2", _("Capacity"), "%s (%s)" % (scaleNumber(diskSize), scaleNumber(diskSize, "Iec"))))1070 info.append(formatLine("P2", _("Sleeping"), (_("Yes") if hdd.isSleeping() else _("No"))))1071 for partition in partitions:1072 if partition.device and pathjoin("/dev", partition.device).startswith(hdd.getDeviceName()):1073 info.append(formatLine("P2", _("Partition"), partition.device))1074 stat = statvfs(partition.mountpoint)1075 diskSize = stat.f_blocks * stat.f_frsize1076 diskFree = stat.f_bfree * stat.f_frsize1077 diskUsed = diskSize - diskFree1078 info.append(formatLine("P3", _("Mountpoint"), partition.mountpoint))1079 info.append(formatLine("P3", _("Capacity"), "%s (%s)" % (scaleNumber(diskSize), scaleNumber(diskSize, "Iec"))))1080 info.append(formatLine("P3", _("Used"), "%s (%s)" % (scaleNumber(diskUsed), scaleNumber(diskUsed, "Iec"))))1081 info.append(formatLine("P3", _("Free"), "%s (%s)" % (scaleNumber(diskFree), scaleNumber(diskFree, "Iec"))))1082 else:1083 info.append("")1084 info.append(formatLine("H1", _("No hard disks detected.")))1085 info.append("")1086 info.append(formatLine("H", _("Detected network servers")))1087 if self.mountInfo:1088 for data in self.mountInfo:1089 info.append("")1090 info.append(formatLine("H1", data[5]))1091 if data[0]:1092 info.append(formatLine("P2", _("Network address"), data[0]))1093 info.append(formatLine("P2", _("Capacity"), data[1]))1094 info.append(formatLine("P2", _("Used"), "%s (%s)" % (data[2], data[4])))1095 info.append(formatLine("P2", _("Free"), data[3]))1096 else:1097 info.append(formatLine("P2", _("Not currently mounted.")))1098 else:1099 info.append("")1100 info.append(formatLine("P1", _("No network servers detected.")))1101 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))1102class SystemInformation(InformationBase):1103 def __init__(self, session):1104 InformationBase.__init__(self, session)1105 self.baseTitle = _("System Information")1106 self.setTitle(self.baseTitle)1107 self.skinName.insert(0, "SystemInformation")1108 self["key_yellow"] = StaticText()1109 self["key_blue"] = StaticText()1110 self["systemLogActions"] = HelpableActionMap(self, ["NavigationActions"], {1111 "left": (self.previousDiagnostic, _("Display previous system information screen")),1112 "right": (self.nextDiagnostic, _("Display next system information screen")),1113 }, prio=0, description=_("System Information Actions"))1114 self["logfileActions"] = HelpableActionMap(self, ["ColorActions"], {1115 "yellow": (self.deleteLog, _("Delete the currently displayed log file")),1116 "blue": (self.deleteAllLogs, _("Delete all log files"))1117 }, prio=0, description=_("System Information Actions"))1118 self["logfileActions"].setEnabled(False)1119 self.commands = []1120 self.numberOfCommands = 01121 self.commandIndex = 01122 self.commandData = ""1123 self.container = eConsoleAppContainer()1124 self.container.dataAvail.append(self.dataAvail)1125 self.container.appClosed.append(self.appClosed)1126 self.log = _("Retrieving system information, please wait...")1127 def previousDiagnostic(self):1128 self.commandIndex = (self.commandIndex - 1) % len(self.commands)1129 self.log = _("Retrieving system information, please wait...")1130 self.refreshInformation()1131 def nextDiagnostic(self):1132 self.commandIndex = (self.commandIndex + 1) % len(self.commands)1133 self.log = _("Retrieving system information, please wait...")1134 self.refreshInformation()1135 def deleteLog(self):1136 if self.commandIndex >= self.numberOfCommands:1137 self.session.openWithCallback(self.removeLog, MessageBox, _("Do you want to delete this log file?"), default=False)1138 def removeLog(self, answer):1139 if answer:1140 try:1141 args = self.commands[self.commandIndex][1].split()1142 remove(args[-1])1143 self.session.open(MessageBox, _("Log file '%s' deleted.") % args[-1], type=MessageBox.TYPE_INFO, timeout=5, close_on_any_key=True, title=self.baseTitle)1144 except (IOError, OSError) as err:1145 self.session.open(MessageBox, _("Log file '%s' deleted.") % args[-1], type=MessageBox.TYPE_ERROR, timeout=5, title=self.baseTitle)1146 self.informationTimer.start(25)1147 for callback in self.onInformationUpdated:1148 callback()1149 def deleteAllLogs(self):1150 if self.commandIndex >= self.numberOfCommands:1151 self.session.openWithCallback(self.removeAllLogs, MessageBox, _("Do you want to delete all log files?"), default=False)1152 def removeAllLogs(self, answer):1153 if answer:1154 filenames = [x for x in sorted(glob("/mnt/hdd/*.log"), key=lambda x: isfile(x) and getmtime(x))]1155 filenames += [x for x in sorted(glob("/home/root/logs/enigma2_crash*.log"), key=lambda x: isfile(x) and getmtime(x))]1156 filenames += [x for x in sorted(glob("/home/root/logs/enigma2_debug*.log"), key=lambda x: isfile(x) and getmtime(x))]1157 log = []1158 type = MessageBox.TYPE_INFO1159 close = True1160 for filename in filenames:1161 try:1162 remove(filename)1163 log.append(_("Log file '%s' deleted.") % filename)1164 except (IOError, OSError) as err:1165 type = MessageBox.TYPE_ERROR1166 close = False1167 log.append(_("Error %d: Log file '%s' wasn't deleted! (%s)") % (err.errno, filename, err.strerror))1168 log = "\n".join(log).encode("UTF-8", "ignore") if PY2 else "\n".join(log)1169 self.session.open(MessageBox, log, type=type, timeout=5, close_on_any_key=close, title=self.baseTitle)1170 self.informationTimer.start(25)1171 for callback in self.onInformationUpdated:1172 callback()1173 def keyCancel(self):1174 self.container.dataAvail.remove(self.dataAvail)1175 self.container.appClosed.remove(self.appClosed)1176 self.container = None1177 InformationBase.keyCancel(self)1178 def closeRecursive(self):1179 self.container.dataAvail.remove(self.dataAvail)1180 self.container.appClosed.remove(self.appClosed)1181 self.container = None1182 InformationBase.closeRecursive(self)1183 def fetchInformation(self):1184 self.informationTimer.stop()1185 self.commands = [1186 ("dmesg", "/bin/dmesg", "dmesg"),1187 ("ifconfig", "/sbin/ifconfig", "ifconfig"),1188 ("df", "/bin/df -h", "df"),1189 ("top", "/usr/bin/top -b -n 1", "top"),1190 ("ps", "/bin/ps -l", "ps"),1191 ("messages", "/bin/cat /var/volatile/log/messages", "messages")1192 ]1193 self.numberOfCommands = len(self.commands)1194 #1195 # TODO: Need to adjust path of log files to match current configurations!1196 #1197 installLog = "/home/root/autoinstall.log"1198 if isfile(installLog):1199 self.commands.append((_("Auto install log"), "/bin/cat %s" % installLog, installLog))1200 self.numberOfCommands += 11201 crashLog = "/tmp/enigma2_crash.log"1202 if isfile(crashLog):1203 self.commands.append((_("Current crash log"), "/bin/cat %s" % crashLog, crashLog))1204 self.numberOfCommands += 11205 filenames = [x for x in sorted(glob("/mnt/hdd/*.log"), key=lambda x: isfile(x) and getmtime(x))]1206 if filenames:1207 totalNumberOfLogfiles = len(filenames)1208 logfileCounter = 11209 for filename in reversed(filenames):1210 self.commands.append((_("Logfile '%s' (%d/%d)") % (basename(filename), logfileCounter, totalNumberOfLogfiles), "/bin/cat %s" % filename, filename))1211 logfileCounter += 11212 filenames = [x for x in sorted(glob("/home/root/logs/enigma2_crash*.log"), key=lambda x: isfile(x) and getmtime(x))]1213 if filenames:1214 totalNumberOfLogfiles = len(filenames)1215 logfileCounter = 11216 for filename in reversed(filenames):1217 self.commands.append((_("Crash log '%s' (%d/%d)") % (basename(filename), logfileCounter, totalNumberOfLogfiles), "/bin/cat %s" % filename, filename))1218 logfileCounter += 11219 filenames = [x for x in sorted(glob("/home/root/logs/enigma2_debug*.log"), key=lambda x: isfile(x) and getmtime(x))]1220 if filenames:1221 totalNumberOfLogfiles = len(filenames)1222 logfileCounter = 11223 for filename in reversed(filenames):1224 self.commands.append((_("Debug log '%s' (%d/%d)") % (basename(filename), logfileCounter, totalNumberOfLogfiles), "/usr/bin/tail -n 1000 %s" % filename, filename))1225 logfileCounter += 11226 self.commandIndex = min(len(self.commands) - 1, self.commandIndex)1227 self.refreshInformation()1228 def refreshInformation(self):1229 self.setTitle("%s - %s" % (self.baseTitle, self.commands[self.commandIndex][0]))1230 command = self.commands[self.commandIndex][1]1231 args = command.split() # For safety don't use a shell command line!1232 if args[0] == "/bin/cat":1233 try:1234 with open(args[1], "r") as fd:1235 data = fd.read()1236 data = data.encode("UTF-8", "ignore") if PY2 else data1237 self.log = data1238 except (IOError, OSError) as err:1239 self.log = _("Error %d: The logfile '%s' could not be opened. (%s)") % (err.errno, args[1], err.strerror)1240 else:1241 self.commandData = ""1242 args.insert(0, args[0])1243 retVal = self.container.execute(*args)1244 pid = self.container.getPID()1245 # print("[Information] DEBUG: System logs PID=%d." % pid)1246 # try:1247 # waitpid(pid, 0)1248 # except (IOError, OSError) as err:1249 # pass1250 if self.commandIndex >= self.numberOfCommands:1251 self["key_yellow"].text = _("Delete logfile")1252 self["key_blue"].text = _("Delete all logfiles")1253 self["logfileActions"].setEnabled(True)1254 else:1255 self["key_yellow"].text = ""1256 self["key_blue"].text = ""1257 self["logfileActions"].setEnabled(False)1258 for callback in self.onInformationUpdated:1259 callback()1260 def dataAvail(self, data):1261 self.commandData += data1262 def appClosed(self, retVal):1263 self.log = self.commandData.encode("UTF-8", "ignore") if PY2 else self.commandData1264 if retVal:1265 self.log += "\n\n%s" % (_("An error occurred, error code %d, please try again later.") % retVal)1266 for callback in self.onInformationUpdated:1267 callback()1268 def displayInformation(self):1269 if not self.log:1270 self.log = _("The '%s' log file contains no information.") % self.commands[self.commandIndex][2]1271 self["information"].setText(self.log)1272class TranslationInformation(InformationBase):1273 def __init__(self, session):1274 InformationBase.__init__(self, session)1275 self.setTitle(_("Translation Information"))1276 self.skinName.insert(0, "TranslationInformation")1277 def displayInformation(self):1278 info = []1279 translateInfo = _("TRANSLATOR_INFO")1280 if translateInfo != "TRANSLATOR_INFO":1281 info.append(formatLine("H", _("Translation information")))1282 info.append("")1283 translateInfo = translateInfo.split("\n")1284 for translate in translateInfo:1285 info.append(formatLine("P1", translate))1286 info.append("")1287 translateInfo = _("").split("\n") # This is deliberate to dump the translation information.1288 for translate in translateInfo:1289 if not translate:1290 continue1291 translate = [x.strip() for x in translate.split(":", 1)]1292 if len(translate) == 1:1293 translate.append("")1294 info.append(formatLine("P1", translate[0], translate[1]))1295 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))1296 def getSummaryInformation(self):1297 return "Translation Information"1298class TunerInformation(InformationBase):1299 def __init__(self, session):1300 InformationBase.__init__(self, session)1301 self.setTitle(_("Tuner Information"))1302 self.skinName.insert(0, "TunerInformation")1303 def displayInformation(self):1304 info = []1305 info.append(formatLine("H", _("Detected tuners")))1306 info.append("")1307 nims = nimmanager.nimList()1308 descList = []1309 curIndex = -11310 for count in range(len(nims)):1311 data = nims[count].split(":")1312 idx = data[0].strip("Tuner").strip()1313 desc = data[1].strip()1314 if descList and descList[curIndex]["desc"] == desc:1315 descList[curIndex]["end"] = idx1316 else:1317 descList.append({1318 "desc": desc,1319 "start": idx,1320 "end": idx1321 })1322 curIndex += 11323 count += 11324 for count in range(len(descList)):1325 data = descList[count]["start"] if descList[count]["start"] == descList[count]["end"] else ("%s-%s" % (descList[count]["start"], descList[count]["end"]))1326 info.append(formatLine("P1", "Tuner %s" % data, descList[count]["desc"]))1327 # info.append("")1328 # info.append(formatLine("H", _("Logical tuners"))) # Each tuner is a listed separately even if the hardware is common.1329 # info.append("")1330 # nims = nimmanager.nimListCompressed()1331 # for count in range(len(nims)):1332 # tuner, type = [x.strip() for x in nims[count].split(":", 1)]1333 # info.append(formatLine("P1", tuner, type))1334 info.append("")1335 info.append(formatLine("", _("DVB API"), about.getDVBAPI()))1336 numSlots = 01337 dvbFeToolTxt = ""1338 nimSlots = nimmanager.getSlotCount()1339 for nim in range(nimSlots):1340 dvbFeToolTxt += eDVBResourceManager.getInstance().getFrontendCapabilities(nim)1341 dvbApiVersion = dvbFeToolTxt.splitlines()[0].replace("DVB API version: ", "").strip()1342 info.append(formatLine("", _("DVB API version"), dvbApiVersion))1343 info.append("")1344 info.append(formatLine("", _("Transcoding"), (_("Yes") if boxbranding.getHaveTranscoding() == "True" else _("No"))))1345 info.append(formatLine("", _("MultiTranscoding"), (_("Yes") if boxbranding.getHaveMultiTranscoding() == "True" else _("No"))))1346 info.append("")1347 info.append(formatLine("", _("DVB-C"), (_("Yes") if "DVBC" in dvbFeToolTxt or "DVB-C" in dvbFeToolTxt else _("No"))))1348 info.append(formatLine("", _("DVB-S"), (_("Yes") if "DVBS" in dvbFeToolTxt or "DVB-S" in dvbFeToolTxt else _("No"))))1349 info.append(formatLine("", _("DVB-T"), (_("Yes") if "DVBT" in dvbFeToolTxt or "DVB-T" in dvbFeToolTxt else _("No"))))1350 info.append("")1351 info.append(formatLine("", _("Multistream"), (_("Yes") if "MULTISTREAM" in dvbFeToolTxt else _("No"))))1352 info.append("")1353 info.append(formatLine("", _("ANNEX-A"), (_("Yes") if "ANNEX_A" in dvbFeToolTxt or "ANNEX-A" in dvbFeToolTxt else _("No"))))1354 info.append(formatLine("", _("ANNEX-B"), (_("Yes") if "ANNEX_B" in dvbFeToolTxt or "ANNEX-B" in dvbFeToolTxt else _("No"))))1355 info.append(formatLine("", _("ANNEX-C"), (_("Yes") if "ANNEX_C" in dvbFeToolTxt or "ANNEX-C" in dvbFeToolTxt else _("No"))))1356 self["information"].setText("\n".join(info).encode("UTF-8", "ignore") if PY2 else "\n".join(info))1357 def getSummaryInformation(self):1358 return "DVB Information"1359class InformationSummary(ScreenSummary):1360 def __init__(self, session, parent):1361 ScreenSummary.__init__(self, session, parent=parent)1362 self.parent = parent1363 self["information"] = StaticText()1364 parent.onInformationUpdated.append(self.updateSummary)1365 # self.updateSummary()1366 def updateSummary(self):1367 # print("[Information] DEBUG: Updating summary.")...

Full Screen

Full Screen

OS2Table.py

Source:OS2Table.py Github

copy

Full Screen

...93 formatEnd = self.OS2_TABLE_FORMAT_0_0_LENGTH94 version, xAvgCharWidth, usWeightClass, usWidthClass, fsType, ySubscriptXSize, ySubscriptYSize, ySubscriptXOffset, ySubscriptYOffset, \95 ySuperscriptXSize, ySuperscriptYSize, ySuperscriptXOffset, ySuperscriptYOffset, yStrikeoutSize, yStrikeoutPosition, sFamilyclass \96 = struct.unpack(self.OS2_TABLE_FORMAT_0_0, rawTable[formatStart:formatEnd])97 FontTable.formatLine("Version", utility.formatDecimal(version))98 FontTable.formatLine("Avg Char Width", utility.formatDecimal(xAvgCharWidth))99 FontTable.formatLine("Weight Class", utility.formatDecimal(usWeightClass))100 FontTable.formatLine("Width Class", utility.formatDecimal(usWidthClass))101 FontTable.formatLine("Type Flags", utility.formatHex16(fsType))102 FontTable.formatLine("Subscript X Size", utility.formatDecimal(ySubscriptXSize))103 FontTable.formatLine("Subscript Y Size", utility.formatDecimal(ySubscriptYSize))104 FontTable.formatLine("Subscript X Offset", utility.formatDecimal(ySubscriptXOffset))105 FontTable.formatLine("Subscript Y Offset", utility.formatDecimal(ySubscriptYOffset))106 FontTable.formatLine("Superscript X Size", utility.formatDecimal(ySuperscriptXSize))107 FontTable.formatLine("Superscript Y Size", utility.formatDecimal(ySuperscriptYSize))108 FontTable.formatLine("Superscript X Offset", utility.formatDecimal(ySuperscriptXOffset))109 FontTable.formatLine("Superscript Y Offset", utility.formatDecimal(ySuperscriptYOffset))110 FontTable.formatLine("Strikeout Size", utility.formatDecimal(yStrikeoutSize))111 FontTable.formatLine("Strikeout Position", utility.formatDecimal(yStrikeoutPosition))112 FontTable.formatLine("Family Class", utility.formatHex16(sFamilyclass))113 formatStart = formatEnd114 formatEnd += self.OS2_TABLE_FORMAT_0_1_LENGTH115 panoseFamilyType, panoseSerifType, panoseWeight, panoseProportion, panoseContrast, panoseStrokeVariation, \116 panoseArmStype, panoseLetterForm, panoseMidLine, panoseXHeight = struct.unpack(self.OS2_TABLE_FORMAT_0_1, rawTable[formatStart:formatEnd])117 FontTable.formatLine("Panose Family Type", utility.formatHex8(panoseFamilyType))118 FontTable.formatLine("Panose Serif Type", utility.formatHex8(panoseSerifType))119 FontTable.formatLine("Panose Weight", utility.formatHex8(panoseWeight))120 FontTable.formatLine("Panose Proportion", utility.formatHex8(panoseProportion))121 FontTable.formatLine("Panose Contrast", utility.formatHex8(panoseContrast))122 FontTable.formatLine("Panose Stroke Variation", utility.formatHex8(panoseStrokeVariation))123 FontTable.formatLine("Panose Arm Style", utility.formatHex8(panoseArmStype))124 FontTable.formatLine("Panose Letter Form", utility.formatHex8(panoseLetterForm))125 FontTable.formatLine("Panose Mid Line", utility.formatHex8(panoseMidLine))126 FontTable.formatLine("Panose X Height", utility.formatHex8(panoseXHeight))127 formatStart = formatEnd128 formatEnd += self.OS2_TABLE_FORMAT_0_2_LENGTH129 ucRange1High, ucRange1Low, ucRange2High, ucRange2Low, ucRange3High, ucRange3Low, ucRange4High, ucRange4Low, \130 achVendID, fsSelection, usFirstCharIndex, usLastCharIndex, \131 sTypoAscender, sTypoDescender,sTypoLineGap, usWinAscent, usWinDescent = struct.unpack(self.OS2_TABLE_FORMAT_0_2, rawTable[formatStart:formatEnd])132 vendorID = achVendID.decode("ascii")133 FontTable.formatLine("Unicode Range 1", utility.formatHex32(utility.swapLongInt(ucRange1High, ucRange1Low)))134 FontTable.formatLine("Unicode Range 2", utility.formatHex32(utility.swapLongInt(ucRange2High, ucRange2Low)))135 FontTable.formatLine("Unicode Range 3", utility.formatHex32(utility.swapLongInt(ucRange3High, ucRange3Low)))136 FontTable.formatLine("Unicode Range 4", utility.formatHex32(utility.swapLongInt(ucRange4High, ucRange4Low)))137 FontTable.formatLine("Font Vendor ID", f"'{vendorID}'")138 FontTable.formatLine("Font Selection Flags", utility.formatHex16(fsSelection))139 FontTable.formatLine("First Char Index", utility.formatHex16(usFirstCharIndex))140 FontTable.formatLine("Last Char Index", utility.formatHex16(usLastCharIndex))141 FontTable.formatLine("Typographic Ascender", utility.formatDecimal(sTypoAscender))142 FontTable.formatLine("Typographic Descender", utility.formatDecimal(sTypoDescender))143 FontTable.formatLine("Typographic Line Gap", utility.formatDecimal(sTypoLineGap))144 FontTable.formatLine("Windows Ascent", utility.formatDecimal(usWinAscent))145 FontTable.formatLine("Windows Descent", utility.formatDecimal(usWinDescent))146 if version >= 1:147 formatStart = formatEnd148 formatEnd += self.OS2_TABLE_FORMAT_1_LENGTH149 ucpRange1High, ucpRange1Low, ucpRange2High, ucpRange2Low = struct.unpack(self.OS2_TABLE_FORMAT_1, rawTable[formatStart:formatEnd])150 FontTable.formatLine("Code Page Range 1", utility.formatHex32(utility.swapLongInt(ucpRange1High, ucpRange1Low)))151 FontTable.formatLine("Code Page Range 2", utility.formatHex32(utility.swapLongInt(ucpRange2High, ucpRange2Low)))152 if version >= 2:153 formatStart = formatEnd154 formatEnd += self.OS2_TABLE_FORMAT_2_LENGTH155 sxHeight, sCapHeight, usDefaultChar, usBreakChar, usMaxContext = struct.unpack(self.OS2_TABLE_FORMAT_2, rawTable[formatStart:formatEnd])156 FontTable.formatLine("x Height", utility.formatDecimal(sxHeight))157 FontTable.formatLine("Cap Height", utility.formatDecimal(sCapHeight))158 FontTable.formatLine("Default Char", utility.formatHex16(usDefaultChar))159 FontTable.formatLine("Break Char", utility.formatHex16(usBreakChar))160 FontTable.formatLine("Max Context", utility.formatDecimal(usMaxContext))161 if version >= 5:162 formatStart = formatEnd163 formatEnd += self.OS2_TABLE_FORMAT_5_LENGTH164 usLowerOpticalPointSize, usUpperOpticalPointSize = struct.unpack(self.OS2_TABLE_FORMAT_5, rawTable[formatStart:formatEnd])165 FontTable.formatLine("Lower Optical Point Size", utility.formatDecimal(usLowerOpticalPointSize))166 FontTable.formatLine("Upper Optical Point Size", utility.formatDecimal(usUpperOpticalPointSize))...

Full Screen

Full Screen

01.perf-timing.js

Source:01.perf-timing.js Github

copy

Full Screen

...3 if (window.dump) {4 window.dump(o + '\n');5 }6}7function formatLine(name, t) {8 print("[PERF]," + name + "," + t);9}10function printPerfTiming() {11 print("[PERF] perf block start")12 formatLine("testcase", window.location);13 formatLine("title", document.title.replace(/,/g, ","));14 formatLine("navigationStart", performance.timing.navigationStart);15 formatLine("unloadEventStart", performance.timing.unloadEventStart);16 formatLine("unloadEventEnd", performance.timing.unloadEventEnd);17 formatLine("redirectStart", performance.timing.redirectStart);18 formatLine("redirectEnd", performance.timing.redirectEnd);19 formatLine("fetchStart", performance.timing.fetchStart);20 formatLine("domainLookupStart", performance.timing.domainLookupStart);21 formatLine("domainLookupEnd", performance.timing.domainLookupEnd);22 formatLine("connectStart", performance.timing.connectStart);23 formatLine("connectEnd", performance.timing.connectEnd);24 formatLine("secureConnectionStart", performance.timing.secureConnectionStart);25 formatLine("requestStart", performance.timing.requestStart);26 formatLine("responseStart", performance.timing.responseStart);27 formatLine("responseEnd", performance.timing.responseEnd);28 formatLine("domLoading", performance.timing.domLoading);29 formatLine("domInteractive", performance.timing.domInteractive);30 formatLine("domContentLoadedEventStart", performance.timing.domContentLoadedEventStart);31 formatLine("domContentLoadedEventEnd", performance.timing.domContentLoadedEventEnd);32 formatLine("domComplete", performance.timing.domComplete);33 formatLine("loadEventStart", performance.timing.loadEventStart);34 formatLine("loadEventEnd", performance.timing.loadEventEnd);35 print("[PERF] perf block end")36}37if (document.readyState === "complete") { 38 printPerfTiming()39 window.close();40} else {41 window.addEventListener('load', printPerfTiming);42 var timeout = 5;43 window.setTimeout(function() {44 print("[PERF] Timeout after " + timeout + " min. Force stop");45 printPerfTiming();46 window.close();47 }, timeout * 60 * 1000)48}

Full Screen

Full Screen

perf.js

Source:perf.js Github

copy

Full Screen

1print = function(o) {2 window.dump(o + '\n')3}4function formatLine(name, t){5 var output = "[PERF]," + name + "," + t;6 print(output);7 //document.getElementById('timing').innerHTML += output + "<br/>";8}9function printPerfTiming(){10 print("[PERF] perf block start")11 formatLine("testcase", window.location);12 formatLine("navigationStart", performance.timing.navigationStart);13 formatLine("unloadEventStart", performance.timing.unloadEventStart);14 formatLine("unloadEventEnd", performance.timing.unloadEventEnd);15 formatLine("redirectStart", performance.timing.redirectStart);16 formatLine("redirectEnd", performance.timing.redirectEnd);17 formatLine("fetchStart", performance.timing.fetchStart);18 formatLine("domainLookupStart", performance.timing.domainLookupStart);19 formatLine("domainLookupEnd", performance.timing.domainLookupEnd);20 formatLine("connectStart", performance.timing.connectStart);21 formatLine("connectEnd", performance.timing.connectEnd);22 formatLine("secureConnectionStart", performance.timing.secureConnectionStart);23 formatLine("requestStart", performance.timing.requestStart);24 formatLine("responseStart", performance.timing.responseStart);25 formatLine("responseEnd", performance.timing.responseEnd);26 formatLine("domLoading", performance.timing.domLoading);27 formatLine("domInteractive", performance.timing.domInteractive);28 formatLine("domContentLoadedEventStart", performance.timing.domContentLoadedEventStart);29 formatLine("domContentLoadedEventEnd", performance.timing.domContentLoadedEventEnd);30 formatLine("domComplete", performance.timing.domComplete);31 formatLine("loadEventStart", performance.timing.loadEventStart);32 formatLine("loadEventEnd", performance.timing.loadEventEnd);33 print("[PERF] perf block end");34 window.close()35}36if (document.readyState === "complete") { 37 printPerfTiming()38 window.close();39} else {40 window.addEventListener('load', printPerfTiming);41 var timeout = 5;42 window.setTimeout(function(){43 print("[PERF] Timeout after " + timeout + " min. Force stop");44 printPerfTiming();45 window.close();46 }, timeout * 60 * 1000)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run green automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful