diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-08-03 14:10:27 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-08-03 14:10:27 (GMT) |
commit | 7f9a63ca4cb559428c8d6faf0993cfd57cc35032 (patch) | |
tree | dcffaf1f4d0e63110507c21382d1915cd9a84121 /Mac/Lib/test | |
parent | 5150edd9797b506f1cd6f88efb1c2a9e21e22b78 (diff) | |
download | cpython-7f9a63ca4cb559428c8d6faf0993cfd57cc35032.zip cpython-7f9a63ca4cb559428c8d6faf0993cfd57cc35032.tar.gz cpython-7f9a63ca4cb559428c8d6faf0993cfd57cc35032.tar.bz2 |
These stopped working a long time ago, and they're not worth fixing.
Diffstat (limited to 'Mac/Lib/test')
-rw-r--r-- | Mac/Lib/test/tae.py | 112 | ||||
-rw-r--r-- | Mac/Lib/test/tctl.py | 20 |
2 files changed, 0 insertions, 132 deletions
diff --git a/Mac/Lib/test/tae.py b/Mac/Lib/test/tae.py deleted file mode 100644 index 4789672..0000000 --- a/Mac/Lib/test/tae.py +++ /dev/null @@ -1,112 +0,0 @@ -# The oldest AppleEvent test program. -# Its function has been overtaken by echo.py and tell.py. - -import AE -from AppleEvents import * -import Evt -from Events import * -import struct -import aetools -import macfs -import sys -import MacOS - -MacOS.SchedParams(1, 0) - -def aehandler(request, reply): - tosend = [] - print 'request:', aetools.unpackevent(request) - param = request.AEGetParamDesc(keyDirectObject, typeWildCard) - if param.type == typeAEList: - n = param.AECountItems() - print 'List has', n, 'items' - for i in range(1, 1+n): - type, item = param.AEGetNthDesc(i, typeFSS) - data = item.data - print 'item', i, ':', type, item.type, len(data), 'bytes' - vol, dir, fnlen = struct.unpack('hlb', data[:7]) - filename = data[7:7+fnlen] - print 'vol:', vol, '; dir:', dir, '; filename:', `filename` - print 'full path:', macfs.FSSpec((vol,dir,filename)).as_pathname() - tosend.append(item) - else: - pass - print 'param:', (param.type, param.data[:20]), param.data[20:] and '...' - if tosend: - passtothink(tosend) - - -def passtothink(list): - target = AE.AECreateDesc(typeApplSignature, 'KAHL') - event = AE.AECreateAppleEvent(kCoreEventClass, - kAEOpenDocuments, - target, - kAutoGenerateReturnID, - kAnyTransactionID) - aetools.packevent(event, {keyDirectObject: list}) - reply = event.AESend(kAENoReply | kAEAlwaysInteract | kAECanSwitchLayer, - kAENormalPriority, - kAEDefaultTimeout) - #print "Reply:", aetools.unpackevent(reply) - return - event = AE.AECreateAppleEvent(kCoreEventClass, - kAEOpenApplication, - target, - kAutoGenerateReturnID, - kAnyTransactionID) - reply = event.AESend(kAENoReply | kAEAlwaysInteract | kAECanSwitchLayer, - kAENormalPriority, - kAEDefaultTimeout) - -def unihandler(req, rep): - print 'unihandler' - aehandler(req, rep) - -quit = 0 -def quithandler(req, rep): - global quit - quit = 1 - -def corehandler(req, rep): - print 'core event!' - parameters, attributes = aetools.unpackevent(req) - print "event class =", attributes['evcl'] - print "event id =", attributes['evid'] - print 'parameters:', parameters - # echo the arguments, to see how Script Editor formats them - aetools.packevent(rep, parameters) - -def wildhandler(req, rep): - print 'wildcard event!' - parameters, attributes = aetools.unpackevent(req) - print "event class =", attributes['evcl'] - print "event id =", attributes['evid'] - print 'parameters:', parameters - -AE.AEInstallEventHandler(typeAppleEvent, kAEOpenApplication, aehandler) -AE.AEInstallEventHandler(typeAppleEvent, kAEOpenDocuments, aehandler) -AE.AEInstallEventHandler(typeAppleEvent, kAEPrintDocuments, aehandler) -AE.AEInstallEventHandler(typeAppleEvent, kAEQuitApplication, quithandler) -AE.AEInstallEventHandler(typeAppleEvent, typeWildCard, unihandler) -AE.AEInstallEventHandler('core', typeWildCard, corehandler) -#AE.AEInstallEventHandler(typeWildCard, typeWildCard, wildhandler) - - -def main(): - global quit - quit = 0 - while not quit: - ok, e = Evt.WaitNextEvent(-1, 60) - if ok: - print 'Event:', e - if e[0] == 23: # kHighLevelEvent - AE.AEProcessAppleEvent(e) - elif e[0] == keyDown and chr(e[1]&0xff) == '.' and e[4]&cmdKey: - raise KeyboardInterrupt, "Command-Period" - else: - MacOS.HandleEvent(e) - -if __name__ == '__main__': - main() - -print "This module is obsolete -- use echo.py or tell.py ..." diff --git a/Mac/Lib/test/tctl.py b/Mac/Lib/test/tctl.py deleted file mode 100644 index a255c56..0000000 --- a/Mac/Lib/test/tctl.py +++ /dev/null @@ -1,20 +0,0 @@ -# play with controls - -from Dlg import * -from Ctl import * -from Win import * -from Evt import * -import time -import sys - -def main(): - r = (40, 40, 400, 300) - w = NewWindow(r, "The Spanish Inquisition", 1, 0, -1, 1, 0x55555555) - w.DrawGrowIcon() - r = (40, 40, 100, 60) - c = NewControl(w, r, "SPAM!", 1, 0, 0, 1, 0, 0) - print 'Ok, try it...' - sys.exit(1) # So we can see what happens... - - -main() |