aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens/Screen.py
blob: b1e5a51e2da5f4d7e61c7569f0c4f0aa8b8ae7b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from Components.HTMLSkin import *
from Components.GUISkin import *

import sys

class Screen(dict, HTMLSkin, GUISkin):
	""" bla """

	def __init__(self, session):
		self.skinName = self.__class__.__name__
		self.session = session
		GUISkin.__init__(self)
		
		self.onClose = [ ]
		
		# in order to support screens *without* a help,
		# we need the list in every screen. how ironic.
		self.helpList = [ ]
		
	def execBegin(self):
#		assert self.session == None, "a screen can only exec one per time"
#		self.session = session
		for (name, val) in self.items():
			val.execBegin()
	
	def execEnd(self):
		for (name, val) in self.items():
			val.execEnd()
#		assert self.session != None, "execEnd on non-execing screen!"
#		self.session = None
	
	# never call this directly - it will be called from the session!
	def doClose(self):
		for x in self.onClose:
			x()
		
		# fixup circular references
		del self.helpList
		GUISkin.close(self)
		
		del self.session
		for (name, val) in self.items():
			del self[name]
	
	def close(self, *retval):
		self.session.close(*retval)

	def setFocus(self, o):
		self.instance.setFocus(o.instance)