1 from GUIComponent import GUIComponent
2 from skin import applyAllAttributes
3 from Tools.CList import CList
4 from Sources.StaticText import StaticText
10 self["Title"] = StaticText()
11 self.onLayoutFinish = [ ]
12 self.summaries = CList()
16 def createGUIScreen(self, parent, desktop, updateonly = False):
17 for val in self.renderer:
18 if isinstance(val, GUIComponent):
21 if not val.applySkin(desktop, self):
22 print "warning, skin is missing renderer", val, "in", self
26 if isinstance(val, GUIComponent):
29 depr = val.deprecationInfo
30 if val.applySkin(desktop, self):
32 print "WARNING: OBSOLETE COMPONENT '%s' USED IN SKIN. USE '%s' INSTEAD!" % (key, depr[0])
33 print "OBSOLETE COMPONENT WILL BE REMOVED %s, PLEASE UPDATE!" % (depr[1])
35 print "warning, skin is missing element", key, "in", self
37 for w in self.additionalWidgets:
39 w.instance = w.widget(parent)
40 # w.instance.thisown = 0
41 applyAllAttributes(w.instance, desktop, w.skinAttributes, self.scale)
43 for f in self.onLayoutFinish:
44 if type(f) is not type(self.close): # is this the best way to do this?
45 exec(f) in globals(), locals()
49 def deleteGUIScreen(self):
50 for (name, val) in self.items():
51 if isinstance(val, GUIComponent):
55 self.deleteGUIScreen()
57 def createSummary(self):
60 def addSummary(self, summary):
61 self.summaries.append(summary)
63 def removeSummary(self, summary):
64 self.summaries.remove(summary)
66 def setTitle(self, title):
67 self.instance.setTitle(title)
68 self["Title"].text = title
69 self.summaries.setTitle(title)
72 return self["Title"].text
74 title = property(getTitle, setTitle)
76 def setDesktop(self, desktop):
77 self.desktop = desktop
82 baseres = (720, 576) # FIXME: a skin might have set another resolution, which should be the base res
83 for (key, value) in self.skinAttributes:
84 if key == "zPosition":
88 elif key == "baseResolution":
89 baseres = tuple([int(x) for x in value.split(',')])
90 self.scale = ((baseres[0], baseres[0]), (baseres[1], baseres[1]))
93 from enigma import eWindow
94 self.instance = eWindow(self.desktop, z)
96 # we need to make sure that certain attributes come last
97 self.skinAttributes.sort(key=lambda a: {"position": 1}.get(a[0], 0))
98 self["Title"].text = title
99 applyAllAttributes(self.instance, self.desktop, self.skinAttributes, self.scale)
100 self.createGUIScreen(self.instance, self.desktop)