Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 789a4dca4953f037223e830336ef4af3 > files > 686

python-enthought-enable-3.2.0-2mdv2010.0.i586.rpm

""" A shape container. """


# Enthought library imports.
from enthought.enable.api import Container


class ShapeContainer(Container):
    """ The base class for moveable shapes. """
        
    ###########################################################################
    # 'ShapeContainer' interface
    ###########################################################################

    def bring_to_top(self, component):
        """ Bring a component to the top of the z-order.

        fixme: This seems like a horrible hack - is there a nice enable-y way?

        """

        components = self._components
        
        # Make sure that the component is the last in the list (if it is the
        # *only* one in the list then do nothing).
        if len(components) > 1:
            if components[-1] is not component:
                # After the append the list will contain two references to the 
                # component, one at its original location and one at the end...
                components.append(component)

                # ... and this removes the first one!
                components.remove(component)

        return
    
#### EOF ######################################################################