示例#1
0
文件: action.py 项目: jcrabtree/godot
class GodotWorkbenchActionSet(WorkbenchActionSet):
    """ A set of workbench related actions for the Godot plug-in.
    """

    #--------------------------------------------------------------------------
    #  "ActionSet" interface:
    #--------------------------------------------------------------------------

    # The action set"s globally unique identifier.
    id = "godot.plugin.workbench_action_set"

    menus = [
        Menu(name="&New",
             path="MenuBar/File",
             group="OpenGroup",
             groups=["ContainerGroup", "ComponentGroup", "OtherGroup"])
    ]

    actions = [
        Action(path="MenuBar/File/New",
               group="ComponentGroup",
               class_name="godot.plugin.action:NewDotGraphAction"),
        Action(path="Resource/New",
               group="ComponentGroup",
               class_name="godot.plugin.action:NewDotGraphAction")
    ]
示例#2
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 Python File",
            class_name='cviewer.plugins.text_editor.actions.NewFileAction',
            group='TextFileGroup',
            path="MenuBar/File",
        ),
        Action(
            id='OpenFile',
            name="Open Python File ...",
            class_name='cviewer.plugins.text_editor.actions.OpenFileAction',
            group='TextFileGroup',
            path="MenuBar/File",
        ),
    ]
示例#3
0
    def _actions_default(self):
        action_list = []
        #sys.path.append(os.path.join(os.pardir,'Scripts'))
        if sys.platform == 'darwin':
            script_path = os.path.expanduser(
                '~/Library/Application Support/RadPy/Scripts')
            if not os.path.exists(script_path):
                os.makedirs(script_path)
                for name in glob.glob('../Scripts/*.py'):
                    shutil.copy(name, script_path)
        else:
            script_path = os.path.join(os.pardir, 'Scripts')

        for name in os.listdir(script_path):
            if name.endswith(".py") and name != '__init__.py':
                try:
                    module = os.path.splitext(name)[0]
                    f, filename, description = imp.find_module(
                        module, [script_path])

                    # Import the module if no exception occurred
                    class_name = module + '.UserAction'
                    script = imp.load_module(module, f, filename, description)

                    # If the module is a single file, close it
                    if not (description[2] == imp.PKG_DIRECTORY):
                        f.close()

                    if script.UserAction.menubar_path:
                        user_action = Action(
                            class_name=class_name,
                            path=script.UserAction.menubar_path)
                        action_list.append(user_action)

                    if script.UserAction.toolbar_path:
                        user_action = Action(
                            class_name=class_name,
                            path=script.UserAction.toolbar_path)
                        action_list.append(user_action)

                    #print 'Plugin:', module, 'loaded'

                except (ImportError, AttributeError):
                    # Not able to find module so pass
                    pass

#                name = os.path.splitext(name)[0]
#                class_name = 'Scripts.' + \
#                            name + ':UserAction'
#                try:
#                    exec("from " + name +" import UserAction")
#
#                except ImportError:
#                    pass
#
#                except:
#                    print "Unexpected error:", sys.exc_info()[0]
#                    raise
#
#                else:
#
#                    if UserAction.menubar_path:
#                        user_action = Action(
#                            class_name = class_name,
#                            path = UserAction.menubar_path
#                            )
#                        action_list.append(user_action)
#
#                    if UserAction.toolbar_path:
#                        user_action = Action(
#                            class_name = class_name,
#                            path = UserAction.toolbar_path
#                            )
#                        action_list.append(user_action)

        return action_list
示例#4
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="enthought.mayavi.action.sources.OpenFile",
                   name="&Open file ...",
                   path="MenuBar/File/LoadDataMenu")

open_cff = Action(id="ConnectomeFile",
                  name="&Open Connectome File ...",
                  class_name="cviewer.action.load_cff:"
                  "OpenCFile",
                  path="MenuBar/File",
                  group='ConnectomeFileGroup',
                  before="LoadDataMenu")
