1 from Components.HTMLSkin import *
2 from Components.GUISkin import *
3 from Components.Sources.Source import Source
7 class Screen(dict, HTMLSkin, GUISkin):
10 def __init__(self, session):
11 self.skinName = self.__class__.__name__
12 self.session = session
13 GUISkin.__init__(self)
16 self.onExecBegin = [ ]
25 # in order to support screens *without* a help,
26 # we need the list in every screen. how ironic.
30 self.active_components = [ ]
31 for x in self.onExecBegin:
33 if self.session.current_dialog != self:
36 # assert self.session == None, "a screen can only exec once per time"
37 # self.session = session
39 for val in self.values() + self.renderer:
41 if self.session.current_dialog != self:
43 self.active_components.append(val)
47 for x in self.onShown:
51 # for (name, val) in self.items():
52 for val in self.active_components:
54 del self.active_components
55 # assert self.session != None, "execEnd on non-execing screen!"
59 # never call this directly - it will be called from the session!
62 for x in self.onClose:
65 # fixup circular references
69 # first disconnect all render from their sources.
70 # we might split this out into a "unskin"-call,
71 # but currently we destroy the screen afterwards
73 for val in self.renderer:
74 val.disconnectAll() # disconnected converter/sources and probably destroy them
77 for (name, val) in self.items():
81 for val in self.renderer:
86 # really delete all elements now
89 def close(self, *retval):
90 self.session.close(self, *retval)
92 def setFocus(self, o):
93 self.instance.setFocus(o.instance)
100 for x in self.onShow:
102 for val in self.values() + self.renderer:
103 if isinstance(val, GUIComponent) or isinstance(val, Source):
111 for x in self.onHide:
113 for val in self.values() + self.renderer:
114 if isinstance(val, GUIComponent) or isinstance(val, Source):
118 return str(type(self))