some fixes for dvb-s2
[enigma2.git] / lib / python / Components / TimerList.py
index 5e371a040e07207b6391d4e8900325c7a5c71adb..2f60fcfb27d286820f1aa7b1e12ddabc38970af1 100644 (file)
@@ -42,9 +42,15 @@ def TimerEntryComponent(timer, processed):
                                        repeatedtext += days[x]
                                        count += 1
                                flags = flags >> 1
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 400, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (" %s ... %s" % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1]))))
+               if timer.justplay:
+                       res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 400, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s "+ _("(ZAP)")) % (FuzzyTime(timer.begin)[1]))))
+               else:
+                       res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 400, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60))))
        else:
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 400, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ("%s, %s ... %s" % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:]))))
+               if timer.justplay:
+                       res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 400, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s " + _("(ZAP)")) % (FuzzyTime(timer.begin)))))
+               else:
+                       res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 400, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s ... %s (%d " + _("mins") + ")") % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:] + ((timer.end - timer.begin) / 60,)))))
 
        if not processed:
                if timer.state == TimerEntry.StateWaiting:
@@ -52,7 +58,10 @@ def TimerEntryComponent(timer, processed):
                elif timer.state == TimerEntry.StatePrepared:
                        state = _("about to start")
                elif timer.state == TimerEntry.StateRunning:
-                       state = _("recording...")
+                       if timer.justplay:
+                               state = _("zapped")
+                       else:
+                               state = _("recording...")
                else:
                        state = _("<unknown>")
        else:
@@ -66,7 +75,7 @@ def TimerEntryComponent(timer, processed):
        
        return res
 
-class TimerList(HTMLComponent, GUIComponent):
+class TimerList(HTMLComponent, GUIComponent, object):
        def __init__(self, list):
                GUIComponent.__init__(self)
                self.l = eListboxPythonMultiContent()
@@ -77,10 +86,11 @@ class TimerList(HTMLComponent, GUIComponent):
        def getCurrent(self):
                return self.l.getCurrentSelection()
        
-       def GUIcreate(self, parent):
-               self.instance = eListbox(parent)
-               self.instance.setContent(self.l)
-               self.instance.setItemHeight(70)
+       GUI_WIDGET = eListbox
+       
+       def postWidgetCreate(self, instance):
+               instance.setContent(self.l)
+               instance.setItemHeight(70)
 
        def moveToIndex(self, index):
                self.instance.moveSelectionTo(index)
@@ -88,13 +98,11 @@ class TimerList(HTMLComponent, GUIComponent):
        def getCurrentIndex(self):
                return self.instance.getCurrentIndex()
 
+       currentIndex = property(moveToIndex, getCurrentIndex)
+       currentSelection = property(getCurrent)
+
        def moveDown(self):
                self.instance.moveSelection(self.instance.moveDown)
 
-       def GUIdelete(self):
-               self.instance.setContent(None)
-               self.instance = None
-
        def invalidate(self):
                self.l.invalidate()
-