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.
This commit is contained in:
Jack Jansen 2002-01-21 23:01:24 +00:00
parent 815d2bf067
commit a4adacbd7e
1 changed files with 26 additions and 12 deletions

View File

@ -153,7 +153,8 @@ class Application:
def mainloop(self, mask = everyEvent, wait = None):
self.quitting = 0
saveparams = apply(MacOS.SchedParams, self.schedparams)
if hasattr(MacOS, 'SchedParams'):
saveparams = apply(MacOS.SchedParams, self.schedparams)
try:
while not self.quitting:
try:
@ -164,7 +165,8 @@ class Application:
# applications.
break
finally:
apply(MacOS.SchedParams, saveparams)
if hasattr(MacOS, 'SchedParams'):
apply(MacOS.SchedParams, saveparams)
def dopendingevents(self, mask = everyEvent):
"""dopendingevents - Handle all pending events"""
@ -214,6 +216,8 @@ class Application:
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:
MacOS.SetEventHandler()
@ -257,7 +261,8 @@ class Application:
except AttributeError:
# Not menubar or something, so assume someone
# else's window
MacOS.HandleEvent(event)
if hasattr(MacOS, 'HandleEvent'):
MacOS.HandleEvent(event)
return
elif self._windows.has_key(wid):
# It is a window. Hand off to correct window.
@ -272,14 +277,17 @@ class Application:
handler(partcode, wid, event)
def do_inSysWindow(self, partcode, window, event):
MacOS.HandleEvent(event)
if hasattr(MacOS, 'HandleEvent'):
MacOS.HandleEvent(event)
def do_inDesk(self, partcode, window, event):
MacOS.HandleEvent(event)
if hasattr(MacOS, 'HandleEvent'):
MacOS.HandleEvent(event)
def do_inMenuBar(self, partcode, window, event):
if not self.menubar:
MacOS.HandleEvent(event)
if hasattr(MacOS, 'HandleEvent'):
MacOS.HandleEvent(event)
return
(what, message, when, where, modifiers) = event
result = MenuSelect(where)
@ -294,7 +302,8 @@ class Application:
HiliteMenu(0)
def do_menu(self, id, item, window, event):
MacOS.OutputSeen()
if hasattr(MacOS, 'OutputSeen'):
MacOS.OutputSeen()
self.menubar.dispatch(id, item, window, event)
@ -303,11 +312,13 @@ class Application:
if DEBUG: print "Mouse down at global:", where
if DEBUG: print "\tUnknown part code:", partcode
if DEBUG: print "\tEvent:", self.printevent(event)
MacOS.HandleEvent(event)
if hasattr(MacOS, 'HandleEvent'):
MacOS.HandleEvent(event)
def do_unknownwindow(self, partcode, window, event):
if DEBUG: print 'Unknown window:', window
MacOS.HandleEvent(event)
if hasattr(MacOS, 'HandleEvent'):
MacOS.HandleEvent(event)
def do_keyDown(self, event):
self.do_key(event)
@ -332,7 +343,8 @@ class Application:
raise self
else:
if not self.menubar:
MacOS.HandleEvent(event)
if hasattr(MacOS, 'HandleEvent'):
MacOS.HandleEvent(event)
return
else:
# See whether the front window wants it
@ -356,7 +368,8 @@ class Application:
window = self._windows[wid]
window.do_rawupdate(wid, event)
else:
MacOS.HandleEvent(event)
if hasattr(MacOS, 'HandleEvent'):
MacOS.HandleEvent(event)
def do_activateEvt(self, event):
(what, message, when, where, modifiers) = event
@ -365,7 +378,8 @@ class Application:
window = self._windows[wid]
window.do_activate(modifiers & 1, event)
else:
MacOS.HandleEvent(event)
if hasattr(MacOS, 'HandleEvent'):
MacOS.HandleEvent(event)
def do_osEvt(self, event):
(what, message, when, where, modifiers) = event