1 # -*- coding: utf-8 -*-
3 # EventListDisplay - Renderer
5 # Coded by Dr.Best (c) 2013
6 # Support: www.dreambox-tools.info
7 # E-Mail: dr.best@dreambox-tools.info
9 # This plugin is open source but it is NOT free software.
11 # This plugin may only be distributed to and executed on hardware which
12 # is licensed by Dream Multimedia GmbH.
14 # It's NOT allowed to distribute any parts of this plugin or its source code in ANY way
15 # to hardware which is NOT licensed by Dream Multimedia GmbH.
16 # It's NOT allowed to execute this plugin and its source code or even parts of it in ANY way
17 # on hardware which is NOT licensed by Dream Multimedia GmbH.
19 # If you want to use or modify the code or parts of it,
20 # you have to keep MY license and inform me about the modifications by mail.
23 from Renderer import Renderer
24 from enigma import eCanvas, eRect, gFont
25 from skin import parseColor, parseFont
27 class EventListDisplay(Renderer):
31 Renderer.__init__(self)
32 self.backgroundColor = parseColor("#ff000000")
35 self.primetimeoffset = 10
37 def pull_updates(self):
38 if self.instance is None:
40 self.instance.clear(self.backgroundColor)
41 content = self.source.getContent()
42 content_count = len(content)
43 primetime = self.source.primetime
44 if primetime == 1 and content_count == 1:
51 if self.columns.has_key(str(i)):
52 value = self.columns[str(i)]
53 self.instance.writeText(eRect(value[0], y+int((self.rowHeight-value[4])/2), value[1], self.rowHeight), value[2], self.backgroundColor, value[3], item[value[5]], value[6])
57 if a == content_count and primetime == 1:
58 y += self.primetimeoffset
60 def changed(self, what):
63 def applySkin(self, desktop, parent):
66 from enigma import eSize
70 return eSize(int(x), int(y))
72 def parseColumnValue(value):
73 x, length, color, fontname, fontheight, align, itemindex = value.split(',')
74 return (int(x), int(length), parseColor(color), gFont(fontname,int(fontheight)), int(fontheight), int(itemindex), int(align))
76 for (attrib, value) in self.skinAttributes:
78 self.instance.setSize(parseSize(value))
79 attribs.append((attrib,value))
80 elif attrib == "column0":
81 self.columns["0"] = parseColumnValue(value)
82 elif attrib == "column1":
83 self.columns["1"] = parseColumnValue(value)
84 elif attrib == "column2":
85 self.columns["2"] = parseColumnValue(value)
86 elif attrib == "rowHeight":
87 self.rowHeight = int(value)
88 elif attrib == "primetimeoffset":
89 self.primetimeoffset = int(value)
90 elif attrib == "backgroundColor":
91 self.backgroundColor = parseColor(value)
92 self.instance.clear(self.backgroundColor)
93 attribs.append((attrib,value))
95 attribs.append((attrib,value))
96 self.skinAttributes = attribs
97 return Renderer.applySkin(self, desktop, parent)