aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2008-04-14 23:27:01 +0000
committerFelix Domke <tmbinc@elitedvb.net>2008-04-14 23:27:01 +0000
commitbf52e20ac1d227427cddfdef1437e33a55ab502b (patch)
tree3dd0a0a0572af3e83a945c85ada83a9a9c1fe7b3 /lib/python
parent47367fb1c159557cb3676f67172b9839531c8dc9 (diff)
downloadenigma2-bf52e20ac1d227427cddfdef1437e33a55ab502b.tar.gz
enigma2-bf52e20ac1d227427cddfdef1437e33a55ab502b.zip
add 'progress' source, 'progress to text' converter
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/Converter/Makefile.am3
-rw-r--r--lib/python/Components/Converter/ProgressToText.py22
-rw-r--r--lib/python/Components/Sources/Makefile.am2
-rw-r--r--lib/python/Components/Sources/Progress.py16
4 files changed, 40 insertions, 3 deletions
diff --git a/lib/python/Components/Converter/Makefile.am b/lib/python/Components/Converter/Makefile.am
index 0fff9c8d..331a6dc0 100644
--- a/lib/python/Components/Converter/Makefile.am
+++ b/lib/python/Components/Converter/Makefile.am
@@ -5,5 +5,4 @@ install_PYTHON = \
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
diff --git a/lib/python/Components/Converter/ProgressToText.py b/lib/python/Components/Converter/ProgressToText.py
new file mode 100644
index 00000000..0ad3a88c
--- /dev/null
+++ b/lib/python/Components/Converter/ProgressToText.py
@@ -0,0 +1,22 @@
+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)
diff --git a/lib/python/Components/Sources/Makefile.am b/lib/python/Components/Sources/Makefile.am
index 5ac636c8..d04013ff 100644
--- a/lib/python/Components/Sources/Makefile.am
+++ b/lib/python/Components/Sources/Makefile.am
@@ -4,4 +4,4 @@ install_PYTHON = \
__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
diff --git a/lib/python/Components/Sources/Progress.py b/lib/python/Components/Sources/Progress.py
new file mode 100644
index 00000000..b96065b3
--- /dev/null
+++ b/lib/python/Components/Sources/Progress.py
@@ -0,0 +1,16 @@
+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)