6e5ac21de5fb65df6108eb80c915160d8d0857d1
[enigma2.git] / lib / python / Screens / Screen.py
1 from Components.HTMLSkin import *
2 from Components.GUISkin import *
3
4 import sys
5
6 class Screen(dict, HTMLSkin, GUISkin):
7         """ bla """
8
9         def __init__(self, session):
10                 self.skinName = self.__class__.__name__
11                 self.session = session
12                 GUISkin.__init__(self)
13                 
14                 self.onClose = [ ]
15                 self.onExecBegin = [ ]
16                 
17                 # in order to support screens *without* a help,
18                 # we need the list in every screen. how ironic.
19                 self.helpList = [ ]
20                 
21         def execBegin(self):
22                 for x in self.onExecBegin:
23                         x()
24 #               assert self.session == None, "a screen can only exec one per time"
25 #               self.session = session
26                 for (name, val) in self.items():
27                         val.execBegin()
28         
29         def execEnd(self):
30                 for (name, val) in self.items():
31                         val.execEnd()
32 #               assert self.session != None, "execEnd on non-execing screen!"
33 #               self.session = None
34         
35         # never call this directly - it will be called from the session!
36         def doClose(self):
37                 for x in self.onClose:
38                         x()
39                 
40                 # fixup circular references
41                 del self.helpList
42                 GUISkin.close(self)
43                 
44                 del self.session
45                 for (name, val) in self.items():
46                         del self[name]
47         
48         def close(self, *retval):
49                 self.session.close(*retval)
50
51         def setFocus(self, o):
52                 self.instance.setFocus(o.instance)