f97dd8bd9809dbf6f02034be68f0da1d2a193782
[vuplus_dvbapp] / 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                 pass
10
11         def createGUIScreen(self, parent, desktop):
12                 for (name, val) in self.items():
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()