예제 #1
0
파일: utils.py 프로젝트: sproaty/whyteboard
def printTreeDocs(rootTopic=None, **kwargs):
    '''Uses the TopicTreePrinter to print out the topic tree 
    to stdout, starting at rootTopic The kwargs are the same as 
    for TopicTreePrinter constructor. '''
    printer = TopicTreePrinter(**kwargs)
    if rootTopic is None:
        from pubsub import pub
        rootTopic = pub.getDefaultRootTopic()
    assert rootTopic is not None
    printer.traverse(rootTopic)
예제 #2
0
파일: utils.py 프로젝트: sproaty/whyteboard
def printTreeSpec(rootTopic=None, **kwargs):
    '''Prints the topic tree specification starting from rootTopic. 
    If not specified, the whole topic tree is printed. The kwargs are the 
    same as TopicTreeAsSpec's constructor. If no header or footer are given, the 
    defaults are used (see defaultTopicTreeSpecHeader and 
    defaultTopicTreeSpecFooter), such that the resulting output can be 
    imported in your application. E.g.::
    
        pyFile = file('appTopicTree.py','w')
        printTreeSpec( pyFile )
        pyFile.close()
        import appTopicTree
    '''
    kwargs.setdefault('header', defaultTopicTreeSpecHeader)
    kwargs.setdefault('footer', defaultTopicTreeSpecFooter)
    printer = TopicTreeAsSpec(**kwargs)
    if rootTopic is None:
        from pubsub import pub
        rootTopic = pub.getDefaultRootTopic()
    assert rootTopic is not None
    printer.traverse(rootTopic)