reportlab/graphics/samples/runall.py
author johnprecedo
Mon, 17 Mar 2003 12:55:12 +0000
changeset 1859 89c74d68f1f5
child 1862 11f6cd4b0f07
permissions -rw-r--r--
Directory of samples which mimic the standard Excel chart classes. iInitial checkin - copied across from users/john/excel_samples.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
     3
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
     4
if __name__ == "__main__":
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
     5
    def run():
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
     6
        import glob, string
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
     7
        def moduleClasses(mod):
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
     8
            import inspect, types
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
     9
            def P(obj, m=mod.__name__, CT=types.ClassType):
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    10
                return (type(obj)==CT and obj.__module__==m)
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    11
            try:
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    12
                return inspect.getmembers(mod, P)[0][1]
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    13
            except:
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    14
                return None
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    15
        def getclass(f):
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    16
            return moduleClasses(__import__(f))
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    17
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    18
        allfiles = glob.glob('*.py')
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    19
        allfiles.sort()
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    20
        for fn in allfiles:
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    21
            f = string.split(fn, '.')[0]
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    22
            c = getclass(f)
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    23
            if c != None:
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    24
                print c.__name__
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    25
                try:
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    26
                    c().save(formats=['pdf'],outDir='.',fnRoot=c.__name__)
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    27
                except:
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    28
                    print " COULDN'T CREATE '%s.pdf'!" % c.__name__
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    29
89c74d68f1f5 Directory of samples which mimic the standard Excel chart classes.
johnprecedo
parents:
diff changeset
    30
    run()