Esempio n. 1
0
    def _create_other_group(self, window):
        """ Creates a group containing the 'Other...' action. """

        group = Group()
        group.append(ShowViewAction(name='Other...', window=window))

        return group
Esempio n. 2
0
    def _create_other_group(self, window):
        """ Creates a group containing the 'Other...' action. """

        group = Group()
        group.append(ShowViewAction(name='Other...', window=window))

        return group
Esempio n. 3
0
    def get_context_menu(self, node):
        """ Returns the context menu for a node. """
        
        sat = Group(id='SystemActionsTop')
        nsa = Group(id='NodeSpecificActions')
        sab = Group(id='SystemActionsBottom')

        # The 'New' menu.
        new_actions = self.get_new_actions(node)
        if new_actions is not None and len(new_actions) > 0:
            sat.append(
                MenuManager(
                    name = 'New',
                    *new_actions
                ),
            )
            
        # Node-specific actions.
        actions = self.get_actions(node)
        if actions is not None and len(actions) > 0:
            for item in actions:
                nsa.append(item)
        
        # System actions (actions available on ALL nodes).
        system_actions = self.node_manager.system_actions
        if len(system_actions) > 0:
            for item in system_actions:
                sab.append(item)

        context_menu = MenuManager(sat, nsa, sab)
        context_menu.dump()
        
        return context_menu
Esempio n. 4
0
    def __label_menu_default(self):
        """ Trait initialiser. """

        size_group = Group(LabelIncrementSizeAction(window=self),
                LabelDecrementSizeAction(window=self))

        normal = LabelNormalFontAction(window=self, id='normal', style='radio',
                checked=True)
        bold = LabelBoldFontAction(window=self, id='bold', style='radio')
        italic = LabelItalicFontAction(window=self, id='italic', style='radio')

        style_group = Group(normal, bold, italic, id='style')

        return MenuManager(size_group, style_group, name="&Label")
Esempio n. 5
0
    def _create_perspective_group(self, window):
        """ Create the actions that switch to specific perspectives. """

        # fixme: Not sure if alphabetic sorting is appropriate in all cases,
        # but it will do for now!
        perspectives = window.perspectives[:]
        perspectives.sort(lambda x, y: cmp(x.name, y.name))

        # For each perspective, create an action that sets the active
        # perspective to it.
        group = Group()
        for perspective in perspectives:
            group.append(SetActivePerspectiveAction(perspective=perspective, window=window))

        return group
Esempio n. 6
0
    def _create_item_group(self, window):
        """ Creates a group containing the items. """

        group = Group()
        self._initialize_item_group(window, group)

        return group
Esempio n. 7
0
    def _create_view_group(self, window):
        """ Creates a group containing the view 'togglers'. """

        group = Group()
        self._initialize_view_group(window, group)

        return group
Esempio n. 8
0
    def _create_reset_perspective_group(self, window):
        """ Create the reset perspective actions. """

        group = Group(ResetActivePerspectiveAction(window=window),
                      ResetAllPerspectivesAction(window=window))

        return group
Esempio n. 9
0
    def _create_perspective_group(self, window):
        """ Create the actions that switch to specific perspectives. """

        # fixme: Not sure if alphabetic sorting is appropriate in all cases,
        # but it will do for now!
        perspectives = window.perspectives[:]
        perspectives.sort(lambda x, y: cmp(x.name, y.name))

        # For each perspective, create an action that sets the active
        # perspective to it.
        group = Group()
        for perspective in perspectives:
            group.append(
                SetActivePerspectiveAction(perspective=perspective,
                                           window=window))

        return group
Esempio n. 10
0
    def _create_user_perspective_group(self, window):
        """ Create the user perspective create/save/rename/delete actions. """

        group = Group(NewUserPerspectiveAction(window=window),
                      SaveAsUserPerspectiveAction(window=window),
                      RenameUserPerspectiveAction(window=window),
                      DeleteUserPerspectiveAction(window=window))

        return group
