author | andy_robinson |
Tue, 18 Mar 2003 00:01:09 +0000 | |
changeset 1862 | 11f6cd4b0f07 |
parent 1859 | 89c74d68f1f5 |
child 1905 | c4888fcec7b6 |
permissions | -rw-r--r-- |
1859
89c74d68f1f5
Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff
changeset
|
1 |
# runs all the GUIedit charts in this directory - |
89c74d68f1f5
Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff
changeset
|
2 |
# makes a PDF sample for eaxh existing chart type |
1862 | 3 |
import sys |
4 |
import glob |
|
5 |
import string |
|
6 |
import inspect |
|
7 |
import types |
|
8 |
||
9 |
def moduleClasses(mod): |
|
10 |
def P(obj, m=mod.__name__, CT=types.ClassType): |
|
11 |
return (type(obj)==CT and obj.__module__==m) |
|
12 |
try: |
|
13 |
return inspect.getmembers(mod, P)[0][1] |
|
14 |
except: |
|
15 |
return None |
|
16 |
||
17 |
def getclass(f): |
|
18 |
return moduleClasses(__import__(f)) |
|
19 |
||
20 |
def run(format): |
|
21 |
allfiles = glob.glob('*.py') |
|
22 |
allfiles.sort() |
|
23 |
for fn in allfiles: |
|
24 |
f = string.split(fn, '.')[0] |
|
25 |
c = getclass(f) |
|
26 |
if c != None: |
|
27 |
print c.__name__ |
|
28 |
try: |
|
29 |
c().save(formats=[format],outDir='.',fnRoot=c.__name__) |
|
30 |
except: |
|
31 |
print " COULDN'T CREATE '%s.%s'!" % (c.__name__, format) |
|
1859
89c74d68f1f5
Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff
changeset
|
32 |
|
89c74d68f1f5
Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff
changeset
|
33 |
if __name__ == "__main__": |
1862 | 34 |
if len(sys.argv) < 2: |
35 |
print 'usage: runall.py FORMAT' |
|
36 |
print ' (where format one of pdf,gif,eps,png etc.)' |
|
37 |
else: |
|
38 |
run(sys.argv[1]) |