How to use the envisage.api.IApplication 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 / single_project / model_service.py View on Github external
class ModelService(HasTraits):
    """
    The Envisage service providing the model state for the single
    project plugin.

    """

    ##########################################################################
    # Attributes (Traits)
    ##########################################################################

    ### public 'ModelService' interface ######################################

    # The Envisage application that this service is part of.
    application = Instance(IApplication)

    # The factory to use for creating new projects
    factory = Instance(
        "envisage.ui.single_project.project_factory." "ProjectFactory"
    )

    # The preferences to be exposed through this service.
    preferences = Instance(IPreferences)

    # The currently open project
    project = Instance("envisage.ui.single_project.project.Project")

    # The current selection within the current project.
    selection = List(Any)

    ##########################################################################
github enthought / envisage / envisage / developer / ui / view / plugin_browser.py View on Github external
ExtensionPointModel(
                plugin          = plugin,
                extension_point = extension_point
            )

            for extension_point in plugin.get_extension_points()
        ]

        return extension_point_models


class ApplicationModel(HasTraits):
    """ A model for browsing an application. """

    # The application that we are a model for.
    application = Instance(IApplication)

    #### 'ApplicationModel' interface #########################################

    # Models for each of the application's plugins.
    plugin_models = List(PluginModel)

    ###########################################################################
    # 'ApplicationModel' interface.
    ###########################################################################

    #### Trait initializers ###################################################

    def _plugin_models_default(self):
        """ Trait initializer. """

        return [PluginModel(plugin=plugin) for plugin in self.application]
github enthought / envisage / envisage / ui / single_project / project_factory.py View on Github external
##########################################################################
    # Attributes
    ##########################################################################

    #### public 'ProjectFactory' interface ###################################

    # The class of the project created by this factory.
    #
    # This is provided so that the single_project services can call class
    # methods.
    #
    # This value is meant to be constant for the lifetime of this class!
    PROJECT_CLASS = Project

    # Current envisage application.
    application = Instance(IApplication)

    ##########################################################################
    # 'ProjectFactory' interface.
    ##########################################################################

    #### public method #######################################################

    def create(self):
        """
        Create a new project from scratch.

        This must return an instance of a Project or 'None'.  A return
        value of 'None' indicates that no project could be created.  The
        plugin will display the default traits view to the user so that
        they can configure this new project.
github enthought / envisage / envisage / developer / ui / view / service_registry_browser.py View on Github external
height    = .1
)


class ServiceRegistryBrowser(HasTraits):
    """ An extension registry browser.

    Actually, this class exists just because to use a trait editor we have
    to have a trait to edit!

    """

    #### 'ServiceRegistryBrowser' interface #################################

    # The application that whose extension registry we are browsing.
    application = Instance(IApplication)

    # The code browser that we use to parse plugin source code.
    code_browser = Instance(CodeBrowser)

    # The extension registry that we are browsing.
    service_registry = Instance(IServiceRegistry)

    # The extension registry that we are browsing.
    service_registry_model = Any#Instance(IServiceRegistry)

    # The workbench service.
    workbench = Instance('envisage.ui.workbench.api.Workbench')

    # The default traits UI view.
    traits_view = service_registry_browser_view
github enthought / envisage / examples / plugins / single_project / sample_project / plugins / single_project / env_project_factory.py View on Github external
##########################################################################
    # Attributes
    ##########################################################################

    #### public 'ProjectFactory' interface ###################################

    # The class of the project created by this factory.
    #
    # This is provided so that the single_project services can call class
    # methods.
    #
    # This value is meant to be constant for the lifetime of this class!
    PROJECT_CLASS = EnvProject

    # Current envisage application.
    application = Instance(IApplication)

    #### public method #######################################################

    def create(self):
        """
        Create a new project from scratch.

        This must return an instance of a Project or 'None'.  A return
        value of 'None' indicates that no project could be created.  The
        plugin will display the default traits view to the user so that
        they can configure this new project.

        """

        return self.PROJECT_CLASS(application=self.application)
github enthought / envisage / envisage / developer / ui / view / application_browser.py View on Github external
width     = .1,
    height    = .1
)


class ApplicationBrowser(HasTraits):
    """ An application browser.

    Actually, this class exists just because to use a trait editor we have
    to have a trait to edit!

    """

    # The application that we are browsing.
    application = Instance(IApplication)

    # The code browser that we use to parse plugin source code.
    code_browser = Instance(CodeBrowser)

    # The workbench service.
    workbench = Instance('envisage.ui.workbench.api.Workbench')

    # The object that is currently selected in the tree.
    selection = Any

    # The default traits UI view.
    traits_view = application_browser_view

    ###########################################################################
    # 'ApplicationBrowser' interface.
    ###########################################################################
github enthought / envisage / envisage / developer / ui / view / extension_registry_browser.py View on Github external
height    = .1
)


class ExtensionRegistryBrowser(HasTraits):
    """ An extension registry browser.

    Actually, this class exists just because to use a trait editor we have
    to have a trait to edit!

    """

    #### 'ExtensionRegistryBrowser' interface #################################

    # The application that whose extension registry we are browsing.
    application = Instance(IApplication)

    # The code browser that we use to parse plugin source code.
    code_browser = Instance(CodeBrowser)

    # The extension registry that we are browsing.
    extension_registry = Instance(IExtensionRegistry)

    # The workbench service.
    workbench = Instance('envisage.ui.workbench.api.Workbench')

    # The default traits UI view.
    traits_view = extension_registry_browser_view

    ###########################################################################
    # 'ExtensionRegistryBrowser' interface.
    ###########################################################################
github enthought / envisage / envisage / ui / workbench / workbench.py View on Github external
""" The Envisage workbench.

    There is (usually) exactly *one* workbench per application. The workbench
    can create any number of workbench windows.

    """

    #### 'pyface.Workbench' interface #########################################

    # The factory that is used to create workbench windows.
    window_factory = WorkbenchWindow

    #### 'Workbench' interface ################################################

    # The application that the workbench is part of.
    application = Instance(IApplication)

    # Should the user be prompted before exiting the workbench?
    prompt_on_exit = Delegate("_preferences")

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

    # The workbench preferences.
    _preferences = Instance(WorkbenchPreferences, ())

    ###########################################################################
    # Private interface.
    ###########################################################################

    def _exiting_changed(self, event):
        """ Called when the workbench is exiting. """
github enthought / envisage / envisage / developer / ui / view / application_browser_tree.py View on Github external
def is_node_for(self, obj):
        """ Return whether this is the node that handles a specified object.

        """

        return IApplication(obj, Undefined) is obj
github enthought / envisage / envisage / ui / single_project / view / project_view.py View on Github external
class ProjectView(HasTraits):
    """
    The single project plugin's project view

    """

    ##########################################################################
    # Traits
    ##########################################################################

    #### public 'ProjectView' interface ######################################

    # The Envisage application that this service is part of.
    application = Instance(IApplication)

    # The suffix currently applied to our name
    name_suffix = Str("")

    # The suffix applied to titles when the current project is dirty.
    title_suffix = Str("*")

    # Root node for the project.
    root = Instance(Project)

    # The traits view to display:
    view = View(
        Item(
            "root",
            editor=TreeEditor(editable=False, auto_open=1),
            show_label=False,