예제 #1
0
class DefaultActionSet(ActionSet):
    """ The default workbench action set. """

    menus = [
        Menu(
            name="&File",
            path="MenuBar",
            groups=["OpenGroup", "SaveGroup", "ImportGroup", "ExitGroup"],
        ),
        Menu(
            path="MenuBar",
            class_name="pyface.workbench.action.api:ViewMenuManager",
        ),
        Menu(name="&Tools", path="MenuBar", groups=["PreferencesGroup"]),
        Menu(name="&Help", path="MenuBar", groups=["AboutGroup"]),
    ]

    actions = [
        Action(
            path="MenuBar/File",
            group="ExitGroup",
            class_name=PKG + ".action.api:ExitAction",
        ),
        Action(
            path="MenuBar/Tools",
            group="PreferencesGroup",
            class_name=PKG + ".action.api:EditPreferencesAction",
        ),
        Action(
            path="MenuBar/Help",
            group="AboutGroup",
            class_name=PKG + ".action.api:AboutAction",
        ),
    ]
예제 #2
0
def get_action_sets(**traits):
    workbench_action_set = WorkbenchActionSet(
        id=ID + '.tools.workbench_action_set',
        name='Enthought developer tools plugins workbench actions',
        menus=[
            Menu(
                groups=[Group(id='enthought_developer_ToolsGroup')],
                id='enthought_developer_ToolsMenu',
                path='MenuBar',
                name='Developer Tools',
                before='Help',
            ),
            Menu(groups=[Group(id='enthought_developer_DebugGroup')],
                 id='enthought_developer_DebugMenu',
                 path='MenuBar/enthought_developer_ToolsMenu',
                 name='Debug'),
        ],
        actions=[
            Action(name='Invoke FBI',
                   tooltip='Invoke the FBI debugger',
                   class_name=ID + '.action.actions.InvokeFBIAction',
                   id='etsdevtools.developer.helper.fbi.fbi_invoker',
                   path='MenuBar/enthought_developer_ToolsMenu/'
                   'enthought_developer_DebugMenu'),
            Action(name='Restore break points',
                   tooltip='Restores all previously saved break points',
                   class_name=ID + '.action.actions.RestoreBPAction',
                   id='etsdevtools.developer.helper.fbi.break_points.restore',
                   path='MenuBar/enthought_developer_ToolsMenu/'
                   'enthought_developer_DebugMenu'),
        ])
    return workbench_action_set
