Logo Search packages:      
Sourcecode: matplotlib version File versions  Download package

def enthought::traits::ui::view_elements::ViewElements::find (   self,
  name,
  stack = None 
)

Finds a specified ViewElement within the specified (optional) search
    context.

Definition at line 64 of file view_elements.py.

00064                                          :
        """ Finds a specified ViewElement within the specified (optional) search
            context.
        """
        # Assume search starts from the beginning the of the search order:
        i = 0
        
        # If a stack was specified, see if there is a matching entry in the 
        # stack already:
        if stack is not None:
            for ssi in stack:
                if name == ssi.id:
                    # Match found, resume search at next ViewElements object
                    # in the search order:
                    i = ssi.context + 1
                    break
                    
        # Search for a matching name starting at the specified ViewElements
        # object in the search order:
        for j, ves in enumerate( self._get_search_order()[i:] ):
            result = ves.content.get( name )
            if result is not None:
                # Match found. If there is a stack, push matching name and
                # ViewElements context onto it:
                if stack is not None:
                    stack[0:0] = [ SearchStackItem( id      = name, 
                                                    context = i + j ) ]
                    
                # Return the ViewElement object that matched the name:
                return result
                
        # Indicate no match was found:
        return None
        
    #---------------------------------------------------------------------------
    #  Returns a sorted list of all names accessible from the ViewElements 
    #  object that are of a specified (ViewElement) type:
    #---------------------------------------------------------------------------
        
    def filter_by ( self, klass = None ):


Generated by  Doxygen 1.6.0   Back to index