save_cff = Action(id="ConnectomeFileSave",
                  name="&Save Connectome File ...",
                  class_name="cviewer.action.load_cff:"
                  "SaveCFile",
                  path="MenuBar/File",
                  group='ConnectomeFileGroup',
示例#5
0
    id="FiltersMenu",
    name="&Filters",
    path="MenuBar/VisualizeMenu",
    after="ModulesMenu",
)

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

ID = 'enthought.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.
示例#6
0
                   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')

#### 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(class_name=PKG + '.actions.SaveSceneToJPEG',
                            path='MenuBar/File/SaveSceneAs')
示例#7
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 enthought.envisage.ui.action.api import Action, Group, Menu, ToolBar
from enthought.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(
class BeamAnalysisActionSet(WorkbenchActionSet):

    #### 'ActionSet' interface ################################################

    # The action set's globally unique identifier.
    id = 'radpy.plugins.BeamAnalysis.actions'

    menus = [
        Menu(name='&Tools', path='MenuBar'
             #groups=['XGroup', 'YGroup']
             ),
    ]

    #    groups = [
    #       Group(id='Fred', path='MenuBar/Test')
    #    ]

    tool_bars = [
        ToolBar(name='Beam Analysis'),
        #        ToolBar(name='Wilma'),
        #        ToolBar(name='Barney')
    ]

    actions = [
        Action(
            path='MenuBar/File',  #group='XGroup',
            class_name=
            'radpy.plugins.BeamAnalysis.action.BeamAnalysis_action:NewPlotAction'
        ),
        Action(
            path='MenuBar/File',  #group='XGroup',
            class_name=
            'radpy.plugins.BeamAnalysis.action.BeamAnalysis_action:OpenDataFileAction'
        ),
        Action(
            path='MenuBar/File',  #group='XGroup',
            class_name=
            'radpy.plugins.BeamAnalysis.action.BeamAnalysis_action:OpenDirectoryAction'
        ),
        Action(
            path='MenuBar/File',  #group='XGroup',
            class_name=
            'radpy.plugins.BeamAnalysis.action.BeamAnalysis_action:SaveDataFileAction'
        ),
        Action(
            path='MenuBar/File',  #group='XGroup',
            class_name=
            'radpy.plugins.BeamAnalysis.action.BeamAnalysis_action:SaveAsAction'
        ),
        #        Action(
        #            path='MenuBar/Tools', #group='Fred',
        #            class_name='radpy.plugins.BeamAnalysis.action.BeamAnalysis_action:SmoothAction'
        #        ),
        #        Action(
        #            path='MenuBar/Test', group='Fred',
        #            class_name='radpy.workbench.action.new_view_action:NewViewAction'
        #        ),
        #
        #        Action(
        #            path='MenuBar/Help',
        #            class_name='enthought.envisage.ui.workbench.action.api:AboutAction'
        #        ),
        #
        #        Action(
        #            path='ToolBar',
        #            class_name='enthought.envisage.ui.workbench.action.api:ExitAction'
        #        ),
        #
        Action(
            path='ToolBar/Beam Analysis',
            class_name=
            'radpy.plugins.BeamAnalysis.action.BeamAnalysis_action:NewPlotAction'
        ),
        Action(
            path='ToolBar/Beam Analysis',
            class_name=
            'radpy.plugins.BeamAnalysis.action.BeamAnalysis_action:OpenDataFileAction'
        ),
        #        Action(
        #            path='ToolBar/Beam Analysis',
        #            class_name='radpy.plugins.BeamAnalysis.action.BeamAnalysis_action:SmoothAction'
        #        ),
        #
        #
        #        Action(
        #            path='ToolBar/Wilma',
        #            class_name='enthought.envisage.ui.workbench.action.api:AboutAction'
        #        ),
        #
        #        Action(
        #            path='ToolBar/Barney',
        #            class_name='enthought.envisage.ui.workbench.action.api:ExitAction'
        #        )
    ]

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

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

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