| 1 |
# (C) Copyright 2007-2025 Enthought, Inc., Austin, TX |
| 2 |
# All rights reserved. |
| 3 |
# |
| 4 |
# This software is provided without warranty under the terms of the BSD |
| 5 |
# license included in LICENSE.txt and may be redistributed only under |
| 6 |
# the conditions described in the aforementioned license. The license |
| 7 |
# is also available online at http://www.enthought.com/licenses/BSD.txt |
| 8 |
# |
| 9 |
# Thanks for using Enthought open source! |
| 10 |
|
| 11 |
""" A test action set. """ |
| 12 |
|
| 13 |
|
| 14 |
# Enthought library imports. |
| 15 |
from envisage.ui.action.api import Action, Group, Menu, ToolBar |
| 16 |
from envisage.ui.workbench.api import WorkbenchActionSet |
| 17 |
|
| 18 |
|
| 19 |
class ExampleActionSet(WorkbenchActionSet): |
| 20 |
"""An action test useful for testing.""" |
| 21 |
|
| 22 |
#### 'ActionSet' interface ################################################ |
| 23 |
|
| 24 |
# The action set's globally unique identifier. |
| 25 |
id = "envisage.ui.workbench.test" |
| 26 |
|
| 27 |
menus = [ |
| 28 |
Menu( |
| 29 |
name="&Test", |
| 30 |
path="MenuBar", |
| 31 |
before="Help", |
| 32 |
groups=[Group(id="XGroup"), Group(id="YGroup")], |
| 33 |
), |
| 34 |
Menu( |
| 35 |
name="Foo", |
| 36 |
path="MenuBar/Test", |
| 37 |
groups=[Group(id="XGroup"), Group(id="YGroup")], |
| 38 |
), |
| 39 |
Menu( |
| 40 |
name="Bar", |
| 41 |
path="MenuBar/Test", |
| 42 |
groups=[Group(id="XGroup"), Group(id="YGroup")], |
| 43 |
), |
| 44 |
] |
| 45 |
|
| 46 |
groups = [Group(id="Fred", path="MenuBar/Test")] |
| 47 |
|
| 48 |
tool_bars = [ |
| 49 |
ToolBar(name="Fred", groups=[Group(id="AToolBarGroup")]), |
| 50 |
ToolBar(name="Wilma"), |
| 51 |
ToolBar(name="Barney"), |
| 52 |
] |
| 53 |
|
| 54 |
actions = [ |
| 55 |
Action( |
| 56 |
path="MenuBar/Test", |
| 57 |
group="Fred", |
| 58 |
class_name="envisage.ui.workbench.action.api:AboutAction", |
| 59 |
), |
| 60 |
Action( |
| 61 |
path="MenuBar/Test", |
| 62 |
group="Fred", |
| 63 |
class_name="acme.workbench.action.new_view_action:NewViewAction", |
| 64 |
), |
| 65 |
Action( |
| 66 |
path="ToolBar", |
| 67 |
class_name="envisage.ui.workbench.action.api:AboutAction", |
| 68 |
), |
| 69 |
Action( |
| 70 |
path="ToolBar", |
| 71 |
class_name="envisage.ui.workbench.action.api:ExitAction", |
| 72 |
), |
| 73 |
Action( |
| 74 |
path="ToolBar/Fred", |
| 75 |
group="AToolBarGroup", |
| 76 |
class_name="envisage.ui.workbench.action.api:AboutAction", |
| 77 |
), |
| 78 |
Action( |
| 79 |
path="ToolBar/Wilma", |
| 80 |
class_name="envisage.ui.workbench.action.api:AboutAction", |
| 81 |
), |
| 82 |
Action( |
| 83 |
path="ToolBar/Barney", |
| 84 |
class_name="envisage.ui.workbench.action.api:ExitAction", |
| 85 |
), |
| 86 |
] |
| 87 |
|
| 88 |
#### 'WorkbenchActionSet' interface ####################################### |
| 89 |
|
| 90 |
# The Ids of the perspectives that the action set is enabled in. |
| 91 |
enabled_for_perspectives = ["Foo"] |
| 92 |
|
| 93 |
# The Ids of the perspectives that the action set is visible in. |
| 94 |
visible_for_perspectives = ["Foo", "Bar"] |
| 95 |
|
| 96 |
# The Ids of the views that the action set is enabled for. |
| 97 |
# enabled_for_views = ['Red'] |
| 98 |
|
| 99 |
# The Ids of the views that the action set is visible for. |
| 100 |
# visible_for_views = ['Red'] |