Esempio n. 11
0
 def _actions_default(self):
     actions = [ Group(
                 Action(tooltip="View the Mayavi pipeline",
                     image=ImageResource('m2', 
                             search_path=self.image_search_path),
                     on_perform=self.show_engine,
                     ),
                     ),
                     ]
     actions.extend(DecoratedScene._actions_default(self))
     return actions
Esempio n. 12
0
    def __label_menu_default(self):
        """ Trait initialiser. """

        size_group = Group(CommandAction(command=LabelIncrementSizeCommand),
                           CommandAction(command=LabelDecrementSizeCommand))

        normal = CommandAction(id='normal',
                               command=LabelNormalFontCommand,
                               style='radio',
                               checked=True)
        bold = CommandAction(id='bold',
                             command=LabelBoldFontCommand,
                             style='radio')
        italic = CommandAction(id='italic',
                               command=LabelItalicFontCommand,
                               style='radio')

        style_group = Group(normal, bold, italic, id='style')

        return MenuManager(size_group, style_group, name="&Label")
Esempio n. 13
0
    def _groups_default(self):
        """ Trait initializer. """

        groups = []

        # Add a group containing the perspective menu (if requested).
        if self.show_perspective_menu and len(self.window.perspectives) > 0:
            groups.append(Group(PerspectiveMenuManager(window=self.window)))

        # Add a group containing a 'toggler' for all visible views.
        self._view_group = self._create_view_group(self.window)
        groups.append(self._view_group)

        # Add a group containing an 'Other...' item that will launch a dialog
        # to allow the user to choose a view to show.
        groups.append(self._create_other_group(self.window))

        return groups
Esempio n. 14
0
    def _groups_default(self):
        """ Trait initialiser.
        """
#        groups = super(PylonViewMenuManager, self)._groups_default()

        groups = []

        new_group = Group(id="NewGroup")
        new_group.append(NewWindowAction(window=self.window))
        # FIXME: Changing the enabled trait of the NewEditorAction causes barf
#        new_group.append(NewEditorAction(window=self.window))
        # Insert a group for new part actions
        groups.append(new_group)

        # Add a group for view and perspective sub menus
        submenu_group = Group(id="SubMenuGroup")

        # Add the perspective menu (if requested).
        if self.show_perspective_menu and len(self.window.perspectives) > 0:
            perspective_menu = PerspectiveMenuManager(window=self.window)
            submenu_group.append(perspective_menu)

        # TODO: Create a ViewMenuManager with a selection of views
        view_submenu = MenuManager(self._create_other_group(self.window),
            name="Show View")
        submenu_group.append(view_submenu)
        groups.append(submenu_group)

        # Add a group containing a 'toggler' for all visible views.
        self._view_group = self._create_view_group(self.window)
        groups.append(self._view_group)

        # Add a group containing the preferences action
        groups.append( Group(PreferencesAction(window=self.window)) )

        return groups
Esempio n. 15
0
    def get_context_menu(self, node):
        """ Returns the context menu for a node. """

        sat = Group(id='SystemActionsTop')
        nsa = Group(id='NodeSpecificActions')
        sab = Group(id='SystemActionsBottom')

        # The 'New' menu.
        new_actions = self.get_new_actions(node)
        if new_actions is not None and len(new_actions) > 0:
            sat.append(MenuManager(name='New', *new_actions), )

        # Node-specific actions.
        actions = self.get_actions(node)
        if actions is not None and len(actions) > 0:
            for item in actions:
                nsa.append(item)

        # System actions (actions available on ALL nodes).
        system_actions = self.node_manager.system_actions
        if len(system_actions) > 0:
            for item in system_actions:
                sab.append(item)

        context_menu = MenuManager(sat, nsa, sab)
        context_menu.dump()

        return context_menu
