From: Andreas Monzner Date: Wed, 7 Dec 2005 23:57:57 +0000 (+0000) Subject: implement often wished feature :) X-Git-Tag: 2.6.0~4789 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/02aac9d371ca28b52a0c0b635b38fbb912f596ed implement often wished feature :) displaying snr, agc and ber in the infobar --- diff --git a/lib/python/Components/ProgressBar.py b/lib/python/Components/ProgressBar.py index 68824d5a..00b1bbe3 100644 --- a/lib/python/Components/ProgressBar.py +++ b/lib/python/Components/ProgressBar.py @@ -11,7 +11,15 @@ class ProgressBar(HTMLComponent, GUIComponent, VariableValue): VariableValue.__init__(self) def createWidget(self, parent): - g = eSlider(parent) - g.setRange(0, 100) - return g - + self.g = eSlider(parent) + self.g.setRange(0, 100) + return self.g + + def setRange(self, start, end): + self.g.setRange(start, end) + + def setValue(self, value): + self.g.setValue(value) + + + diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index cee385c1..a48cb75c 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -13,7 +13,7 @@ from Screens.InfoBarGenerics import InfoBarVolumeControl, InfoBarShowHide, \ InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, \ InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord, \ InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \ - InfoBarSubserviceSelection + InfoBarSubserviceSelection, InfoBarTuner from Screens.HelpMenu import HelpableScreen, HelpMenu @@ -25,7 +25,7 @@ class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, - InfoBarSubserviceSelection): + InfoBarSubserviceSelection, InfoBarTuner): def __init__(self, session): Screen.__init__(self, session) @@ -39,7 +39,7 @@ class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \ - InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection: + InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, InfoBarTuner: x.__init__(self) self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")])) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 1b080d9b..fc3f011c 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -2,6 +2,7 @@ from Screen import Screen from Components.ActionMap import ActionMap, HelpableActionMap from Components.ActionMap import NumberActionMap from Components.Label import * +from Components.ProgressBar import * from Components.config import configfile, configsequencearg from Components.config import config, configElement, ConfigSubsection, configSequence from ChannelSelection import ChannelSelection @@ -383,6 +384,48 @@ class InfoBarEPG: self.epglist[1]=tmp setEvent(self.epglist[0]) +from math import log + +class InfoBarTuner: + """provides a snr/agc/ber display""" + def __init__(self): + self["snr"] = Label() + self["agc"] = Label() + self["ber"] = Label() + self["snr_percent"] = Label() + self["agc_percent"] = Label() + self["ber_count"] = Label() + self["snr_progress"] = ProgressBar() + self["agc_progress"] = ProgressBar() + self["ber_progress"] = ProgressBar() + self.timer = eTimer() + self.timer.timeout.get().append(self.updateTunerInfo) + self.timer.start(500) + + def log2(self,val): + if not val: + return 0 + return (long)(log(val)/log(2)) + + def updateTunerInfo(self): + if self.instance.isVisible(): + service = self.session.nav.getCurrentService() + snr=0 + agc=0 + ber=0 + if service is not None: + feinfo = service.frontendStatusInfo() + if feinfo is not None: + ber=feinfo.getFrontendInfo(iFrontendStatusInformation.bitErrorRate) + snr=feinfo.getFrontendInfo(iFrontendStatusInformation.signalPower)*100/65536 + agc=feinfo.getFrontendInfo(iFrontendStatusInformation.signalQuality)*100/65536 + self["snr_percent"].setText("%d%%"%(snr)) + self["agc_percent"].setText("%d%%"%(agc)) + self["ber_count"].setText("%d"%(ber)) + self["snr_progress"].setValue(snr) + self["agc_progress"].setValue(agc) + self["ber_progress"].setValue(self.log2(ber)) + class InfoBarEvent: """provides a current/next event info display""" def __init__(self):