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