16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2002 Free Software Foundation |
# Copyright 2002-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# ScreenContainer.py |
# ScreenContainer.py |
68 |
|
|
69 |
self.STARTPOINT = 0 |
self.STARTPOINT = 0 |
70 |
self.breakUp = 0 |
self.breakUp = 0 |
71 |
self.SetColor(sio.C_SCREEN) |
self.SetColor(SIOInstance.colors.C_BACKGROUND) |
72 |
self.nextCtl = None |
self.nextCtl = None |
73 |
self.eventX = -1 |
self.eventX = -1 |
74 |
self.eventY = -1 |
self.eventY = -1 |
103 |
del self.Metrics[child] |
del self.Metrics[child] |
104 |
|
|
105 |
def RaiseFrame(self, frame): |
def RaiseFrame(self, frame): |
106 |
|
self._CurrentFocus = None |
107 |
self._CurrentFrame = frame |
self._CurrentFrame = frame |
108 |
frame.VISIBLE = 1 |
frame.VISIBLE = 1 |
109 |
self.FrameStackOrder.pop(self.Frames.index(frame)) |
self.FrameStackOrder.pop(self.Frames.index(frame)) |
110 |
self.FrameStackOrder.insert(0,frame) |
self.FrameStackOrder.insert(0,frame) |
111 |
|
frame.Paint() |
112 |
|
|
113 |
def AddControl(self, control): |
def AddControl(self, control): |
114 |
""" |
""" |
146 |
instance. Effectively repainting the entire container iteratively. |
instance. Effectively repainting the entire container iteratively. |
147 |
""" |
""" |
148 |
if not self.VISIBLE: |
if not self.VISIBLE: |
149 |
return |
return |
150 |
|
|
151 |
if captureRefresh: |
if captureRefresh: |
152 |
self.SCREEN.AutoRefresh = 0 |
self.SCREEN.AutoRefresh = 0 |
|
self.LoLight() |
|
153 |
|
|
154 |
for Control in self.Controls: |
for Control in self.Controls: |
155 |
Control.ExecMethod("SYSPAINT", None, None, None) |
Control.ExecMethod("SYSPAINT", None, None, None) |
185 |
if myCsi == None: |
if myCsi == None: |
186 |
myCsi = 0 |
myCsi = 0 |
187 |
|
|
188 |
|
GDebug.printMesg(0, 'I am a running fewl; s/I/%s/' % self) |
189 |
|
GDebug.printMesg(0, self._CurrentFrame) |
190 |
|
GDebug.printMesg(0, self.Controls) |
191 |
|
|
192 |
# event loop runs forever |
# event loop runs forever |
193 |
while 1: |
while 1: |
194 |
activate = 0 |
activate = 0 |
273 |
activate = 0 |
activate = 0 |
274 |
|
|
275 |
|
|
|
## def Run(self): |
|
|
## """Run""" |
|
|
## self.Paint() |
|
|
## |
|
|
## # myControlStackIndex |
|
|
## myCsi = self.STARTPOINT |
|
|
## # Sanity check the Csi |
|
|
## if myCsi == None: |
|
|
## myCsi = 0 |
|
|
## |
|
|
## # event loop runs forever |
|
|
## while 1: |
|
|
## activate = 0 |
|
|
## |
|
|
## # if breakUp is set to TermInfoTrue, return ControlStackIndex |
|
|
## # less one. |
|
|
## if self.breakUp : |
|
|
## self.breakUp = 0 |
|
|
## return myCsi-1 |
|
|
## |
|
|
## # Sanity check the Control Stack index (again!), reset index to |
|
|
## # zero on exception. |
|
|
## try: |
|
|
## myCtl = self.Controls[myCsi] |
|
|
## except: |
|
|
## myCsi = 0 |
|
|
## try: |
|
|
## myCtl = self.Controls[myCsi] |
|
|
## except: |
|
|
## print "WARNING: No widgets!!" |
|
|
## return |
|
|
## |
|
|
## # if nextControl is not at the initial state: ie. in the "loaded" |
|
|
## # state: |
|
|
## if self.nextCtl != None: |
|
|
## # get and set the next desired ControlStackIndex based on |
|
|
## # the next queued up control |
|
|
## myCsi = self.Controls.index(self.nextCtl) |
|
|
## # reassign myCtl control to the next desired. |
|
|
## myCtl = self.nextCtl |
|
|
## # reset the next Control value to None |
|
|
## self.nextCtl = None |
|
|
## # My control is set and ready, mark it to be activated. |
|
|
## activate = 1 |
|
|
## |
|
|
## # if this control has explicitly been set to 'non-active' with |
|
|
## # Control.DeActivate or Control.SetActiveState then don't |
|
|
## # initialize it. |
|
|
## if myCtl.active == 0: |
|
|
## # assign the next active control stack index to myCsi |
|
|
## myCsi = self.__GetNextActiveCtlIndex(myCsi) |
|
|
## |
|
|
## # Otherwise, we have an 'active' Control! |
|
|
## # "only go to the control if it can get focus" |
|
|
## elif myCtl.CANGETFOCUS: |
|
|
## # call system level gotfocus |
|
|
## c = self.SetFocus(myCtl, activate) |
|
|
## if c != None: |
|
|
## myCsi = c |
|
|
## |
|
|
## activate = 0 |
|
|
|
|
276 |
|
|
277 |
def SetFocus(self, myCtl, activate=1, run=1): |
def SetFocus(self, myCtl, activate=1, run=1): |
278 |
|
|
295 |
# do system level run |
# do system level run |
296 |
if myCtl.ExecMethod( "SYSRUN", activate, |
if myCtl.ExecMethod( "SYSRUN", activate, |
297 |
self.eventY, self.eventX) : |
self.eventY, self.eventX) : |
298 |
return myCsi |
return 0 |
299 |
|
|
300 |
else: |
else: |
301 |
# otherwise, _just_ do system level run |
# otherwise, _just_ do system level run |
302 |
if myCtl.ExecMethod("SYSRUN", activate, |
if myCtl.ExecMethod("SYSRUN", activate, |
303 |
self.eventY, self.eventX) : |
self.eventY, self.eventX) : |
304 |
return myCsi |
return 0 |
305 |
|
|
306 |
|
|
307 |
def _LoseFocus(self, myCtl): |
def _LoseFocus(self, myCtl): |
385 |
|
|
386 |
|
|
387 |
def __PaintBorder(self, caption=None): |
def __PaintBorder(self, caption=None): |
|
self.LoLight() |
|
388 |
DialogWidth = self.Width() |
DialogWidth = self.Width() |
389 |
DialogHeight = self.Height() |
DialogHeight = self.Height() |
390 |
_paintBorder( self, 0,0, DialogHeight, DialogWidth, caption=caption) |
_paintBorder( self, 0,0, DialogHeight, DialogWidth, caption=caption) |