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.onFirstExecBegin = [ ]
18 self.onExecBegin = [ ]
29 # in order to support screens *without* a help,
30 # we need the list in every screen. how ironic.
33 self.close_on_next_exec = None
36 self.active_components = [ ]
37 if self.close_on_next_exec is not None:
38 tmp = self.close_on_next_exec
39 self.close_on_next_exec = None
43 single = self.onFirstExecBegin
44 self.onFirstExecBegin = []
45 for x in self.onExecBegin + single:
47 if self.session.current_dialog != self:
50 # assert self.session == None, "a screen can only exec once per time"
51 # self.session = session
53 for val in self.values() + self.renderer:
55 if self.session.current_dialog != self:
57 self.active_components.append(val)
61 for x in self.onShown:
65 # for (name, val) in self.items():
66 for val in self.active_components:
68 del self.active_components
69 # assert self.session != None, "execEnd on non-execing screen!"
73 # never call this directly - it will be called from the session!
76 for x in self.onClose:
79 # fixup circular references
83 # first disconnect all render from their sources.
84 # we might split this out into a "unskin"-call,
85 # but currently we destroy the screen afterwards
87 for val in self.renderer:
88 val.disconnectAll() # disconnected converter/sources and probably destroy them
91 for (name, val) in self.items():
95 for val in self.renderer:
100 # really delete all elements now
101 self.__dict__.clear()
103 def close(self, *retval):
105 self.close_on_next_exec = retval
107 self.session.close(self, *retval)
109 def setFocus(self, o):
110 self.instance.setFocus(o.instance)
117 for x in self.onShow:
119 for val in self.values() + self.renderer:
120 if isinstance(val, GUIComponent) or isinstance(val, Source):
128 for x in self.onHide:
130 for val in self.values() + self.renderer:
131 if isinstance(val, GUIComponent) or isinstance(val, Source):
135 return str(type(self))