How to use the envisage.api.ServiceOffer 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 / examples / MOTD_Using_Eggs / src / acme.motd / acme / motd / motd_plugin.py View on Github external
def _service_offers_default(self):
        """ Trait initializer. """

        # When you register a service offer it is best to specify the protocol
        # a string name (rather than importing the protocol right now). This
        # allows the protocol to be lazily loaded. Also, don't specify the
        # protocol as coming from an 'api.py' file as this is not the actual
        # module name known to Python.
        motd_service_offer = ServiceOffer(
            protocol="acme.motd.i_motd.IMOTD",
            factory=self._create_motd_service,
        )

        return [motd_service_offer]
github enthought / envisage / examples / MOTD / acme / motd / motd_plugin.py View on Github external
def _service_offers_default(self):
        """ Trait initializer. """

        # Register the protocol as a string containing the actual module path
        # and *not* a module path that goes via an 'api.py' file as this does
        # not match what Python thinks the module is! This allows the service
        # to be looked up by passing either the exact same string, or the
        # actual protocol object itself (the latter is the preferred way of
        # doing it!).
        motd_service_offer = ServiceOffer(
            protocol="acme.motd.i_motd.IMOTD",
            factory=self._create_motd_service,
        )

        return [motd_service_offer]
github enthought / envisage / envisage / plugins / event_manager / plugin.py View on Github external
def _service_offers_default(self):
        from encore.events.api import BaseEventManager, get_event_manager

        evt_mgr_service_offer = ServiceOffer(
            protocol=BaseEventManager, factory=get_event_manager,
        )
        return [evt_mgr_service_offer]
github enthought / envisage / envisage / ui / workbench / workbench_plugin.py View on Github external
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,
            properties = {'a dictionary' : 'that is passed to the factory'}
github enthought / envisage / envisage / core_plugin.py View on Github external
)

    @on_trait_change("preferences_items")
    def _preferences_changed(self, event):
        """ React to new preferencess being *added*.

        Note that we don't currently do anything if preferences are *removed*.

        """

        self._load_preferences(event.added)

        return

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

        Services are simply objects that a plugin wants to make available to
        other plugins. This extension point allows you to offer services
        that are created 'on-demand'.

        e.g.

        my_service_offer = ServiceOffer(
            protocol   = 'acme.IMyService',
            factory    = an_object_or_a_callable_that_creates_one,
            properties = {'a dictionary' : 'that is passed to the factory'}
        )

        See the documentation for 'ServiceOffer' for more details.
github enthought / mayavi / tvtk / plugins / scene / scene_plugin.py View on Github external
def _service_offers_default(self):
        """ Trait initializer. """

        scene_manager_service_offer = ServiceOffer(
            protocol = PKG + '.i_scene_manager.ISceneManager',
            factory  = PKG + '.scene_manager.SceneManager',
        )

        return [scene_manager_service_offer]
github robmcmullen / omnivore / omnivore_framework / file_type / plugin.py View on Github external
def _service_offers_default(self):
        """ Trait initializer. """

        log.debug("in _service_offers_default")
        offer1 = ServiceOffer(
            protocol = 'omnivore_framework.file_type.i_file_recognizer.IFileRecognizerDriver',
            factory  = self._create_file_recognizer_driver_service
        )

        return [offer1]
github enthought / mayavi / examples / mayavi / user_mayavi.py View on Github external
def _service_offers_default(self):
        """ Trait initializer. """
        worker_service_offer = ServiceOffer(
            protocol = 'user_mayavi.Worker',
            factory  = 'user_mayavi.Worker'
        )
        return [worker_service_offer]
github enthought / envisage / envisage / developer / developer_plugin.py View on Github external
def _service_offers_default(self):
        """ Trait initializer. """

        code_browser_class = PKG + '.code_browser.api.CodeBrowser'

        code_browser_service_offer = ServiceOffer(
            protocol = code_browser_class,
            factory  = code_browser_class,
            scope    = 'application'
        )

        return [code_browser_service_offer]
github enthought / envisage / envisage / ui / tasks / tasks_plugin.py View on Github external
def _my_service_offers_default(self):
        preferences_dialog_service_offer = ServiceOffer(
            protocol="envisage.ui.tasks.preferences_dialog.PreferencesDialog",
            factory=self._create_preferences_dialog_service,
        )

        return [preferences_dialog_service_offer]