Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# (C) Copyright 2007-2019 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" An action that switches the project perspective. """
# Enthought library imports.
from envisage.ui.single_project.project_action import ProjectAction
from pyface.api import ImageResource
class SwitchToAction(ProjectAction):
""" An action that switches the project perspective. """
# A longer description of the action.
description = "View the current project in the Project perspective"
# The action's image (displayed on tool bar tools etc).
image = ImageResource("switch_project")
# The action's name (displayed on menus/tool bar tools etc).
name = "Switch To Project"
# A short description of the action used for tooltip text etc.
tooltip = "Go to the Project perspective"
def perform(self, event):
""" Perform the action. """
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" An action to close the current project. This is only enabled when
there is a current project.
"""
# Enthought library imports
from envisage.ui.single_project.project_action import ProjectAction
from pyface.api import ImageResource
##############################################################################
# class 'CloseProjectAction'
##############################################################################
class CloseProjectAction(ProjectAction):
""" An action to close the current project. This is only enabled when
there is a current project.
"""
# The universal object locator (UOL).
uol = "envisage.ui.single_project.ui_service.UiService"
# The name of the method to invoke on the object.
method_name = "close"
# A longer description of the action.
description = "Close the current project"
# The action's image (displayed on tool bar tools etc).
image = ImageResource("close_project")
# license included in LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" An action that creates a new project. """
# Enthought library imports.
from envisage.ui.single_project.project_action import ProjectAction
from pyface.api import ImageResource
##############################################################################
# class 'NewProjectAction'
##############################################################################
class NewProjectAction(ProjectAction):
""" An action that creates a new project. """
# The universal object locator (UOL).
uol = "envisage.ui.single_project.ui_service.UiService"
# The name of the method to invoke on the object.
method_name = "create"
# A longer description of the action.
description = "Create a project"
# The action's image (displayed on tool bar tools etc).
image = ImageResource("new_project")
# The action's name (displayed on menus/tool bar tools etc).
name = "New..."
# (C) Copyright 2007-2019 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" An action that renames an item in the project tree. """
# Enthought library imports.
from envisage.ui.single_project.project_action import ProjectAction
class RenameAction(ProjectAction):
""" Renames an item in the project tree. """
#### 'Action' interface ###################################################
# The action's name (displayed on menus/tool bar tools etc).
name = "Rename"
###########################################################################
# 'Action' interface.
###########################################################################
def perform(self, event):
""" Performs the action. """
event.widget.edit_label(event.node)
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" An action that configures an item in the project tree. """
# Enthought library imports.
from envisage.ui.single_project.project_action import ProjectAction
##############################################################################
# class 'ConfigureAction'
##############################################################################
class ConfigureAction(ProjectAction):
""" An action that configures an item in the project tree.
'Configures' in this sense means pop up a trait sheet!
"""
###########################################################################
# 'Action' interface.
###########################################################################
def perform(self, event):
""" Performs the action. """
# fixme: We would like to use "kind='modal'" here, but it doesn't
# work! The bug we see is that when the dialog is complete the
# viscosity model assigned to the trait is NOT the same as the
# license included in LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" An action that saves the current project. """
# Enthought library imports.
from envisage.ui.single_project.project_action import ProjectAction
from pyface.api import ImageResource
##############################################################################
# class 'SaveProjectAction'
##############################################################################
class SaveProjectAction(ProjectAction):
""" An action that saves the current project. """
# The universal object locator (UOL).
uol = "envisage.ui.single_project.ui_service.UiService"
# The name of the method to invoke on the object.
method_name = "save"
# A longer description of the action.
description = "Save the current project"
# The action's image (displayed on tool bar tools etc).
image = ImageResource("save_project")
# The action's name (displayed on menus/tool bar tools etc).
name = "Save"
# Retrieve the project model service and register ourself to listen
# for project state changes. This is done first to avoid errors
# during any refresh calls triggered by further initialization.
# FIXME: I don't think my implementation of the ProjectAction class is correct
# because I can't see to get a reference to the current application. Because of
# this, I'm not able to setup the listeners yet but this needs to be done eventually!
"""
if 'model_service' in kws:
self.model_service = kws['model_service']
del kws['model_service']
else:
self.model_service = self.window.application.get_service(IPROJECT_MODEL)
self._update_model_service_listeners(remove=False)
"""
super(ProjectAction, self).__init__(*args, **kws)
return
# license included in LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" An action that opens a project. """
# Enthought library imports.
from envisage.ui.single_project.project_action import ProjectAction
from pyface.api import ImageResource
##############################################################################
# class 'OpenProjectAction'
##############################################################################
class OpenProjectAction(ProjectAction):
""" An action that opens a project. """
# The universal object locator (UOL).
uol = "envisage.ui.single_project.ui_service.UiService"
# The name of the method to invoke on the object.
method_name = "open"
# A longer description of the action.
description = "Open an existing project"
# The action's image (displayed on tool bar tools etc).
image = ImageResource("open_project")
# The action's name (displayed on menus/tool bar tools etc).
name = "Open..."
# license included in LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" An action that saves the current project to a different location. """
# Enthought library imports.
from envisage.ui.single_project.project_action import ProjectAction
from pyface.api import ImageResource
##############################################################################
# class 'SaveAsProjectAction'
##############################################################################
class SaveAsProjectAction(ProjectAction):
""" An action that saves the current project to a
different location.
"""
# The universal object locator (UOL).
uol = "envisage.ui.single_project.ui_service.UiService"
# The name of the method to invoke on the object.
method_name = "save_as"
# A longer description of the action.
description = "Save the current project to a different location"
# The action's image (displayed on tool bar tools etc).
image = ImageResource("save_as_project")