Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class TestActionSet(WorkbenchActionSet):
""" An action test useful for testing. """
#### 'ActionSet' interface ################################################
# The action set's globally unique identifier.
id = "envisage.ui.workbench.test"
menus = [
Menu(name="&Test", path="MenuBar", groups=["XGroup", "YGroup"]),
Menu(name="Foo", path="MenuBar/Test", groups=["XGroup", "YGroup"]),
Menu(name="Bar", path="MenuBar/Test", groups=["XGroup", "YGroup"]),
]
groups = [Group(id="Fred", path="MenuBar/Test")]
tool_bars = [
ToolBar(name="Fred", groups=["AToolBarGroup"]),
ToolBar(name="Wilma"),
ToolBar(name="Barney"),
]
actions = [
Action(
path="MenuBar/Test",
group="Fred",
class_name="envisage.ui.workbench.action.api:AboutAction",
),
Action(
path="ToolBar",
class_name="envisage.ui.workbench.action.api:AboutAction",
# The action set's globally unique identifier.
id = "envisage.ui.workbench.test"
menus = [
Menu(
name="&Test",
path="MenuBar",
before="Help",
groups=["XGroup", "YGroup"],
),
Menu(name="Foo", path="MenuBar/Test", groups=["XGroup", "YGroup"]),
Menu(name="Bar", path="MenuBar/Test", groups=["XGroup", "YGroup"]),
]
groups = [Group(id="Fred", path="MenuBar/Test")]
tool_bars = [
ToolBar(name="Fred", groups=["AToolBarGroup"]),
ToolBar(name="Wilma"),
ToolBar(name="Barney"),
]
actions = [
Action(
path="MenuBar/Test",
group="Fred",
class_name="envisage.ui.workbench.action.api:AboutAction",
),
Action(
path="MenuBar/Test",
group="Fred",
# Enthought library imports.
from envisage.ui.action.api import Action, ActionSet, Group, Menu
# This package
PKG = '.'.join(__name__.split('.')[:-1])
#### Groups ###################################################################
scene_group = Group(
id='TVTKSceneGroup',
path='MenuBar/File', before='ExitGroup'
)
view_group = Group(
id='TVTKViewGroup',
path='MenuBar/Tools', before='PreferencesGroup'
)
#### Menus ####################################################################
new_menu = Menu(
name='&New',
path='MenuBar/File', group='TVTKSceneGroup'
)
save_scene_as_menu = Menu(
id='SaveSceneAs', name="Sa&ve Scene As",
path='MenuBar/File', group='TVTKSceneGroup', after='New'
)
# License: BSD Style.
# Enthought library imports.
from envisage.ui.action.api import Action, ActionSet, Group, Menu
from mayavi.core.registry import registry
########################################
# Groups
file_group = Group(
id='MayaviFileGroup',
path='MenuBar/File',
before='ExitGroup'
)
visualize_group = Group(
id='VisualizeGroup',
path='MenuBar/VisualizeMenu',
)
modules_group = Group(
id='ModulesGroup',
path='MenuBar/VisualizeMenu/ModulesMenu',
)
filters_group = Group(
id='FiltersGroup',
path='MenuBar/VisualizeMenu/FiltersMenu',
)
########################################
# Menus
#
# 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!
from envisage.ui.action.api import Action, ActionSet, Group
class TextEditorActionSet(ActionSet):
""" The default action set for the Text Editor plugin.
"""
groups = [
Group(id="TextFileGroup", path="MenuBar/File", before="ExitGroup")
]
actions = [
Action(
id="NewFileAction",
name="New Text File",
class_name="envisage.plugins.text_editor.actions.NewFileAction",
group="TextFileGroup",
path="MenuBar/File",
),
Action(
id="OpenFile",
name="Open Text File...",
class_name="envisage.plugins.text_editor.actions.OpenFileAction",
group="TextFileGroup",
path="MenuBar/File",
"""Mayavi action set for menus and actions etc.
"""
# Author: Prabhu Ramachandran
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from envisage.ui.action.api import Action, ActionSet, Group, Menu
from mayavi.core.registry import registry
########################################
# Groups
file_group = Group(
id='MayaviFileGroup',
path='MenuBar/File',
before='ExitGroup'
)
visualize_group = Group(
id='VisualizeGroup',
path='MenuBar/VisualizeMenu',
)
modules_group = Group(
id='ModulesGroup',
path='MenuBar/VisualizeMenu/ModulesMenu',
)
filters_group = Group(
id = "envisage.ui.single_project.action_set"
# List of menus we provide.
menus = [
Menu(
id="ProjectMenu",
name="&Project",
path="MenuBar/File",
group="ProjectGroup",
),
]
# List of groups we provide.
groups = [
Group(id="OpenGroup", path="MenuBar/File/ProjectMenu"),
Group(id="SaveGroup", path="MenuBar/File/ProjectMenu"),
Group(id="CloseGroup", path="MenuBar/File/ProjectMenu"),
Group(id="ProjectGroup", path="MenuBar/File", before="ExitGroup"),
]
# List of toolbars we provide.
tool_bars = [
ToolBar(name="Project", groups=["PerspectiveGroup", "ProjectGroup"]),
]
# List of actions we provide.
actions = [
# File menu actions.
Action(
class_name=PKG + ".action.api:NewProjectAction",
group="OpenGroup",
path="MenuBar/File/ProjectMenu",
from envisage.ui.action.api import Action, ActionSet, Group
from pyface.api import FileDialog, OK
from pyface.action.api import Action as PyfaceAction
from envisage.plugins.remote_editor.api import IRemoteEditor
def get_server(window):
""" Given an application window, retrieve the communication server.
"""
return window.application.get_service(IRemoteEditor)
################################################################################
# Groups
################################################################################
file_group = Group(
id='RemoteEditorFileGroup',
path='MenuBar/File',
before='ExitGroup'
)
################################################################################
# `OpenScript` class.
################################################################################
class OpenScript(PyfaceAction):
""" An action that opens a Python file in a remote editor. """
tooltip = "Open a Python script in separate editor."
description = "Open a Python script in separate editor."
from envisage.ui.action.api import Action, ActionSet, Group
from pyface.action.api import Action as PyfaceAction
from envisage.plugins.python_shell.api import IPythonShell
def get_shell(window):
""" Given an application window, retrieve the ipython shell.
"""
return window.application.get_service(IPythonShell)
################################################################################
# Groups
################################################################################
ipython_shell_group = Group(
id='IPythonShellGroup',
path='MenuBar/Tools',
#before='ExitGroup'
)
################################################################################
# `ClearScreen` class.
################################################################################
class ClearScreen(PyfaceAction):
""" An action that clears the IPython screen. """
tooltip = "Clear the IPython screen."
description = "Clear the IPython screen."
# List of menus we provide.
menus = [
Menu(
id="ProjectMenu",
name="&Project",
path="MenuBar/File",
group="ProjectGroup",
),
]
# List of groups we provide.
groups = [
Group(id="OpenGroup", path="MenuBar/File/ProjectMenu"),
Group(id="SaveGroup", path="MenuBar/File/ProjectMenu"),
Group(id="CloseGroup", path="MenuBar/File/ProjectMenu"),
Group(id="ProjectGroup", path="MenuBar/File", before="ExitGroup"),
]
# List of toolbars we provide.
tool_bars = [
ToolBar(name="Project", groups=["PerspectiveGroup", "ProjectGroup"]),
]
# List of actions we provide.
actions = [
# File menu actions.
Action(
class_name=PKG + ".action.api:NewProjectAction",
group="OpenGroup",
path="MenuBar/File/ProjectMenu",
),
Action(