Пример #1

import os, types, re, inspect

from svgfig.svg import SVG as XML
from svgfig.svg import load

import svgfig, svgfig.interactive
for module in svgfig.__all__: exec("import svgfig.%s" % module)

docs = []
for f in os.listdir("source"):
    if f[0] != "." and f[-4:] == ".xml":
        docs.extend(load("source/%s" % f).children)

def order(a, b, model):
    ai, bi = None, None
        ai = model.index(a.name)
    except ValueError: pass
        bi = model.index(b.name)
    except ValueError: pass

    if ai is None and bi is None:
        return cmp((a.module, a.name), (b.module, b.name))
    elif ai is not None and bi is None:
        return -1
    elif ai is None and bi is not None:
        return 1