topictreevisitor.py :  » GUI » wxPython » wxPython-src-2.8.11.0 » wxPython » wx » lib » pubsub » utils » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » GUI » wxPython 
wxPython » wxPython src 2.8.11.0 » wxPython » wx » lib » pubsub » utils » topictreevisitor.py
'''

:copyright: Copyright 2006-2009 by Oliver Schoenborn, all rights reserved.
:license: BSD, see LICENSE.txt for details.

'''


class ITopicTreeVisitor:
    '''
    Topic tree traverser. Provides the traverse() method
    which traverses a topic tree and calls self._onTopic() for
    each topic in the tree that satisfies self._accept().
    Additionally it calls self._startChildren() whenever it
    starts traversing the subtopics of a topic, and
    self._endChildren() when it is done with the subtopics.
    Finally, it calls self._doneTraversal() when traversal
    has been completed.

    Derive from ITopicTreeVisitoroverrideonemoreofthe import 
    four self._*() methods described above. Give an instance to
    an instance of pub.TopicTreeTraverser, whose traverse()
    method will cause the tree to be printed.
    '''

    def _accept(self, topicObj):
        '''Override this to filter nodes of topic tree. Must return
        True (accept node) of False (reject node). Note that rejected
        nodes cause traversal to move to next branch (no children
        traversed).'''
        return True

    def _startTraversal(self):
        '''Override this to define what to do when traversal() starts.'''
        pass

    def _onTopic(self, topicObj):
        '''Override this to define what to do for each node.'''
        pass

    def _startChildren(self):
        '''Override this to take special action whenever a
        new level of the topic hierarchy is started (e.g., indent
        some output). '''
        pass

    def _endChildren(self):
        '''Override this to take special action whenever a
        level of the topic hierarchy is completed (e.g., dedent
        some output). '''
        pass

    def _doneTraversal(self):
        '''Override this to take special action when traversal done.'''
        pass

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.