aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Converter
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-06-26 21:10:10 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-06-26 21:10:10 +0000
commit77bb53beb46f6984e1529c4f703523c146956d0f (patch)
tree5f6d1c9e9be93e3fe9e9f9d3ac8f896434d7d2c7 /lib/python/Components/Converter
parentd279cc40f4a1d927ad00bfe7b0ee3a303e9aed44 (diff)
downloadenigma2-77bb53beb46f6984e1529c4f703523c146956d0f.tar.gz
enigma2-77bb53beb46f6984e1529c4f703523c146956d0f.zip
add Boolean source, add ServiceInfo boolean sources, add ConditionalShowHide converter, add FixedLabel and Pixmap renderer
Diffstat (limited to 'lib/python/Components/Converter')
-rw-r--r--lib/python/Components/Converter/ClockToText.py2
-rw-r--r--lib/python/Components/Converter/ConditionalShowHide.py11
-rw-r--r--lib/python/Components/Converter/FrontendInfo.py2
-rw-r--r--lib/python/Components/Converter/Makefile.am3
-rw-r--r--lib/python/Components/Converter/ServiceInfo.py63
-rw-r--r--lib/python/Components/Converter/ServiceName.py2
6 files changed, 79 insertions, 4 deletions
diff --git a/lib/python/Components/Converter/ClockToText.py b/lib/python/Components/Converter/ClockToText.py
index 61c176eb..3abfffc5 100644
--- a/lib/python/Components/Converter/ClockToText.py
+++ b/lib/python/Components/Converter/ClockToText.py
@@ -1,4 +1,4 @@
-from Components.Converter.Converter import Converter
+from Converter import Converter
from time import localtime, strftime
class ClockToText(Converter, object):
diff --git a/lib/python/Components/Converter/ConditionalShowHide.py b/lib/python/Components/Converter/ConditionalShowHide.py
new file mode 100644
index 00000000..56fb1453
--- /dev/null
+++ b/lib/python/Components/Converter/ConditionalShowHide.py
@@ -0,0 +1,11 @@
+from Converter import Converter
+
+class ConditionalShowHide(Converter, object):
+
+ def __init__(self, type, *args, **kwargs):
+ Converter.__init__(self)
+ self.invert = type == "Invert"
+
+ def changed(self):
+ for x in self.downstream_elements:
+ x.visible = self.source.boolean
diff --git a/lib/python/Components/Converter/FrontendInfo.py b/lib/python/Components/Converter/FrontendInfo.py
index a1064b97..afff2a7a 100644
--- a/lib/python/Components/Converter/FrontendInfo.py
+++ b/lib/python/Components/Converter/FrontendInfo.py
@@ -41,7 +41,7 @@ class FrontendInfo(Converter, object):
text = property(getText)
- bool = property(getBool)
+ boolean = property(getBool)
def getValue(self):
assert self.type != self.LOCK, "the value/range output of FrontendInfo can not be used for lock info"
diff --git a/lib/python/Components/Converter/Makefile.am b/lib/python/Components/Converter/Makefile.am
index 59cb068f..a84628a0 100644
--- a/lib/python/Components/Converter/Makefile.am
+++ b/lib/python/Components/Converter/Makefile.am
@@ -2,4 +2,5 @@ installdir = $(LIBDIR)/enigma2/python/Components/Converter
install_PYTHON = \
__init__.py ClockToText.py Converter.py EventName.py StaticText.py EventTime.py \
- Poll.py RemainingToText.py StringList.py ServiceName.py FrontendInfo.py
+ Poll.py RemainingToText.py StringList.py ServiceName.py FrontendInfo.py ServiceInfo.py \
+ ConditionalShowHide.py
diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py
new file mode 100644
index 00000000..413aa191
--- /dev/null
+++ b/lib/python/Components/Converter/ServiceInfo.py
@@ -0,0 +1,63 @@
+from Components.Converter.Converter import Converter
+from enigma import iServiceInformation, iPlayableService
+
+class ServiceInfo(Converter, object):
+ HAS_TELETEXT = 0
+ IS_MULTICHANNEL = 1
+ IS_CRYPTED = 2
+ IS_WIDESCREEN = 3
+ SUBSERVICES_AVAILABLE = 4
+
+ def __init__(self, type, *args, **kwargs):
+ Converter.__init__(self)
+ self.type = {
+ "HasTelext": self.HAS_TELETEXT,
+ "IsMultichannel": self.IS_MULTICHANNEL,
+ "IsCrypted": self.IS_CRYPTED,
+ "IsWidescreen": self.IS_WIDESCREEN,
+ "SubservicesAvailable": self.SUBSERVICES_AVAILABLE,
+ }[type]
+
+ self.interesting_events = {
+ self.HAS_TELETEXT: [iPlayableService.evEnd, iPlayableService.evUpdatedInfo],
+ self.IS_MULTICHANNEL: [iPlayableService.evUpdatedInfo, iPlayableService.evEnd],
+ self.IS_CRYPTED: [iPlayableService.evUpdatedInfo, iPlayableService.evEnd],
+ self.IS_WIDESCREEN: [iPlayableService.evUpdatedEventInfo, iPlayableService.evEnd],
+ self.SUBSERVICES_AVAILABLE: [iPlayableService.evUpdatedEventInfo, iPlayableService.evEnd]
+ }[self.type]
+
+ def getServiceInfoValue(self, info, what):
+ v = info.getInfo(what)
+ if v != -2:
+ return "N/A"
+ return info.getInfoString(what)
+
+ def getBoolean(self):
+ service = self.source.service
+ info = service and service.info()
+ if not info:
+ return False
+
+ if self.type == self.HAS_TELETEXT:
+ tpid = info.getInfo(iServiceInformation.sTXTPID)
+ return tpid != -1
+ elif self.type == self.IS_MULTICHANNEL:
+ # FIXME. but currently iAudioTrackInfo doesn't provide more information.
+ audio = service.audioTracks()
+ if audio:
+ n = audio.getNumberOfTracks()
+ for x in range(n):
+ i = audio.getTrackInfo(x)
+ description = i.getDescription();
+ if description.find("AC3") != -1 or description.find("DTS") != -1:
+ return True
+ return False
+ elif self.type == self.IS_CRYPTED:
+ return info.getInfo(iServiceInformation.sIsCrypted) == 1
+ elif self.type == self.IS_WIDESCREEN:
+ return info.getInfo(iServiceInformation.sAspect) in [3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10]
+ elif self.type == self.SUBSERVICES_AVAILABLE:
+ subservices = service.subServices()
+ return subservices and subservices.getNumberOfSubservices() > 0
+
+ boolean = property(getBoolean)
diff --git a/lib/python/Components/Converter/ServiceName.py b/lib/python/Components/Converter/ServiceName.py
index 79e0c997..094dbdfa 100644
--- a/lib/python/Components/Converter/ServiceName.py
+++ b/lib/python/Components/Converter/ServiceName.py
@@ -25,7 +25,7 @@ class ServiceName(Converter, object):
return ""
if self.type == self.NAME:
- return service.getName()
+ return info.getName()
elif self.type == self.PROVIDER:
return self.getServiceInfoValue(info, iServiceInformation.sProvider)