How to use the envisage.api.ExtensionPoint function in envisage

To help you get started, we’ve selected a few envisage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enthought / envisage / envisage / ui / tasks / tasks_application.py View on Github external
# The splash screen for the application. By default, there is no splash
    # screen.
    splash_screen = Instance("pyface.splash_screen.SplashScreen")

    # The directory on the local file system used to persist window layout
    # information.
    state_location = Directory

    # The filename that the application uses to persist window layout
    # information.
    state_filename = Str(DEFAULT_STATE_FILENAME)

    # Contributed task factories. This attribute is primarily for run-time
    # inspection; to instantiate a task, use the 'create_task' method.
    task_factories = ExtensionPoint(id=TASK_FACTORIES)

    # Contributed task extensions.
    task_extensions = ExtensionPoint(id=TASK_EXTENSIONS)

    # The list of task windows created by the application.
    windows = List(Instance("envisage.ui.tasks.task_window.TaskWindow"))

    # The factory for creating task windows.
    window_factory = Callable

    #### Application layout ###################################################

    # The default layout for the application. If not specified, a single window
    # will be created with the first available task factory.
    default_layout = List(
        Instance("pyface.tasks.task_window_layout.TaskWindowLayout")
github enthought / envisage / envisage / ui / single_project / project_plugin.py View on Github external
id=FACTORY_DEFINITIONS,
        desc="""

        A project factory definition.

        An instance of the specified class is used to open and/or create new
        projects.

        The extension with the highest priority wins!  In the event of a tie,
        the first instance wins.

        """,
    )

    # Ui service factories.
    ui_service_factory = ExtensionPoint(
        List(Callable),
        id=UI_SERVICE_FACTORY,
        desc="""

        A ui service factory definition.

        """,
    )

    #### Contributions to extension points made by this plugin ################

    # Action sets.
    action_sets = List(contributes_to=ACTION_SETS)

    def _action_sets_default(self):
        """
github enthought / envisage / envisage / ui / workbench / workbench_plugin.py View on Github external
A perspective is simply an arrangment of views around the (optionally
        hidden) editor area.

        Each contribution to this extension point must be a factory that
        creates a perspective, where 'factory' means any callable with the
        following signature::

          callable(**traits) -> IPerspective

        The easiest way to contribute such a factory is to create a class
        that derives from 'pyface.workbench.api.IPerspective'.

        """,
    )

    preferences_pages = ExtensionPoint(
        List(Callable),
        id=PREFERENCES_PAGES,
        desc="""

        A preferences page appears in the preferences dialog to allow the user
        to manipulate some preference values.

        Each contribution to this extension point must be a factory that
        creates a preferences page, where 'factory' means any callable with the
        following signature::

          callable(**traits) -> IPreferencesPage

        The easiest way to contribute such a factory is to create a class
        that derives from 'apptools.preferences.ui.api.IPreferencesPage'.
github enthought / envisage / envisage / plugins / ipython_shell / view / ipython_shell_view.py View on Github external
def _interpreter_default(self):
        # Create an interpreter that has a reference to our namespace.
        return Interpreter(user_ns=self.namespace)

    #### 'IExtensionPointUser' interface ######################################

    # The extension registry that the object's extension points are stored in.
    extension_registry = Property(Instance(IExtensionRegistry))

    #### Private interface ####################################################

    # Banner.
    _banner = ExtensionPoint(id='envisage.plugins.ipython_shell.banner')

    # Bindings.
    _bindings = ExtensionPoint(id='envisage.plugins.python_shell.bindings')

    # Commands.
    _commands = ExtensionPoint(id='envisage.plugins.python_shell.commands')

    ###########################################################################
    # 'IExtensionPointUser' interface.
    ###########################################################################

    def _get_extension_registry(self):
        """ Trait property getter. """

        return self.window.application

    ###########################################################################
    # 'View' interface.
    ###########################################################################
github enthought / envisage / envisage / plugins / ipython_kernel / ipython_kernel_plugin.py View on Github external
"envisage.plugins.ipython_kernel.internal_ipkernel.InternalIPKernel")

logger = logging.getLogger(__name__)


class IPythonKernelPlugin(Plugin):
    """ An IPython kernel plugin. """

    #: The plugin unique identifier.
    id = "envisage.plugins.ipython_kernel"

    #: The plugin name (suitable for displaying to the user).
    name = "IPython embedded kernel plugin"

    #: Extension point for objects contributed to the IPython kernel namespace.
    kernel_namespace = ExtensionPoint(
        List,
        id=IPYTHON_NAMESPACE,
        desc="""

        Variables to add to the IPython kernel namespace.
        This is a list of tuples (name, value).

        """,
    )

    #: Service offers contributed by this plugin.
    service_offers = List(contributes_to=SERVICE_OFFERS)

    #: Whether to initialize the kernel when the service is created.
    #: The default is ``False```, for backwards compatibility. It will change
    #: to ``True`` in a future version of Envisage. External users wanting
github enthought / envisage / envisage / ui / workbench / workbench_plugin.py View on Github external
A preferences page appears in the preferences dialog to allow the user
        to manipulate some preference values.

        Each contribution to this extension point must be a factory that
        creates a preferences page, where 'factory' means any callable with the
        following signature::

          callable(**traits) -> IPreferencesPage

        The easiest way to contribute such a factory is to create a class
        that derives from 'apptools.preferences.ui.api.IPreferencesPage'.

        """,
    )

    service_offers = ExtensionPoint(
        List(ServiceOffer),
        id=WORKBENCH_SERVICE_OFFERS,
        desc="""

        Services are simply objects that a plugin wants to make available to
        other plugins. This extension point allows you to offer 'per
        window' services that are created 'on-demand' (where 'on demand' means
        the first time somebody looks up a service of the appropriate
        protocol).
        .

        e.g.

        my_service_offer = ServiceOffer(
            protocol   = 'acme.IMyService',
            factory    = an_object_or_a_callable_that_creates_one,
github enthought / envisage / envisage / ui / workbench / workbench_plugin.py View on Github external
# The Ids of the extension points that this plugin contributes to.
    PREFERENCES = "envisage.preferences"
    SERVICE_OFFERS = "envisage.service_offers"

    #### 'IPlugin' interface ##################################################

    # The plugin's unique identifier.
    id = "envisage.ui.workbench"

    # The plugin's name (suitable for displaying to the user).
    name = "Workbench"

    #### Extension points offered by this plugin ##############################

    action_sets = ExtensionPoint(
        List(Callable),
        id=ACTION_SETS,
        desc="""

        An action set contains the toobars, menus, groups and actions that you
        would like to add to top-level workbench windows (i.e. the main
        application window). You can create new toolbars, menus and groups
        and/or add to existing ones.

        Each contribution to this extension point must be a factory that
        creates an action set, where 'factory' means any callable with the
        following signature::

          callable(**traits) -> IActionSet

        The easiest way to contribute such a factory is to create a class
github bpteague / cytoflow / cytoflowgui / flow_task.py View on Github external
class FlowTaskPlugin(Plugin):
    """
    An Envisage plugin wrapping FlowTask
    """

    # Extension point IDs.
    PREFERENCES       = 'envisage.preferences'
    PREFERENCES_PANES = 'envisage.ui.tasks.preferences_panes'
    TASKS             = 'envisage.ui.tasks.tasks'
    
    # these need to be declared in a Plugin instance; we pass them to
    # the task instance thru its factory, below.
    op_plugins = ExtensionPoint(List(IOperationPlugin), OP_PLUGIN_EXT)
    view_plugins = ExtensionPoint(List(IViewPlugin), VIEW_PLUGIN_EXT)    

    #### 'IPlugin' interface ##################################################

    # The plugin's unique identifier.
    id = 'edu.mit.synbio.cytoflow'

    # The plugin's name (suitable for displaying to the user).
    name = 'Cytoflow'

    ###########################################################################
    # Protected interface.
    ###########################################################################

    @contributes_to(PREFERENCES)
    def _get_preferences(self):
        filename = os.path.join(os.path.dirname(__file__), 'preferences.ini')
github enthought / envisage / envisage / core_plugin.py View on Github external
# Extension point Ids.
    CLASS_LOAD_HOOKS = "envisage.class_load_hooks"
    PREFERENCES = "envisage.preferences"
    SERVICE_OFFERS = "envisage.service_offers"

    #### 'IPlugin' interface ##################################################

    # The plugin's unique identifier.
    id = "envisage.core"

    # The plugin's name (suitable for displaying to the user).
    name = "Core"

    #### Extension points offered by this plugin ##############################

    class_load_hooks = ExtensionPoint(
        List(Instance("envisage.class_load_hook.ClassLoadHook")),
        id=CLASS_LOAD_HOOKS,
        desc="""

        Class load hooks allow you to be notified when any 'HasTraits' class
        is imported or created.

        See the documentation for 'ClassLoadHook' for more details.

        """,
    )

    @on_trait_change("class_load_hooks_items")
    def _class_load_hooks_changed(self, event):
        """ React to new class load hooks being *added*.
github bpteague / cytoflow / cytoflowgui / flow_task.py View on Github external
class FlowTaskPlugin(Plugin):
    """
    An Envisage plugin wrapping FlowTask
    """

    # Extension point IDs.
    PREFERENCES       = 'envisage.preferences'
    PREFERENCES_PANES = 'envisage.ui.tasks.preferences_panes'
    TASKS             = 'envisage.ui.tasks.tasks'
    
    # these need to be declared in a Plugin instance; we pass them to
    # the task instance thru its factory, below.
    op_plugins = ExtensionPoint(List(IOperationPlugin), OP_PLUGIN_EXT)
    view_plugins = ExtensionPoint(List(IViewPlugin), VIEW_PLUGIN_EXT)
    
    debug = Bool(False)
    remote_connection = Any

    #### 'IPlugin' interface ##################################################

    # The plugin's unique identifier.
    id = 'edu.mit.synbio.cytoflow'

    # The plugin's name (suitable for displaying to the user).
    name = 'Cytoflow'

    ###########################################################################
    # Protected interface.
    ###########################################################################