1 from HTMLComponent import *
2 from GUIComponent import *
4 from Tools.FuzzyDate import FuzzyTime
6 from enigma import eListboxPythonMultiContent, eListbox, gFont
7 from timer import TimerEntry
22 # | <Service> <Name of the Timer> |
23 # | <start, end> <state> |
25 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 print [FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1]]
43 print (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:])
44 res.append((0, 30, 200, 20, 1, RT_HALIGN_LEFT, repeatedtext + (" %s ... %s" % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1]))))
46 res.append((0, 30, 200, 20, 1, RT_HALIGN_LEFT, repeatedtext + ("%s, %s ... %s" % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:]))))
48 res.append((300, 0, 200, 20, 1, RT_HALIGN_RIGHT, timer.description))
51 if timer.state == TimerEntry.StateWait:
53 elif timer.state == TimerEntry.StatePrepare:
54 state = "about to start"
55 elif timer.state == TimerEntry.StateRunning:
56 state = "recording..."
62 res.append((300, 30, 200, 20, 1, RT_HALIGN_RIGHT, state))
66 class TimerList(HTMLComponent, GUIComponent):
67 def __init__(self, list):
68 GUIComponent.__init__(self)
69 self.l = eListboxPythonMultiContent()
71 self.l.setFont(0, gFont("Arial", 20))
72 self.l.setFont(1, gFont("Arial", 18))
75 return self.l.getCurrentSelection()
77 def GUIcreate(self, parent):
78 self.instance = eListbox(parent)
79 self.instance.setContent(self.l)
80 self.instance.setItemHeight(50)
83 self.instance.setContent(None)