missing commit
[enigma2.git] / lib / python / Components / GUISkin.py
1 from GUIComponent import *
2 from skin import applyAllAttributes
3
4 class GUISkin:
5         __module__ = __name__
6
7         def __init__(self):
8                 self.onLayoutFinish = [ ]
9                 self.summaries = [ ]
10
11         def createGUIScreen(self, parent, desktop):
12                 for val in self.values() + self.renderer:
13                         if isinstance(val, GUIComponent):
14                                 val.GUIcreate(parent)
15                                 val.applySkin(desktop)
16
17                 for w in self.additionalWidgets:
18                         w.instance = w.widget(parent)
19                         # w.instance.thisown = 0
20                         applyAllAttributes(w.instance, desktop, w.skinAttributes)
21                 
22                 for f in self.onLayoutFinish:
23                         if type(f) is not type(self.close): # is this the best way to do this?
24                                 exec(f) in globals(), locals()
25                         else:
26                                 f()
27
28         def deleteGUIScreen(self):
29                 for (name, val) in self.items():
30                         if isinstance(val, GUIComponent):
31                                 val.GUIdelete()
32
33         def close(self):
34                 self.deleteGUIScreen()
35
36         def createSummary(self):
37                 return None
38
39         def addSummary(self, summary):
40                 self.summaries.append(summary)
41
42         def removeSummary(self, summary):
43                 self.summaries.remove(summary)
44
45         def setTitle(self, title):
46                 self.instance.setTitle(title)
47                 self.title = title
48                 
49                 for x in self.summaries:
50                         x.setTitle(title)