How to use the envisage.api.Plugin 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 LTS5 / connectomeviewer / cviewer / plugins / codeoracle / oracle_plugin.py View on Github external
#
# Modified BSD License

# Enthought library imports
from envisage.api import Plugin
from envisage.api import Service
from traits.api import List

# This module's package.
PKG = '.'.join(__name__.split('.')[:-1])

# Logging imports
import logging
logger = logging.getLogger('root.'+__name__)

class OraclePlugin(Plugin):
    """ This plugin allows to create code """

    ACTION_SETS = 'envisage.ui.workbench.action_sets'
    
    # The plugin's unique identifier.
    id = 'connectome.codeoracle'

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

    # adding the action sets
    action_sets = List(contributes_to=ACTION_SETS)

    def _action_sets_default(self):
        """ Trait initializer. """
        from oracle_action_set import OracleActionSet
github enthought / mayavi / mayavi / plugins / mayavi_plugin.py View on Github external
# Author: Prabhu Ramachandran 
# Copyright (c) 2008,  Enthought, Inc.
# License: BSD Style.

from traits.api import List
from envisage.api import Plugin, ServiceOffer

# This module's package.
PKG = '.'.join(__name__.split('.')[:-1])
# The mayavi package ID.
ID = 'mayavi'

###############################################################################
# `MayaviPlugin` class.
###############################################################################
class MayaviPlugin(Plugin):

    # Extension point Ids.
    SERVICE_OFFERS = 'envisage.ui.workbench.service_offers'
    PREFERENCES       = 'envisage.preferences'

    # The plugins name.
    name = 'Mayavi plugin'

    # Our ID.
    id = ID

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

    # Services we contribute.
    service_offers = List(contributes_to=SERVICE_OFFERS)
github robmcmullen / omnivore / omnivore_framework / file_type / recognizers / __init__.py View on Github external
recognizers = []
from .image import ImageRecognizer
recognizers.append(ImageRecognizer())
from .text import PlainTextRecognizer, PoundBangTextRecognizer, XMLTextRecognizer
recognizers.append(PlainTextRecognizer())
recognizers.append(PoundBangTextRecognizer())
recognizers.append(XMLTextRecognizer())
from .meta import OmnivoreRecognizer
recognizers.append(OmnivoreRecognizer())
# [[[end]]]

from envisage.api import Plugin
from traits.api import List


class BuiltinFileRecognizerPlugin(Plugin):
    """ A plugin that contributes to the omnivore_framework.file_type.recognizer extension point. """

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

    # The plugin's unique identifier.
    id = 'omnivore_framework.file_type.recognizer.builtin'

    # The plugin's name (suitable for displaying to the user).
    name = 'Builtin File Recognizer Plugin'

    # This tells us that the plugin contributes the value of this trait to the
    # 'greetings' extension point.
    recognizer = List(recognizers, contributes_to='omnivore_framework.file_recognizer')


plugins = [BuiltinFileRecognizerPlugin()]
github bpteague / cytoflow / cytoflowgui / op_plugins / autofluorescence.py View on Github external
return False
    
    def get_notebook_code(self, idx):
        view = AutofluorescenceDiagnosticView()
        view.copy_traits(self, view.copyable_trait_names())
        
        return dedent("""
        op_{idx}.default_view({traits}).plot(ex_{prev_idx})
        """
        .format(traits = traits_str(view),
                idx = idx,
                prev_idx = idx - 1))
    

@provides(IOperationPlugin)
class AutofluorescencePlugin(Plugin, PluginHelpMixin):

    id = 'edu.mit.synbio.cytoflowgui.op_plugins.autofluorescence'
    operation_id = 'edu.mit.synbio.cytoflow.operations.autofluorescence'

    short_name = "Autofluorescence correction"
    menu_group = "Calibration"
    
    def get_operation(self):
        return AutofluorescencePluginOp()
    
    def get_icon(self):
        return ImageResource('autofluorescence')
    
    @contributes_to(OP_PLUGIN_EXT)
    def get_plugin(self):
        return self
github robmcmullen / omnivore / omnivore_framework / file_type / plugin.py View on Github external
# Standard library imports.
import os.path

# Enthought library imports.
from envisage.api import ExtensionPoint, Plugin, ServiceOffer
from traits.api import List, Instance

from .i_file_recognizer import IFileRecognizer, IFileRecognizerDriver

import logging
log = logging.getLogger(__name__)


class FileTypePlugin(Plugin):
    """ Plugin for identifying file types
    """

    # The Ids of the extension points that this plugin offers.
    RECOGNIZER = 'omnivore_framework.file_recognizer'

    # Extension point IDs.
    SERVICE_OFFERS    = 'envisage.service_offers'

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

    # The plugin's unique identifier.
    id = 'omnivore_framework.file_type.plugin'

    # The plugin's name (suitable for displaying to the user).
    name = 'File Type'
