2 from Components.MenuList import MenuList
3 from Components.MultiContent import MultiContentEntryText
4 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT, \
5 RT_HALIGN_RIGHT, RT_VALIGN_CENTER
7 from ServiceReference import ServiceReference
8 from Tools.FuzzyDate import FuzzyTime
10 class AutoTimerList(MenuList):
11 """Defines a simple Component to show Timer name"""
13 def __init__(self, entries):
14 MenuList.__init__(self, entries, False, content = eListboxPythonMultiContent)
16 self.l.setFont(0, gFont("Regular", 22))
17 self.l.setBuildFunc(self.buildListboxEntry)
18 self.l.setItemHeight(25)
21 # | <Name of AutoTimer> |
23 def buildListboxEntry(self, timer):
25 width = self.l.getItemSize().width()
28 # Append with default color
29 res.append(MultiContentEntryText(pos=(5, 0), size=(width, 25), font=0, flags = RT_HALIGN_LEFT, text = timer.name))
31 # Append with grey as color
32 res.append(MultiContentEntryText(pos=(5, 0), size=(width, 25), font=0, flags = RT_HALIGN_LEFT, text = timer.name, color = 12368828))
36 class AutoTimerPreviewList(MenuList):
37 """Preview Timers, emulates TimerList"""
39 def __init__(self, entries):
40 MenuList.__init__(self, entries, False, content = eListboxPythonMultiContent)
42 self.l.setFont(0, gFont("Regular", 20))
43 self.l.setFont(1, gFont("Regular", 18))
44 self.l.setBuildFunc(self.buildListboxEntry)
45 self.l.setItemHeight(70)
48 # | <Service> <Name of the Event> |
49 # | <start, end> <Name of AutoTimer> |
51 def buildListboxEntry(self, name, begin, end, serviceref, timername):
53 width = self.l.getItemSize().width()
55 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, width, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, ServiceReference(serviceref).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', '')))
56 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 30, width, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, name))
58 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, 400, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, (("%s, %s ... %s (%d " + _("mins") + ")") % (FuzzyTime(begin) + FuzzyTime(end)[1:] + ((end - begin) / 60,)))))
60 res.append((eListboxPythonMultiContent.TYPE_TEXT, width-240, 50, 240, 20, 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, timername))
67 def moveToEntry(self, entry):
74 self.instance.moveSelectionTo(idx)