Esempio n. 16
0
 def _actions_default(self):
     return [
         Group(
             Action(
                 image=ImageResource(
                     '16x16/x-axis',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip="View along the -X axis",
                 on_perform=self.x_minus_view,
             ),
             Action(
                 image=ImageResource(
                     '16x16/x-axis',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip="View along the +X axis",
                 on_perform=self.x_plus_view,
             ),
             Action(
                 image=ImageResource(
                     '16x16/y-axis',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip="View along the -Y axis",
                 on_perform=self.y_minus_view,
             ),
             Action(
                 image=ImageResource(
                     '16x16/y-axis',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip="View along the +Y axis",
                 on_perform=self.y_plus_view,
             ),
             Action(
                 image=ImageResource(
                     '16x16/z-axis',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip="View along the -Z axis",
                 on_perform=self.z_minus_view,
             ),
             Action(
                 image=ImageResource(
                     '16x16/z-axis',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip="View along the +Z axis",
                 on_perform=self.z_plus_view,
             ),
             Action(
                 image=ImageResource(
                     '16x16/isometric',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip="Obtain an isometric view",
                 on_perform=self.isometric_view,
             ),
         ),
         Group(
             Action(
                 image=ImageResource(
                     '16x16/parallel',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip='Toggle parallel projection',
                 style="toggle",
                 on_perform=self._toggle_projection,
                 checked=self.parallel_projection,
             ),
             Action(
                 image=ImageResource(
                     '16x16/origin_glyph',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip='Toggle axes indicator',
                 style="toggle",
                 enabled=(self.marker is not None),
                 on_perform=self._toggle_axes,
                 checked=self.show_axes,
             ),
             Action(
                 image=ImageResource(
                     '16x16/fullscreen',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip=
                 'Full Screen (press "q" or "e" or ESC to exit fullscreen)',
                 style="push",
                 on_perform=self._full_screen_fired,
             ),
         ),
         Group(
             Action(
                 image=ImageResource(
                     '16x16/save',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip="Save a snapshot of this scene",
                 on_perform=self._save_snapshot,
             ),
             Action(
                 image=ImageResource(
                     '16x16/configure',
                     search_path=[self._get_image_path()],
                 ),
                 tooltip='Configure the scene',
                 style="push",
                 on_perform=self._configure_scene,
             ),
         ),
     ]
Esempio n. 17
0
#------------------------------------------------------------------------------
# Standard library imports.
import os, sys

# Put the Enthought library on the Python path.
sys.path.append(os.path.abspath(r'..\..\..'))

# Local imports.
from enthought.pyface.action.api import Action
from enthought.pyface.action.api import Group, MenuManager, Separator


file_menu = MenuManager(
    Group(
        Action(name='New Project...'),
        Action(name='Open Project...'),

        id = 'OpenGroup',
    ),

    Group(
        Action(name='Close Project'),
        Action(name='Close Active Editor'),

        id = 'CloseGroup'
    ),

    Group(
        Action(name='Export to HTML...'),
        Action(name='Print...'),

        id = 'ExportGroup'
Esempio n. 18
0
    def __init__(self, **traits):
        """Initialise the object."""

        pm = get_permissions_manager()

        # Put them in a group so we can optionally append (because the PyFace
        # API doesn't do what you expect with append()).
        group = Group()

        group.append(LoginAction())

        for act in pm.user_manager.user_actions:
            group.append(act)

        group.append(LogoutAction())

        for act in pm.user_manager.management_actions:
            group.append(act)

        for act in pm.policy_manager.management_actions:
            group.append(act)

        super(UserMenuManager, self).__init__(group, **traits)
Esempio n. 19
0
    def __init__(self, **traits):
        """Initialise the object."""

        pm = get_permissions_manager()

        # Put them in a group so we can optionally append (because the PyFace
        # API doesn't do what you expect with append()).
        group = Group()

        group.append(LoginAction())

        for act in pm.user_manager.user_actions:
            group.append(act)

        group.append(LogoutAction())

        for act in pm.user_manager.management_actions:
            group.append(act)

        for act in pm.policy_manager.management_actions:
            group.append(act)

        super(UserMenuManager, self).__init__(group, **traits)