1 from HTMLComponent import *
2 from GUIComponent import *
4 from Tools.FuzzyDate import FuzzyTime
7 from enigma import eListboxPythonMultiContent, eListbox, gFont, loadPNG
8 from timer import TimerEntry
9 from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
24 # | <Service> <Name of the Timer> |
25 # | <start, end> <state> |
27 def TimerEntryComponent(timer, processed):
30 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 560, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, timer.service_ref.getServiceName()))
31 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 30, 560, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, timer.name))
34 days = [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ]
36 flags = timer.repeated
42 repeatedtext += days[x]
46 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 400, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s "+ _("(ZAP)")) % (FuzzyTime(timer.begin)[1]))))
48 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))))
51 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 400, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s " + _("(ZAP)")) % (FuzzyTime(timer.begin)))))
53 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,)))))
56 if timer.state == TimerEntry.StateWaiting:
58 elif timer.state == TimerEntry.StatePrepared:
59 state = _("about to start")
60 elif timer.state == TimerEntry.StateRunning:
64 state = _("recording...")
66 state = _("<unknown>")
70 res.append((eListboxPythonMultiContent.TYPE_TEXT, 320, 50, 240, 20, 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, state))
73 png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "redx.png"))
74 res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 490, 5, 40, 40, png))
78 class TimerList(HTMLComponent, GUIComponent, object):
79 def __init__(self, list):
80 GUIComponent.__init__(self)
81 self.l = eListboxPythonMultiContent()
83 self.l.setFont(0, gFont("Regular", 20))
84 self.l.setFont(1, gFont("Regular", 18))
87 return self.l.getCurrentSelection()
91 def postWidgetCreate(self, instance):
92 instance.setContent(self.l)
93 instance.setItemHeight(70)
95 def moveToIndex(self, index):
96 self.instance.moveSelectionTo(index)
98 def getCurrentIndex(self):
99 return self.instance.getCurrentIndex()
101 currentIndex = property(moveToIndex, getCurrentIndex)
102 currentSelection = property(getCurrent)
105 self.instance.moveSelection(self.instance.moveDown)
107 def invalidate(self):