github bpteague / cytoflow / cytoflowgui / view_plugins / radviz.py View on Github external
for channel in self.channels_list:
            view.channels.append(channel.channel)
            view.scale[channel.channel] = channel.scale
            
        plot_params_str = traits_str(self.plot_params)

        return dedent("""
        {repr}.plot(ex_{idx}{plot}{plot_params})
        """
        .format(repr = repr(view),
                idx = idx,
                plot = ", plot_name = " + repr(self.current_plot) if self.plot_names else "",
                plot_params = ", " + plot_params_str if plot_params_str else ""))

@provides(IViewPlugin)
class RadvizPlugin(Plugin, PluginHelpMixin):

    id = 'edu.mit.synbio.cytoflowgui.view.radviz'
    view_id = 'edu.mit.synbio.cytoflow.view.radviz'
    short_name = "Radviz Plot"

    def get_view(self):
        return RadvizPluginView()
    
    def get_icon(self):
        return ImageResource('radviz')

    @contributes_to(VIEW_PLUGIN_EXT)
    def get_plugin(self):
        return self
        
### Serialization
github bpteague / cytoflow / cytoflowgui / op_plugins / bead_calibration.py View on Github external
return False
    
    def get_notebook_code(self, idx):
        view = BeadCalibrationDiagnostic()
        view.copy_traits(self, view.copyable_trait_names())
        
        return dedent("""
        op_{idx}.default_view({traits}).plot(ex_{prev_idx})
        """
        .format(traits = traits_str(view),
                idx = idx,
                prev_idx = idx - 1))
    

@provides(IOperationPlugin)
class BeadCalibrationPlugin(Plugin, PluginHelpMixin):
    
    id = 'edu.mit.synbio.cytoflowgui.op_plugins.beads_calibrate'
    operation_id = 'edu.mit.synbio.cytoflow.operations.beads_calibrate'

    short_name = "Bead Calibration"
    menu_group = "Calibration"
    
    def get_operation(self):
        return BeadCalibrationPluginOp()
    
    def get_icon(self):
        return ImageResource('bead_calibration')
    
    @contributes_to(OP_PLUGIN_EXT)
    def get_plugin(self):
        return self
github bpteague / cytoflow / cytoflowgui / op_plugins / flowpeaks.py View on Github external
plot_params_str = traits_str(self.density_plot_params)
        else:
            plot_params_str = traits_str(self.scatterplot_plot_params)


        
        return dedent("""
        op_{idx}.default_view({traits}).plot(ex_{idx}{plot_params})
        """
        .format(traits = traits_str(view),
                idx = idx,
                plot_params = ", " + plot_params_str if plot_params_str else ""))
    

@provides(IOperationPlugin)
class FlowPeaksPlugin(Plugin, PluginHelpMixin):
    
    id = 'edu.mit.synbio.cytoflowgui.op_plugins.flowpeaks'
    operation_id = 'edu.mit.synbio.cytoflow.operations.flowpeaks'

    short_name = "Flow Peaks"
    menu_group = "Gates"
    
    def get_operation(self):
        return FlowPeaksPluginOp()
    
    def get_icon(self):
        return ImageResource('flowpeaks')
    
    @contributes_to(OP_PLUGIN_EXT)
    def get_plugin(self):
        return self
github bpteague / cytoflow / cytoflowgui / op_plugins / polygon.py View on Github external
def get_notebook_code(self, idx):
        op = PolygonOp()
        op.copy_traits(self, op.copyable_trait_names())

        return dedent("""
        op_{idx} = {repr}
                
        ex_{idx} = op_{idx}.apply(ex_{prev_idx})
        """
        .format(repr = repr(op),
                idx = idx,
                prev_idx = idx - 1))


@provides(IOperationPlugin)
class PolygonPlugin(Plugin, PluginHelpMixin):
    
    id = 'edu.mit.synbio.cytoflowgui.op_plugins.polygon'
    operation_id = 'edu.mit.synbio.cytoflow.operations.polygon'

    short_name = "Polygon Gate"
    menu_group = "Gates"
    
    def get_operation(self):
        return PolygonPluginOp()
    
    def get_icon(self):
        return ImageResource('polygon')
    
    @contributes_to(OP_PLUGIN_EXT)
    def get_plugin(self):
        return self
github bpteague / cytoflow / cytoflowgui / op_plugins / tasbe.py View on Github external
# Bleedthrough
        op_{idx}_bleedthrough.default_view().plot(ex_{idx}_af)
        
        # Bead calibration
        op_{idx}_beads.default_view().plot(ex_{idx}_bleedthrough)
        
        # Color translation
        op_{idx}_color.default_view().plot(ex_{idx}_beads)
        """
        .format(idx = idx,
                prev_idx = idx - 1))


@provides(IOperationPlugin)
class TasbePlugin(Plugin, PluginHelpMixin):

    id = 'edu.mit.synbio.cytoflowgui.op_plugins.tasbe'
    operation_id = 'edu.mit.synbio.cytoflowgui.op_plugins.tasbe'

    short_name = "TASBE Calibration"
    menu_group = "Gates"
    
    def get_operation(self):
        return TasbePluginOp()
    
    def get_icon(self):
        return ImageResource('tasbe')
    
    @contributes_to(OP_PLUGIN_EXT)
    def get_plugin(self):
        return self