# GUI (Components)
from Components.MenuList import MenuList
-from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT, \
- RT_HALIGN_RIGHT, RT_VALIGN_CENTER
+from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
from skin import parseColor, parseFont
-from ServiceReference import ServiceReference
-from Tools.FuzzyDate import FuzzyTime
-
class AutoTimerList(MenuList):
"""Defines a simple Component to show Timer name"""
break
idx += 1
-class AutoTimerPreviewList(MenuList):
- """Preview Timers, emulates TimerList"""
-
- def __init__(self, entries):
- MenuList.__init__(self, entries, False, content = eListboxPythonMultiContent)
-
- self.l.setFont(0, gFont("Regular", 20))
- self.l.setFont(1, gFont("Regular", 18))
- self.l.setBuildFunc(self.buildListboxEntry)
- self.l.setItemHeight(70)
-
- def applySkin(self, desktop, parent):
- attribs = [ ]
- if self.skinAttributes is not None:
- for (attrib, value) in self.skinAttributes:
- if attrib == "font":
- self.l.setFont(1, parseFont(value, ((1,1),(1,1))))
- elif attrib == "serviceNameFont":
- self.l.setFont(0, parseFont(value, ((1,1),(1,1))))
- elif attrib == "colorDisabled":
- self.colorDisabled = int(parseColor(value))
- elif attrib == "itemHeight":
- self.l.setItemHeight(int(value))
- else:
- attribs.append((attrib, value))
- self.skinAttributes = attribs
- return MenuList.applySkin(self, desktop, parent)
-
- #
- # | <Service> <Name of the Event> |
- # | <start, end> <Name of AutoTimer> |
- #
- def buildListboxEntry(self, name, begin, end, serviceref, timername):
- size = self.l.getItemSize()
- width = size.width()
-
- # XXX: this does not scale very well yet
- return [
- None,
- (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, width, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, \
- ServiceReference(serviceref).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', '')),
- (eListboxPythonMultiContent.TYPE_TEXT, 0, 30, width, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, name),
- (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,)))),
- (eListboxPythonMultiContent.TYPE_TEXT, width - 245, 50, 240, 20, 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, timername)
- ]
-
- def invalidate(self):
- self.l.invalidate()
-
- def moveToEntry(self, entry):
- if entry is None:
- return
-
- idx = 0
- for x in self.list:
- if x == entry:
- self.instance.moveSelectionTo(idx)
- break
- idx += 1
-