Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > contrib-backports > by-pkgid > 5a28ce08f20e322d24ac159a4334c346 > files > 2390

python-enthought-mayavi2-2.2.0-1mdv2008.1.x86_64.rpm

""" An example perspective. """


# Enthought library imports.
from enthought.envisage.workbench.api import Perspective


class BazPerspective(Perspective):
    """ An example perspective.

    This example shows that you can get full control of the layout of the
    perspective by creating a sub-class and overriding the 'create' method.

    """

    ###########################################################################
    # 'Perspective' interface.
    ###########################################################################
    
    def create(self, window_layout):
        """ Creates the perspective in the specified window layout.

        Override this method if you want to have complete control over how
        the perspective is created.  For most cases you should just be able
        to set the 'contents' trait to layout the required views.

        """

        # If the perspective has specific contents then we add just those.
        if len(self.contents) > 0:
            self._add_contents(window_layout, self.contents)

        # Otherwise, we add all of the views defined in the application at
        # their default positions realtive to the editor area.
        else:
            self._add_all(window_layout)
        
        return
    
#### EOF ######################################################################