Teach Windows build and installer about new _symtable module/DLL.
[python/dscho.git] / Mac / Contrib / morefindertools / morefindertoolstest.py
blob179d25e3d5fe3c83c025f5a11d3a642316307397
1 """Some tests of various morefindertools functions.
2 This does not test the functions that are already defined and tested in findertools.
3 10 10 2000 erik@letterror.com
4 """
6 import morefindertools
7 import os.path
8 import MacOS
9 import random
11 mft = morefindertools
13 print '\nmorefindertools version %s\nTests coming upÅ ' %mft.__version__
15 # miscellaneous
16 print '\tfilesharing on?', mft.filesharing() # is file sharing on, off, starting up?
17 print '\tOS version', mft.OSversion() # the version of the system software
19 # set the soundvolume in a simple way
20 print '\tSystem beep volume'
21 for i in range(0, 7):
22 mft.volumelevel(i)
23 MacOS.SysBeep()
25 # Finder's windows, file location, file attributes
26 f = __file__ # get a path name that is innocent to play with and always works
27 mft.reveal(f) # reveal this file in a Finder window
28 mft.select(f) # select this file
30 base, file = os.path.split(f)
31 mft.closewindow(base) # close the window this file is in (opened by reveal)
32 mft.openwindow(base) # open it again
33 mft.windowview(base, 1) # set the view by list
35 mft.label(f, 2) # set the label of this file to something orange
36 print '\tlabel', mft.label(f) # get the label of this file
38 # the file location only works in a window with icon view!
39 print 'Random locations for an icon'
40 mft.windowview(base, 0) # set the view by icon
41 mft.windowsize(base, (600, 600))
42 for i in range(50):
43 mft.location(f, (random.randint(10, 590), random.randint(10, 590)))
45 mft.windowsize(base, (200, 400))
46 mft.windowview(base, 1) # set the view by icon
48 orgpos = mft.windowposition(base)
49 print 'Animated window location'
50 for i in range(10):
51 pos = (100+i*10, 100+i*10)
52 mft.windowposition(base, pos)
53 print '\twindow position', pos
54 mft.windowposition(base, orgpos) # park it where it was beforeÅ 
56 print 'Put a comment in file', f, ':'
57 print '\t', mft.comment(f) # print the Finder comment this file has
58 s = 'This is a comment no one reads!'
59 mft.comment(f, s) # set the Finder comment
63 # the following code does not work on MacOS versions older than MacOS 9.
67 if 0:
68 print 'MacOS9 or better specific functions'
69 # processes
70 pr = mft.processes() # return a list of tuples with (active_processname, creatorcode)
71 print 'Return a list of current active processes:'
72 for p in pr:
73 print '\t', p
75 # get attributes of the first process in the list
76 print 'Attributes of the first process in the list:'
77 pinfo = mft.processinfo(pr[0][0])
78 print '\t', pr[0][0]
79 print '\t\tmemory partition', pinfo.partition # the memory allocated to this process
80 print '\t\tmemory used', pinfo.used # the memory actuall used by this process
81 print '\t\tis visible', pinfo.visible # is the process visible to the user
82 print '\t\tis frontmost', pinfo.frontmost # is the process the front most one?
83 print '\t\thas scripting', pinfo.hasscripting # is the process scriptable?
84 print '\t\taccepts high level events', pinfo.accepthighlevel # does the process accept high level appleevents?
85 print 'Done.'