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):
68 self.instance.setTitle(title)
69 self["Title"].text = title
70 self.summaries.setTitle(title)
73 return self["Title"].text
75 title = property(getTitle, setTitle)
77 def setDesktop(self, desktop):
78 self.desktop = desktop
82 baseres = (720, 576) # FIXME: a skin might have set another resolution, which should be the base res
86 for (key, value) in self.skinAttributes:
87 if key == "zPosition":
92 self.skinAttributes[skin_title_idx] = ("title", title)
94 self["Title"].text = value
95 self.summaries.setTitle(value)
96 elif key == "baseResolution":
97 baseres = tuple([int(x) for x in value.split(',')])
99 self.scale = ((baseres[0], baseres[0]), (baseres[1], baseres[1]))
101 if not self.instance:
102 from enigma import eWindow
103 self.instance = eWindow(self.desktop, z)
105 if skin_title_idx == -1 and title:
106 self.skinAttributes.append(("title", title))
108 # we need to make sure that certain attributes come last
109 self.skinAttributes.sort(key=lambda a: {"position": 1}.get(a[0], 0))
111 applyAllAttributes(self.instance, self.desktop, self.skinAttributes, self.scale)
112 self.createGUIScreen(self.instance, self.desktop)