Output various aspects of topic tree to string or file.
copyright: | Copyright since 2006 by Oliver Schoenborn, all rights reserved. |
---|---|
license: | BSD, see LICENSE_BSD_Simple.txt for details. |
TopicTreePrinter |
Example topic tree visitor that prints a prettified representation |
printTreeDocs
(rootTopic=None, topicMgr=None, **kwargs)¶Print out the topic tree to a file (or file-like object like a StringIO), starting at rootTopic. If root topic should be root of whole tree, get it from pub.getDefaultTopicTreeRoot(). The treeVisitor is an instance of pub.TopicTreeTraverser.
Printing the tree docs would normally involve this:
from pubsub import pub
from pubsub.utils.topictreeprinter import TopicTreePrinter
traverser = pub.TopicTreeTraverser( TopicTreePrinter(**kwargs) )
traverser.traverse( pub.getDefaultTopicTreeRoot() )
With printTreeDocs, it looks like this:
from pubsub import pub
from pubsub.utils import printTreeDocs
printTreeDocs()
The kwargs are the same as for TopicTreePrinter constructor: extra(None), width(70), indentStep(4), bulletTopic, bulletTopicItem, bulletTopicArg, fileObj(stdout). If fileObj not given, stdout is used.