movie player configuration options, by Anders Holst
[enigma2.git] / lib / python / Components / GUISkin.py
1 from GUIComponent import GUIComponent
2 from skin import applyAllAttributes
3 from Tools.CList import CList
4
5 class GUISkin:
6         __module__ = __name__
7
8         def __init__(self):
9                 self.onLayoutFinish = [ ]
10                 self.summaries = CList()
11
12         def createGUIScreen(self, parent, desktop):
13                 for val in self.renderer:
14                         if isinstance(val, GUIComponent):
15                                 val.GUIcreate(parent)
16                                 if not val.applySkin(desktop):
17                                         print "warning, skin is missing renderer", val, "in", self
18
19                 for key in self:
20                         val = self[key]
21                         if isinstance(val, GUIComponent):
22                                 val.GUIcreate(parent)
23                                 depr = val.deprecationInfo
24                                 if val.applySkin(desktop):
25                                         if depr:
26                                                 print "WARNING: OBSOLETE COMPONENT '%s' USED IN SKIN. USE '%s' INSTEAD!" % (key, depr[0])
27                                                 print "OBSOLETE COMPONENT WILL BE REMOVED %s, PLEASE UPDATE!" % (depr[1])
28                                 elif not depr:
29                                         print "warning, skin is missing element", key, "in", self
30
31                 for w in self.additionalWidgets:
32                         w.instance = w.widget(parent)
33                         # w.instance.thisown = 0
34                         applyAllAttributes(w.instance, desktop, w.skinAttributes)
35
36                 for f in self.onLayoutFinish:
37                         if type(f) is not type(self.close): # is this the best way to do this?
38                                 exec(f) in globals(), locals()
39                         else:
40                                 f()
41
42         def deleteGUIScreen(self):
43                 for (name, val) in self.items():
44                         if isinstance(val, GUIComponent):
45                                 val.GUIdelete()
46
47         def close(self):
48                 self.deleteGUIScreen()
49
50         def createSummary(self):
51                 return None
52
53         def addSummary(self, summary):
54                 self.summaries.append(summary)
55
56         def removeSummary(self, summary):
57                 self.summaries.remove(summary)
58
59         def setTitle(self, title):
60                 self.instance.setTitle(title)
61                 self.title = title
62                 self.summaries.setTitle(title)