From b84861d1353fc1a0623e0529e928082004926671 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 3 Mar 2006 04:13:27 +0000 Subject: [PATCH] new service info screen (prepared to show transponder info... not functional yet) --- data/skin.xml | 8 ++- lib/python/Screens/ServiceInfo.py | 97 +++++++++++++++++++++---------- 2 files changed, 73 insertions(+), 32 deletions(-) diff --git a/data/skin.xml b/data/skin.xml index 2d920f84..19581165 100644 --- a/data/skin.xml +++ b/data/skin.xml @@ -51,8 +51,12 @@ - - + + + + + + diff --git a/lib/python/Screens/ServiceInfo.py b/lib/python/Screens/ServiceInfo.py index d32c3e85..e76d3dd0 100644 --- a/lib/python/Screens/ServiceInfo.py +++ b/lib/python/Screens/ServiceInfo.py @@ -9,13 +9,31 @@ from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformat RT_HALIGN_LEFT = 0 -def ServiceInfoListEntry(a, b): +TYPE_TEXT = 0 +TYPE_VALUE_HEX = 1 +TYPE_VALUE_DEC = 2 +TYPE_VALUE_HEX_DEC = 3 +TYPE_SLIDER = 4 + +def ServiceInfoListEntry(a, b, valueType=TYPE_TEXT, param=4): res = [ ] #PyObject *type, *px, *py, *pwidth, *pheight, *pfnt, *pstring, *pflags; res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 30, 0, RT_HALIGN_LEFT, "")) res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 150, 25, 0, RT_HALIGN_LEFT, a)) - res.append((eListboxPythonMultiContent.TYPE_TEXT, 170, 0, 150, 25, 0, RT_HALIGN_LEFT, b)) + print "b:", b + if type(b) is not str: + if valueType == TYPE_VALUE_HEX: + b = ("0x%0" + str(param) + "x") % b + elif valueType == TYPE_VALUE_DEC: + b = str(b) + elif valueType == TYPE_VALUE_HEX_DEC: + b = ("0x%0" + str(param) + "x (%dd)") % (b, b) + else: + b = str(b) + + + res.append((eListboxPythonMultiContent.TYPE_TEXT, 170, 0, 350, 25, 0, RT_HALIGN_LEFT, b)) return res @@ -40,10 +58,13 @@ class ServiceInfo(Screen): def __init__(self, session): Screen.__init__(self, session) - self["actions"] = ActionMap(["OkCancelActions"], + self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], { "ok": self.close, - "cancel": self.close + "cancel": self.close, + "red": self.information, + "green": self.pids, + "yellow": self.transponder }, -1) service = session.nav.getCurrentService() @@ -52,49 +73,65 @@ class ServiceInfo(Screen): else: self.info = None + + self["red"] = Label("Serviceinfo") + self["green"] = Label("PIDs") + self["yellow"] = Label("Transponder") + self["blue"] = Label("") + + tlist = [ ] + + self["infolist"] = ServiceInfoList(tlist) + self.onShown.append(self.information) + + def information(self): if self.session.nav.getCurrentlyPlayingServiceReference() is not None: name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName() else: name = "N/A" - Labels = ( ("Name", name), - ("Provider", self.getValue(iServiceInformation.sProvider)), - ("VideoPID", self.getValue(iServiceInformation.sVideoPID)), - ("AudioPID", self.getValue(iServiceInformation.sAudioPID)), - ("PCRPID", self.getValue(iServiceInformation.sPCRPID)), - ("PMTPID", self.getValue(iServiceInformation.sPMTPID)), - ("TXTPID", self.getValue(iServiceInformation.sTXTPID)), - ("Videoformat", self.getValue(iServiceInformation.sAspect)), - ("TSID", self.getValue(iServiceInformation.sTSID)), - ("ONID", self.getValue(iServiceInformation.sONID)), - ("SID", self.getValue(iServiceInformation.sSID)), - ("Namespace", self.getValue(iServiceInformation.sNamespace))) + Labels = ( ("Name", name, TYPE_TEXT), + ("Provider", self.getServiceInfoValue(iServiceInformation.sProvider), TYPE_TEXT), + ("Videoformat", self.getServiceInfoValue(iServiceInformation.sAspect), TYPE_TEXT), + ("Namespace", self.getServiceInfoValue(iServiceInformation.sNamespace), TYPE_VALUE_HEX, 8)) + self.fillList(Labels) + + def pids(self): + Labels = ( ("VideoPID", self.getServiceInfoValue(iServiceInformation.sVideoPID), TYPE_VALUE_HEX_DEC, 4), + ("AudioPID", self.getServiceInfoValue(iServiceInformation.sAudioPID), TYPE_VALUE_HEX_DEC, 4), + ("PCRPID", self.getServiceInfoValue(iServiceInformation.sPCRPID), TYPE_VALUE_HEX_DEC, 4), + ("PMTPID", self.getServiceInfoValue(iServiceInformation.sPMTPID), TYPE_VALUE_HEX_DEC, 4), + ("TXTPID", self.getServiceInfoValue(iServiceInformation.sTXTPID), TYPE_VALUE_HEX_DEC, 4), + ("TSID", self.getServiceInfoValue(iServiceInformation.sTSID), TYPE_VALUE_HEX_DEC, 4), + ("ONID", self.getServiceInfoValue(iServiceInformation.sONID), TYPE_VALUE_HEX_DEC, 4), + ("SID", self.getServiceInfoValue(iServiceInformation.sSID), TYPE_VALUE_HEX_DEC, 4)) + self.fillList(Labels) + + def transponder(self): + Labels = ( ("Frequency", "11823", TYPE_TEXT), + ("Polarity", "H", TYPE_TEXT)) + self.fillList(Labels) + def fillList(self, Labels): tlist = [ ] for item in Labels: + print item value = item[1] - tlist.append(ServiceInfoListEntry(item[0]+":", value)) + if len(item) < 4: + tlist.append(ServiceInfoListEntry(item[0]+":", value, item[2])) + else: + tlist.append(ServiceInfoListEntry(item[0]+":", value, item[2], item[3])) - self["infolist"] = ServiceInfoList(tlist) + self["infolist"].l.setList(tlist) - def getValue(self, what): + def getServiceInfoValue(self, what): if self.info is None: return "" v = self.info.getInfo(what) if v == -2: v = self.info.getInfoString(what) - elif v != -1: - if what in [iServiceInformation.sVideoPID, - iServiceInformation.sAudioPID, iServiceInformation.sPCRPID, iServiceInformation.sPMTPID, - iServiceInformation.sTXTPID, iServiceInformation.sTSID, iServiceInformation.sONID, - iServiceInformation.sSID]: - v = "0x%04x (%dd)" % (v, v) - elif what in [iServiceInformation.sNamespace]: - v = "0x%08x" % (v) - else: - v = str(v) - else: + elif v == -1: v = "N/A" return v -- 2.30.2