1 from Components.HTMLSkin import *
2 from Components.GUISkin import *
3 from Components.Sources.Source import Source
7 class Screen(dict, HTMLSkin, GUISkin):
11 def __init__(self, session):
12 self.skinName = self.__class__.__name__
13 self.session = session
14 GUISkin.__init__(self)
17 self.onExecBegin = [ ]
28 # in order to support screens *without* a help,
29 # we need the list in every screen. how ironic.
33 self.active_components = [ ]
34 for x in self.onExecBegin:
36 if self.session.current_dialog != self:
39 # assert self.session == None, "a screen can only exec once per time"
40 # self.session = session
42 for val in self.values() + self.renderer:
44 if self.session.current_dialog != self:
46 self.active_components.append(val)
50 for x in self.onShown:
54 # for (name, val) in self.items():
55 for val in self.active_components:
57 del self.active_components
58 # assert self.session != None, "execEnd on non-execing screen!"
62 # never call this directly - it will be called from the session!
65 for x in self.onClose:
68 # fixup circular references
72 # first disconnect all render from their sources.
73 # we might split this out into a "unskin"-call,
74 # but currently we destroy the screen afterwards
76 for val in self.renderer:
77 val.disconnectAll() # disconnected converter/sources and probably destroy them
80 for (name, val) in self.items():
84 for val in self.renderer:
89 # really delete all elements now
92 def close(self, *retval):
93 self.session.close(self, *retval)
95 def setFocus(self, o):
96 self.instance.setFocus(o.instance)
103 for x in self.onShow:
105 for val in self.values() + self.renderer:
106 if isinstance(val, GUIComponent) or isinstance(val, Source):
114 for x in self.onHide:
116 for val in self.values() + self.renderer:
117 if isinstance(val, GUIComponent) or isinstance(val, Source):
121 return str(type(self))