1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
""" A view that allows a developer to browse the current application. """
# Enthought library imports.
from enthought.pyface.workbench.api import TraitsUIView
from enthought.traits.api import Instance
# The code browser protocol.
CODE_BROWSER = 'enthought.envisage.developer.code_browser.api.CodeBrowser'
class ApplicationBrowserView(TraitsUIView):
""" A view that allows a developer to browse the current application. """
#### 'IWorkbenchPart' interface ###########################################
# The part's globally unique identifier.
id = 'enthought.envisage.developer.ui.view.application_browser_view'
# The part's name (displayed to the user).
name = 'Plugins'
#### 'IView' interface ####################################################
# The category that the view belongs to (this can used to group views when
# they are displayed to the user).
category = 'Developer'
#### 'ApplicationBrowserView' interface ###################################
# The code browser used to parse Python code.
code_browser = Instance(CODE_BROWSER)
###########################################################################
# 'TraitsUIView' interface.
###########################################################################
def _obj_default(self):
""" Trait initializer. """
# Local imports.
from application_browser import ApplicationBrowser
application_browser = ApplicationBrowser(
application = self.window.application,
code_browser = self.code_browser
)
return application_browser
###########################################################################
# 'ApplicationBrowserView' interface.
###########################################################################
def _code_browser_default(self):
""" Trait initializer. """
return self.window.application.get_service(CODE_BROWSER)
#### EOF ######################################################################
|