use a CList for 'summaries' list for easier calling
[enigma2.git] / lib / python / Components / GUISkin.py
1 from GUIComponent import *
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.values() + self.renderer:
14                         if isinstance(val, GUIComponent):
15                                 val.GUIcreate(parent)
16                                 val.applySkin(desktop)
17
18                 for w in self.additionalWidgets:
19                         w.instance = w.widget(parent)
20                         # w.instance.thisown = 0
21                         applyAllAttributes(w.instance, desktop, w.skinAttributes)
22
23                 for f in self.onLayoutFinish:
24                         if type(f) is not type(self.close): # is this the best way to do this?
25                                 exec(f) in globals(), locals()
26                         else:
27                                 f()
28
29         def deleteGUIScreen(self):
30                 for (name, val) in self.items():
31                         if isinstance(val, GUIComponent):
32                                 val.GUIdelete()
33
34         def close(self):
35                 self.deleteGUIScreen()
36
37         def createSummary(self):
38                 return None
39
40         def addSummary(self, summary):
41                 self.summaries.append(summary)
42
43         def removeSummary(self, summary):
44                 self.summaries.remove(summary)
45
46         def setTitle(self, title):
47                 self.instance.setTitle(title)
48                 self.title = title
49                 self.summaries.setTitle(title)