Poll.py RemainingToText.py StringList.py ServiceName.py FrontendInfo.py ServiceInfo.py \
ConditionalShowHide.py ServicePosition.py ValueRange.py RdsInfo.py Streaming.py \
StaticMultiList.py ServiceTime.py MovieInfo.py MenuEntryCompare.py StringListSelection.py \
- ValueBitTest.py TunerInfo.py ConfigEntryTest.py TemplatedMultiContent.py
-
+ ValueBitTest.py TunerInfo.py ConfigEntryTest.py TemplatedMultiContent.py ProgressToText.py
\ No newline at end of file
--- /dev/null
+from Components.Converter.Converter import Converter
+from Components.Element import cached
+
+class ProgressToText(Converter, object):
+ def __init__(self, type):
+ Converter.__init__(self, type)
+ self.in_percent = "InPercent" in type.split(',')
+
+ @cached
+ def getText(self):
+ r = self.source.range
+ v = self.source.value
+
+ if self.in_percent:
+ if r:
+ return "%d %%" % (v * 100 / r)
+ else:
+ return None
+ else:
+ return "%d / %d" % (v, r)
+
+ text = property(getText)
__init__.py Clock.py EventInfo.py Source.py List.py CurrentService.py \
FrontendStatus.py Boolean.py Config.py ServiceList.py RdsDecoder.py StreamService.py \
StaticText.py CanvasSource.py ServiceEvent.py Event.py FrontendInfo.py TunerInfo.py \
- RecordState.py
+ RecordState.py Progress.py
--- /dev/null
+from Source import Source
+
+class Progress(Source):
+ def __init__(self, value = 0, range = 100):
+ Source.__init__(self)
+ self.__value = value
+ self.range = range
+
+ def getValue(self):
+ return self.__value
+
+ def setValue(self, value):
+ self.__value = value
+ self.changed((self.CHANGED_ALL,))
+
+ value = property(getValue, setValue)