[Python-checkins] CVS: python/dist/src/Mac/Lib FrameWork.py,1.47,1.47.6.1
Jack Jansen
jackjansen@users.sourceforge.net
Sun, 24 Feb 2002 14:46:30 -0800
Update of /cvsroot/python/python/dist/src/Mac/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv17244
Modified Files:
Tag: release22-maint
FrameWork.py
Log Message:
Backport of 1.47, 1.48 and 1.49:
- Added minimal support for floating windows.
- Changes by Donovan Preston (and a few minor ones by me) to make IDE run under
MachoPython. Mainly making sure we don't call routines that don't exist.
- Don't barf when an AppleEvent was not handled. It's ok to ignore.
Index: FrameWork.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Lib/FrameWork.py,v
retrieving revision 1.47
retrieving revision 1.47.6.1
diff -C2 -d -r1.47 -r1.47.6.1
*** FrameWork.py 13 Dec 2001 12:57:11 -0000 1.47
--- FrameWork.py 24 Feb 2002 22:46:28 -0000 1.47.6.1
***************
*** 28,31 ****
--- 28,36 ----
import EasyDialogs
+ try:
+ MyFrontWindow = FrontNonFloatingWindow
+ except NameError:
+ MyFrontWindow = FrontWindow
+
kHighLevelEvent = 23 # Don't know what header file this should come from
SCROLLBARWIDTH = 16 # Again, not a clue...
***************
*** 154,158 ****
def mainloop(self, mask = everyEvent, wait = None):
self.quitting = 0
! saveparams = apply(MacOS.SchedParams, self.schedparams)
try:
while not self.quitting:
--- 159,164 ----
def mainloop(self, mask = everyEvent, wait = None):
self.quitting = 0
! if hasattr(MacOS, 'SchedParams'):
! saveparams = apply(MacOS.SchedParams, self.schedparams)
try:
while not self.quitting:
***************
*** 165,169 ****
break
finally:
! apply(MacOS.SchedParams, saveparams)
def dopendingevents(self, mask = everyEvent):
--- 171,176 ----
break
finally:
! if hasattr(MacOS, 'SchedParams'):
! apply(MacOS.SchedParams, saveparams)
def dopendingevents(self, mask = everyEvent):
***************
*** 215,218 ****
--- 222,227 ----
def asyncevents(self, onoff):
"""asyncevents - Set asynchronous event handling on or off"""
+ if MacOS.runtimemodel == 'macho':
+ raise 'Unsupported in MachoPython'
old = self._doing_asyncevents
if old:
***************
*** 258,262 ****
# Not menubar or something, so assume someone
# else's window
! MacOS.HandleEvent(event)
return
elif self._windows.has_key(wid):
--- 267,272 ----
# Not menubar or something, so assume someone
# else's window
! if hasattr(MacOS, 'HandleEvent'):
! MacOS.HandleEvent(event)
return
elif self._windows.has_key(wid):
***************
*** 273,284 ****
def do_inSysWindow(self, partcode, window, event):
! MacOS.HandleEvent(event)
def do_inDesk(self, partcode, window, event):
! MacOS.HandleEvent(event)
def do_inMenuBar(self, partcode, window, event):
if not self.menubar:
! MacOS.HandleEvent(event)
return
(what, message, when, where, modifiers) = event
--- 283,297 ----
def do_inSysWindow(self, partcode, window, event):
! if hasattr(MacOS, 'HandleEvent'):
! MacOS.HandleEvent(event)
def do_inDesk(self, partcode, window, event):
! if hasattr(MacOS, 'HandleEvent'):
! MacOS.HandleEvent(event)
def do_inMenuBar(self, partcode, window, event):
if not self.menubar:
! if hasattr(MacOS, 'HandleEvent'):
! MacOS.HandleEvent(event)
return
(what, message, when, where, modifiers) = event
***************
*** 295,299 ****
def do_menu(self, id, item, window, event):
! MacOS.OutputSeen()
self.menubar.dispatch(id, item, window, event)
--- 308,313 ----
def do_menu(self, id, item, window, event):
! if hasattr(MacOS, 'OutputSeen'):
! MacOS.OutputSeen()
self.menubar.dispatch(id, item, window, event)
***************
*** 304,312 ****
if DEBUG: print "\tUnknown part code:", partcode
if DEBUG: print "\tEvent:", self.printevent(event)
! MacOS.HandleEvent(event)
def do_unknownwindow(self, partcode, window, event):
if DEBUG: print 'Unknown window:', window
! MacOS.HandleEvent(event)
def do_keyDown(self, event):
--- 318,328 ----
if DEBUG: print "\tUnknown part code:", partcode
if DEBUG: print "\tEvent:", self.printevent(event)
! if hasattr(MacOS, 'HandleEvent'):
! MacOS.HandleEvent(event)
def do_unknownwindow(self, partcode, window, event):
if DEBUG: print 'Unknown window:', window
! if hasattr(MacOS, 'HandleEvent'):
! MacOS.HandleEvent(event)
def do_keyDown(self, event):
***************
*** 333,341 ****
else:
if not self.menubar:
! MacOS.HandleEvent(event)
return
else:
# See whether the front window wants it
! w = FrontWindow()
if w and self._windows.has_key(w):
window = self._windows[w]
--- 349,358 ----
else:
if not self.menubar:
! if hasattr(MacOS, 'HandleEvent'):
! MacOS.HandleEvent(event)
return
else:
# See whether the front window wants it
! w = MyFrontWindow()
if w and self._windows.has_key(w):
window = self._windows[w]
***************
*** 357,361 ****
window.do_rawupdate(wid, event)
else:
! MacOS.HandleEvent(event)
def do_activateEvt(self, event):
--- 374,379 ----
window.do_rawupdate(wid, event)
else:
! if hasattr(MacOS, 'HandleEvent'):
! MacOS.HandleEvent(event)
def do_activateEvt(self, event):
***************
*** 366,370 ****
window.do_activate(modifiers & 1, event)
else:
! MacOS.HandleEvent(event)
def do_osEvt(self, event):
--- 384,389 ----
window.do_activate(modifiers & 1, event)
else:
! if hasattr(MacOS, 'HandleEvent'):
! MacOS.HandleEvent(event)
def do_osEvt(self, event):
***************
*** 380,384 ****
def do_suspendresume(self, event):
(what, message, when, where, modifiers) = event
! wid = FrontWindow()
if wid and self._windows.has_key(wid):
window = self._windows[wid]
--- 399,403 ----
def do_suspendresume(self, event):
(what, message, when, where, modifiers) = event
! wid = MyFrontWindow()
if wid and self._windows.has_key(wid):
window = self._windows[wid]
***************
*** 484,488 ****
label, shortcut, callback, kind = menu.items[i]
if type(callback) == types.StringType:
! wid = Win.FrontWindow()
if wid and self.parent._windows.has_key(wid):
window = self.parent._windows[wid]
--- 503,507 ----
label, shortcut, callback, kind = menu.items[i]
if type(callback) == types.StringType:
! wid = MyFrontWindow()
if wid and self.parent._windows.has_key(wid):
window = self.parent._windows[wid]
***************
*** 576,580 ****
else:
# callback is string
! wid = Win.FrontWindow()
if wid and self.bar.parent._windows.has_key(wid):
window = self.bar.parent._windows[wid]
--- 595,599 ----
else:
# callback is string
! wid = MyFrontWindow()
if wid and self.bar.parent._windows.has_key(wid):
window = self.bar.parent._windows[wid]
***************
*** 621,625 ****
item = reply & 0xffff
if not window:
! wid = Win.FrontWindow()
try:
window = self.bar.parent._windows[wid]
--- 640,644 ----
item = reply & 0xffff
if not window:
! wid = MyFrontWindow()
try:
window = self.bar.parent._windows[wid]
***************
*** 784,788 ****
# the activate event.
#
! if FrontWindow() <> window:
window.SelectWindow()
return
--- 803,807 ----
# the activate event.
#
! if MyFrontWindow() <> window:
window.SelectWindow()
return
***************
*** 833,837 ****
def do_inContent(self, partcode, window, event):
! if FrontWindow() <> window:
window.SelectWindow()
return
--- 852,856 ----
def do_inContent(self, partcode, window, event):
! if MyFrontWindow() <> window:
window.SelectWindow()
return