1 from HTMLComponent import *
2 from GUIComponent import *
4 from Tools.FuzzyDate import FuzzyTime
7 from enigma import eListboxPythonMultiContent, eListbox, gFont
8 from timer import TimerEntry
23 # | <Service> <Name of the Timer> |
24 # | <start, end> <state> |
26 def TimerEntryComponent(timer, processed):
29 res.append((0, 0, 400, 30, 0, RT_HALIGN_LEFT, timer.service_ref.getServiceName()))
31 days = [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" ]
32 if (timer.repeated != 0):
33 flags = timer.repeated
39 repeatedtext += days[x]
42 res.append((0, 30, 200, 20, 1, RT_HALIGN_LEFT, repeatedtext + (" %s ... %s" % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1]))))
44 res.append((0, 30, 200, 20, 1, RT_HALIGN_LEFT, repeatedtext + ("%s, %s ... %s" % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:]))))
46 res.append((300, 0, 200, 20, 1, RT_HALIGN_RIGHT, timer.name))
49 if timer.state == TimerEntry.StateWait:
51 elif timer.state == TimerEntry.StatePrepare:
52 state = "about to start"
53 elif timer.state == TimerEntry.StateRunning:
54 state = "recording..."
60 res.append((300, 30, 200, 20, 1, RT_HALIGN_RIGHT, state))
64 class TimerList(HTMLComponent, GUIComponent):
65 def __init__(self, list):
66 GUIComponent.__init__(self)
67 self.l = eListboxPythonMultiContent()
69 self.l.setFont(0, gFont("Arial", 20))
70 self.l.setFont(1, gFont("Arial", 18))
73 return self.l.getCurrentSelection()
75 def GUIcreate(self, parent):
76 self.instance = eListbox(parent)
77 self.instance.setContent(self.l)
78 self.instance.setItemHeight(50)
81 self.instance.setContent(None)