예제 #3
0
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",
        ),
    ]
    def test_action_with_path_component_that_is_not_a_menu(self):
        """ action with path component that is not a menu """

        action_sets = [
            ActionSet(
                actions = [
                    Action(
                        class_name = 'Exit',
                        path       = 'MenuBar/File'
                    ),

                    Action(
                        class_name = 'Broken',
                        path       = 'MenuBar/File/Exit',
                    ),
                ]
            ),

        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        self.failUnlessRaises(
            ValueError, builder.create_menu_bar_manager, 'MenuBar'
        )

        return
    def test_actions_make_submenus_before_and_after(self):
        """ actions make submenus before and after """

        action_sets = [
            ActionSet(
                actions = [
                    Action(
                        class_name = 'File',
                        path       = 'MenuBar/File/New',
                        after      = 'Folder'
                    ),

                    Action(
                        class_name = 'Project',
                        path       = 'MenuBar/File/New',
                        before     = 'Folder'
                    ),

                    Action(
                        class_name = 'Folder',
                        path       = 'MenuBar/File/New',
                    ),
                ]
            )
        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        menu_manager = builder.create_menu_bar_manager('MenuBar')

        # Make sure the 'File' menu got added to the 'additions' group of the
        # menubar.
        self.assertEqual(1, len(menu_manager.groups))

        additions = menu_manager.find_group('additions')
        self.assertEqual('File', additions.items[0].id)

        # Make sure the 'New' sub-menu got added to the 'additions' group
        # of the 'File' menu.
        menu = menu_manager.find_item('File')
        additions = menu.find_group('additions')

        self.assertEqual('New', additions.items[0].id)

        # Make sure the new 'Folder' and 'File' actions got added to the
        # 'additions' group of the 'New' menu.
        menu = menu_manager.find_item('File/New')
        additions = menu.find_group('additions')

        ids = [item.id for item in additions.items]
        self.assertEqual(['Project', 'Folder', 'File'], ids)

        return
예제 #6
0
class MDDModelerActionSet(WorkbenchActionSet):
    '''
    '''
    id = 'pychron.mdd.action_set'
    #    menus = [
    #           Menu(name = '&File', path = 'MenuBar')
    #           ]
    actions = [
        Action(name='Autoarr',
               path=modeling_path,
               class_name='{}AutoarrAction'.format(action_path)),
        Action(name='Autoagemon',
               path=modeling_path,
               class_name='{}AutoagemonAction'.format(action_path)),
        Action(name='Autoagefree',
               path=modeling_path,
               class_name='{}AutoagefreeAction'.format(action_path)),
        Action(name='Correlation',
               path=modeling_path,
               class_name='{}CorrelationAction'.format(action_path)),
        Action(name='Arrme',
               path=modeling_path,
               class_name='{}ArrmeAction'.format(action_path)),
        Action(name='Agesme',
               path=modeling_path,
               class_name='{}AgesmeAction'.format(action_path)),
        Action(name='Parse Autoupdate...',
               path=mdd_path,
               class_name='{}ParseAutoupdateAction'.format(action_path)),
        Action(name='New Model',
               path=mdd_path,
               class_name='{}NewModelAction'.format(action_path)),
    ]
예제 #7
0
    def test_action_with_path_component_that_is_not_a_menu(self):
        """ action with path component that is not a menu """

        action_sets = [
            ActionSet(actions=[
                Action(class_name="Exit", path="MenuBar/File"),
                Action(class_name="Broken", path="MenuBar/File/Exit"),
            ]),
        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        with self.assertRaises(ValueError):
            builder.create_menu_bar_manager("MenuBar")
    def test_action_with_nonexistent_sibling(self):
        """ action with non-existent sibling """

        action_sets = [
            ActionSet(
                actions = [
                    Action(
                        class_name = 'Exit',
                        path       = 'MenuBar/File',
                        before     = 'NonExistentAction'
                    ),
                ]
            ),

        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        self.failUnlessRaises(
            ValueError, builder.create_menu_bar_manager, 'MenuBar'
        )

        return
    def test_explicit_groups(self):
        """ explicit groups """

        action_sets = [
            ActionSet(menus=[
                Menu(name='&File', path='MenuBar'),
                Menu(name='&Edit', path='MenuBar'),
                Menu(name='&Tools', path='MenuBar'),
                Menu(name='&Help', path='MenuBar')
            ], ),
            ActionSet(menus=[
                Menu(name='&New', path='MenuBar/File', group='NewGroup'),
            ], ),
            ActionSet(actions=[
                Action(
                    class_name='Exit', path='MenuBar/File', group='ExitGroup'),
            ]),
            ActionSet(groups=[
                Group(id='ExitGroup', path='MenuBar/File'),
                Group(id='SaveGroup', path='MenuBar/File', after='NewGroup'),
                Group(id='NewGroup', path='MenuBar/File', before='ExitGroup'),
            ]),
        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        menu_manager = builder.create_menu_bar_manager('MenuBar')

        # Make sure that all of the menus were added the the 'additions' group
        # of the menubar.
        self.assertEqual(1, len(menu_manager.groups))

        additions = menu_manager.find_group('additions')
        ids = [item.id for item in additions.items]
        self.assertEqual(['File', 'Edit', 'Tools', 'Help'], ids)

        # Make sure the 'File' menu has got 3 groups, 'NewGroup', 'ExitGroup'
        # and 'additions' (and in that order!).
        menu = menu_manager.find_item('File')
        self.assertEqual(4, len(menu.groups))

        ids = [group.id for group in menu.groups]
        self.assertEqual(['NewGroup', 'SaveGroup', 'ExitGroup', 'additions'],
                         ids)

        # Make sure the 'New' sub-menu got added to the 'NewGroup' group
        # of the 'File' menu.
        menu = menu_manager.find_item('File')
        group = menu.find_group('NewGroup')

        self.assertEqual('New', group.items[0].id)

        # Make sure the 'Exit' action got added to the 'ExitGroup' group
        # of the 'File' menu.
        menu = menu_manager.find_item('File')
        group = menu.find_group('ExitGroup')

        self.assertEqual('Exit', group.items[0].id)
    def test_actions_no_groups(self):
        """ actions no groups """

        # We split the contributions into different action sets just because
        # that is how it might end up in an actual application... not because
        # you *have* to split them up this way!
        action_sets = [
            ActionSet(
                menus = [
                    Menu(name='&File', path='MenuBar'),
                    Menu(name='&Edit', path='MenuBar'),
                    Menu(name='&Tools', path='MenuBar'),
                    Menu(name='&Help', path='MenuBar')
                ]
            ),

            ActionSet(
                actions = [
                    Action(class_name='Exit', path='MenuBar/File'),
                    Action(class_name='About', path='MenuBar/Help')
                ]
            )
        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        menu_manager = builder.create_menu_bar_manager('MenuBar')

        # Make sure the 'ExitAction' action got added to the 'additions' group
        # of the 'File' menu.
        menu = menu_manager.find_item('File')
        additions = menu.find_group('additions')

        self.assertEqual('Exit', additions.items[0].id)

        # Make sure the 'AboutAction' action got added to the 'additions' group
        # of the 'File' menu.
        menu = menu_manager.find_item('Help')
        additions = menu.find_group('additions')

        self.assertEqual('About', additions.items[0].id)

        return
예제 #11
0
class CanvasDesignerActionSet(WorkbenchActionSet):
    '''
        G{classtree}
    '''
    id = 'pychron.canvas.action_set'
    #    menus = [
    #           Menu(name = '&File', path = 'MenuBar')
    #           ]
    actions = [
        Action(
            name='New Canvas',
            path='MenuBar/File',
            class_name=
            'pychron.canvas.plugins.canvas_designer_actions:NewCanvasAction'),
        Action(
            name='Open Canvas',
            path='MenuBar/File',
            class_name=
            'pychron.canvas.plugins.canvas_designer_actions:OpenCanvasAction'),
    ]
예제 #12
0
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",
        ),
        Action(
            path="ToolBar",
            class_name="envisage.ui.workbench.action.api:ExitAction",
        ),
        Action(
            path="ToolBar/Fred",
            group="AToolBarGroup",
            class_name="envisage.ui.workbench.action.api:AboutAction",
        ),
        Action(
            path="ToolBar/Wilma",
            class_name="envisage.ui.workbench.action.api:AboutAction",
        ),
        Action(
            path="ToolBar/Barney",
            class_name="envisage.ui.workbench.action.api:ExitAction",
        ),
    ]

    #### 'WorkbenchActionSet' interface #######################################

    # The Ids of the perspectives that the action set is enabled in.
    enabled_for_perspectives = ["Foo"]

    # The Ids of the perspectives that the action set is visible in.
    visible_for_perspectives = ["Foo", "Bar"]
예제 #13
0
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',
             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',
            class_name='acme.workbench.action.new_view_action:NewViewAction'),
        Action(path='ToolBar',
               class_name='envisage.ui.workbench.action.api:AboutAction'),
        Action(path='ToolBar',
               class_name='envisage.ui.workbench.action.api:ExitAction'),
        Action(path='ToolBar/Fred',
               group='AToolBarGroup',
               class_name='envisage.ui.workbench.action.api:AboutAction'),
        Action(path='ToolBar/Wilma',
               class_name='envisage.ui.workbench.action.api:AboutAction'),
        Action(path='ToolBar/Barney',
               class_name='envisage.ui.workbench.action.api:ExitAction')
    ]

    #### 'WorkbenchActionSet' interface #######################################

    # The Ids of the perspectives that the action set is enabled in.
    enabled_for_perspectives = ['Foo']

    # The Ids of the perspectives that the action set is visible in.
    visible_for_perspectives = ['Foo', 'Bar']
예제 #14
0
    def test_actions_make_submenus(self):
        """ actions make submenus """

        action_sets = [
            ActionSet(actions=[
                Action(class_name="Folder", path="MenuBar/File/New"),
                Action(class_name="File", path="MenuBar/File/New"),
            ])
        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        menu_manager = builder.create_menu_bar_manager("MenuBar")

        # Make sure the 'File' menu got added to the 'additions' group of the
        # menubar.
        self.assertEqual(1, len(menu_manager.groups))

        additions = menu_manager.find_group("additions")
        self.assertEqual("File", additions.items[0].id)

        # Make sure the 'New' sub-menu got added to the 'additions' group
        # of the 'File' menu.
        menu = menu_manager.find_item("File")
        additions = menu.find_group("additions")

        self.assertEqual("New", additions.items[0].id)

        # Make sure the new 'Folder' and 'File' actions got added to the
        # 'additions' group of the 'New' menu.
        menu = menu_manager.find_item("File/New")
        additions = menu.find_group("additions")

        self.assertEqual("Folder", additions.items[0].id)
        self.assertEqual("File", additions.items[1].id)
    def test_action_with_nonexistent_group(self):
        """ action with non-existent group """

        action_sets = [
            ActionSet(actions=[
                Action(class_name='Exit', path='MenuBar/File', group='Bogus'),
            ]),
        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        with self.assertRaises(ValueError):
            builder.create_menu_bar_manager("MenuBar")
class DefaultActionSet(ActionSet):
    """ The default workbench action set. """

    menus = [
        Menu(name='&File',
             path='MenuBar',
             groups=['OpenGroup', 'SaveGroup', 'ImportGroup', 'ExitGroup']),
        Menu(path='MenuBar',
             class_name='pyface.workbench.action.api:ViewMenuManager'),
        Menu(name='&Tools', path='MenuBar', groups=['PreferencesGroup']),
        Menu(name='&Help', path='MenuBar', groups=['AboutGroup'])
    ]

    actions = [
        Action(path='MenuBar/File',
               group='ExitGroup',
               class_name=PKG + '.action.api:ExitAction'),
        Action(path='MenuBar/Tools',
               group='PreferencesGroup',
               class_name=PKG + '.action.api:EditPreferencesAction'),
        Action(path='MenuBar/Help',
               group='AboutGroup',
               class_name=PKG + '.action.api:AboutAction'),
    ]
예제 #17
0
    def test_action_with_nonexistent_sibling(self):
        """ action with non-existent sibling """

        action_sets = [
            ActionSet(actions=[
                Action(
                    class_name="Exit",
                    path="MenuBar/File",
                    before="NonExistentAction",
                ),
            ]),
        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        with self.assertRaises(ValueError):
            builder.create_menu_bar_manager("MenuBar")
예제 #18
0
    def test_actions_and_menus_in_groups(self):
        """ actions and menus in groups """

        action_sets = [
            ActionSet(menus=[
                Menu(
                    name="&File",
                    path="MenuBar",
                    groups=["NewGroup", "ExitGroup"],
                ),
                Menu(name="&Edit", path="MenuBar"),
                Menu(name="&Tools", path="MenuBar"),
                Menu(name="&Help", path="MenuBar"),
            ], ),
            ActionSet(menus=[
                Menu(name="&New", path="MenuBar/File", group="NewGroup"),
            ], ),
            ActionSet(actions=[
                Action(
                    class_name="Exit",
                    path="MenuBar/File",
                    group="ExitGroup",
                ),
            ]),
        ]

        # Create a builder containing the action set.
        builder = DummyActionManagerBuilder(action_sets=action_sets)

        # Create a menu bar manager for the 'MenuBar'.
        menu_manager = builder.create_menu_bar_manager("MenuBar")

        # Make sure that all of the menus were added the the 'additions' group
        # of the menubar.
        self.assertEqual(1, len(menu_manager.groups))

        additions = menu_manager.find_group("additions")
        ids = [item.id for item in additions.items]
        self.assertEqual(["File", "Edit", "Tools", "Help"], ids)

        # Make sure the 'File' menu has got 3 groups, 'NewGroup', 'ExitGroup'
        # and 'additions' (and in that order!).
        menu = menu_manager.find_item("File")
        self.assertEqual(3, len(menu.groups))

        ids = [group.id for group in menu.groups]
        self.assertEqual(["NewGroup", "ExitGroup", "additions"], ids)

        # Make sure the 'New' sub-menu got added to the 'NewGroup' group
        # of the 'File' menu.
        menu = menu_manager.find_item("File")
        group = menu.find_group("NewGroup")

        self.assertEqual("New", group.items[0].id)

        # Make sure the 'Exit' action got added to the 'ExitGroup' group
        # of the 'File' menu.
        menu = menu_manager.find_item("File")
        group = menu.find_group("ExitGroup")

        self.assertEqual("Exit", group.items[0].id)
예제 #19
0
""" The default action set for the refresh code plugin. """

# Enthought library imports.
from envisage.ui.action.api import Action, ActionSet

# This package
PKG = '.'.join(__name__.split('.')[:-1])

refresh_code = Action(class_name=PKG + '.actions.RefreshCode',
                      path='MenuBar/Tools',
                      group='additions')


class RefreshCodeActionSet(ActionSet):
    """ The default action set for the refresh code plugin. """

    actions = [refresh_code]


#### EOF ######################################################################
    id="FiltersMenu",
    name="&Filters",
    path="MenuBar/VisualizeMenu",
    after="ModulesMenu",
)

########################################
# File menu items.

ID = 'mayavi'

####################
# Source actions.

open_file = Action(id="OpenFile",
                   class_name=ID + ".action.sources.OpenFile",
                   name="&Open file ...",
                   path="MenuBar/File/LoadDataMenu")

# Automatic source generation for non-open file related sources.
SOURCE_ACTIONS = [open_file]

for src in registry.sources:
    if len(src.extensions) == 0:
        action = Action(id=src.id,
                        class_name=ID + ".action.sources." + src.id,
                        name=src.menu_name,
                        path="MenuBar/File/LoadDataMenu")
        SOURCE_ACTIONS.append(action)

####################
# Save/load actions.
예제 #21
0
class ProjectActionSet(WorkbenchActionSet):
    """ Action set of a default Project. """

    # The action set's globally unique identifier.
    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",
        ),
        Action(
            class_name=PKG + ".action.api:OpenProjectAction",
            group="OpenGroup",
            path="MenuBar/File/ProjectMenu",
        ),
        Action(
            class_name=PKG + ".action.api:SaveProjectAction",
            group="SaveGroup",
            path="MenuBar/File/ProjectMenu",
        ),
        Action(
            class_name=PKG + ".action.api:SaveAsProjectAction",
            group="SaveGroup",
            path="MenuBar/File/ProjectMenu",
        ),
        Action(
            class_name=PKG + ".action.api:CloseProjectAction",
            group="CloseGroup",
            path="MenuBar/File/ProjectMenu",
        ),
        # Toolbar actions.
        Action(
            class_name=PKG + ".action.api:SwitchToAction",
            group="PerspectiveGroup",
            path="ToolBar/Project",
        ),
        Action(
            class_name=PKG + ".action.api:NewProjectAction",
            group="ProjectGroup",
            path="ToolBar/Project",
        ),
        Action(
            class_name=PKG + ".action.api:OpenProjectAction",
            group="ProjectGroup",
            path="ToolBar/Project",
        ),
        Action(
            class_name=PKG + ".action.api:SaveProjectAction",
            group="ProjectGroup",
            path="ToolBar/Project",
        ),
        Action(
            class_name=PKG + ".action.api:SaveAsProjectAction",
            group="ProjectGroup",
            path="ToolBar/Project",
        ),
        Action(
            class_name=PKG + ".action.api:CloseProjectAction",
            group="ProjectGroup",
            path="ToolBar/Project",
        ),
    ]

    #### 'WorkbenchActionSet' interface #######################################

    # The Ids of the perspectives that the action set is enabled in.
    enabled_for_perspectives = ["Project"]

    # The Ids of the perspectives that the action set is visible in.
    visible_for_perspectives = ["Project"]
예제 #22
0
""" Action set for the Oracl plugin

"""
# Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and
# University Hospital Center and University of Lausanne (UNIL-CHUV)
#
# Modified BSD License

# Enthought library imports
from envisage.ui.action.api import Action, Group, Menu, ToolBar
from envisage.ui.workbench.api import WorkbenchActionSet

networkrepo = Action(
    id="OracleCNetworkReport",
    class_name="cviewer.plugins.codeoracle.actions.NetworkReport",
    name="Network Report",
    path="MenuBar/Code Oracle/Connectome/CNetwork/Analysis")

xnat_pushpull = Action(
    id="OracleXNATPushPull",
    class_name="cviewer.plugins.codeoracle.actions.XNATPushPull",
    name="XNAT Push and Pull",
    path="MenuBar/Code Oracle/Other/XNAT")

show_surface = Action(
    id="OracleCSurface",
    class_name="cviewer.plugins.codeoracle.actions.ShowSurfaces",
    name="Show Surface",
    path="MenuBar/Code Oracle/Connectome/CSurface/Visualization")

show_volumecre = Action(
예제 #23
0
    name="&Filters",
    path="MenuBar/VisualizeMenu",
    after="ModulesMenu",
)

plugins_menu = Menu(id="PluginsMenu",
                    name="&Plugins",
                    path="MenuBar",
                    before="Help")

####################
# Source actions.

# MODIFY
open_file = Action(id="OpenFile",
                   class_name="mayavi.action.sources.OpenFile",
                   name="&Open file ...",
                   path="MenuBar/File/LoadDataMenu")

open_file2 = Action(id="ConnectomeFile",
                    name="&Open data file ...",
                    class_name="cviewer.action.load_cff:"
                    "OpenFile",
                    path="MenuBar/File",
                    group='ConnectomeFileGroup',
                    before="LoadDataMenu")
open_cff = Action(id="ConnectomeFile",
                  name="&Open Connectome File ...",
                  class_name="cviewer.action.load_cff:"
                  "OpenCFile",
                  path="MenuBar/File",
                  group='ConnectomeFileGroup',
예제 #24
0
    ###########################################################################
    # 'Action' interface.
    ###########################################################################

    def perform(self, event):
        """ Performs the action. """
        shell = get_shell(self.window)

        if shell is not None:
            shell.control.clear_screen()


clear_screen = Action(
    path="MenuBar/Tools",
    class_name=__name__ + '.ClearScreen',
    name="Clear IPython screen",
    group="IPythonShellGroup",
)


################################################################################
# `IPythonShellActionSet` class.
################################################################################
class IPythonShellActionSet(ActionSet):
    """ The default action set for the IPython shell plugin. """

    groups = [
        ipython_shell_group,
    ]

    actions = [clear_screen]
예제 #25
0
        server = get_server(self.window)

        wildcard = 'Python files (*.py)|*.py'

        parent = self.window.control
        dialog = FileDialog(parent=parent,
                            title='Open Python script in separate editor',
                            action='open',
                            wildcard=wildcard)
        if dialog.open() == OK:
            server.open_file(dialog.path)


open_script = Action(
    path="MenuBar/File",
    class_name=__name__ + '.OpenScript',
    name="Open script in editor",
    group="RemoteEditorFileGroup",
)


################################################################################
# `NewScript` class.
################################################################################
class NewScript(PyfaceAction):
    """ An action that opens a new file in a remote editor. """

    tooltip = "Open a new file in separate editor."

    description = "Open a new file in separate editor."

    ###########################################################################
예제 #26
0
#### 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'
)

#### Actions ##################################################################

new_scene = Action(
    class_name = PKG + '.actions.NewScene',
    path       = 'MenuBar/File/New', group='additions'
)

#### Save actions ####

save_scene = Action(
    class_name = PKG + '.actions.SaveScene',
    path       = 'MenuBar/File', group='TVTKSceneGroup', after='SaveSceneAs'
)

save_scene_to_png = Action(
    class_name = PKG + '.actions.SaveSceneToPNG',
    path       = 'MenuBar/File/SaveSceneAs'
)

save_scene_to_jpeg = Action(
예제 #27
0
class ProjectActionSet(WorkbenchActionSet):
    """ Action set of a default Project. """

    # The action set's globally unique identifier.
    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',
        ),
        Action(
            class_name=PKG + '.action.api:OpenProjectAction',
            group='OpenGroup',
            path='MenuBar/File/ProjectMenu',
        ),
        Action(
            class_name=PKG + '.action.api:SaveProjectAction',
            group='SaveGroup',
            path='MenuBar/File/ProjectMenu',
        ),
        Action(
            class_name=PKG + '.action.api:SaveAsProjectAction',
            group='SaveGroup',
            path='MenuBar/File/ProjectMenu',
        ),
        Action(
            class_name=PKG + '.action.api:CloseProjectAction',
            group='CloseGroup',
            path='MenuBar/File/ProjectMenu',
        ),

        # Toolbar actions.
        Action(
            class_name=PKG + '.action.api:SwitchToAction',
            group='PerspectiveGroup',
            path='ToolBar/Project',
        ),
        Action(
            class_name=PKG + '.action.api:NewProjectAction',
            group='ProjectGroup',
            path='ToolBar/Project',
        ),
        Action(
            class_name=PKG + '.action.api:OpenProjectAction',
            group='ProjectGroup',
            path='ToolBar/Project',
        ),
        Action(
            class_name=PKG + '.action.api:SaveProjectAction',
            group='ProjectGroup',
            path='ToolBar/Project',
        ),
        Action(
            class_name=PKG + '.action.api:SaveAsProjectAction',
            group='ProjectGroup',
            path='ToolBar/Project',
        ),
        Action(
            class_name=PKG + '.action.api:CloseProjectAction',
            group='ProjectGroup',
            path='ToolBar/Project',
        ),
    ]

    #### 'WorkbenchActionSet' interface #######################################

    # The Ids of the perspectives that the action set is enabled in.
    enabled_for_perspectives = ['Project']

    # The Ids of the perspectives that the action set is visible in.
    visible_for_perspectives = ['Project']