Esempio n. 1
0
    def __undo_menu_default(self):
        """ Trait initialiser. """

        undo_manager = self.workbench.undo_manager

        undo_action = UndoAction(undo_manager=undo_manager)
        redo_action = RedoAction(undo_manager=undo_manager)

        return MenuManager(undo_action, redo_action, name="&Undo")
Esempio n. 2
0
    def __edit_menu_default(self):
        """ Initialize the Edit Menus.
        """
        undo_manager = self.workbench.undo_manager

        # fixme: Add cut/copy/paste.
        # fixme: Add Ctrl-Z Ctrl-Y short cuts here.
        undo_group = Group(UndoAction(undo_manager=undo_manager),
                           RedoAction(undo_manager=undo_manager))

        return MenuManager(undo_group, name="&Edit", id='EditMenu')
Esempio n. 3
0
    def _menu_bar_manager_default(self):
        # Create an action that exits the application.
        exit_action = Action(name='E&xit', on_perform=self.close)
        self.exit_action = exit_action
        file_menu = MenuManager(name='&File')
        file_menu.append(Group(exit_action))

        self.undo = UndoAction(undo_manager=self.undo_manager,
                               accelerator='Ctrl+Z')
        self.redo = RedoAction(undo_manager=self.undo_manager,
                               accelerator='Ctrl+Shift+Z')
        menu_bar_manager = MenuBarManager(
            file_menu, MenuManager(self.undo, self.redo, name='&Edit'))
        return menu_bar_manager
Esempio n. 4
0
 def _menu_bar_default(self):
     from apptools.undo.action.api import UndoAction, RedoAction
     menu_bar = SMenuBar(
         SMenu(
             SGroup(TaskAction(name="Import",
                               method='on_import',
                               accelerator='Ctrl+I'),
                    id='New',
                    name='New'),
             SGroup(TaskAction(name="Open",
                               method='on_open',
                               accelerator='Ctrl+O'),
                    id='Open',
                    name='Open'),
             SGroup(TaskAction(name="Save",
                               method='on_save',
                               accelerator='Ctrl+S',
                               enabled_name='dirty'),
                    TaskAction(name="Save As...",
                               method='on_save_as',
                               accelerator='Ctrl+Shift+S',
                               enabled_name='survey'),
                    id='Save',
                    name='Save'),
             id='File',
             name="&File",
         ),
         SMenu(
             # XXX can't integrate easily with TraitsUI editors :P
             SGroup(
                 UndoAction(undo_manager=self.undo_manager,
                            accelerator='Ctrl+Z'),
                 RedoAction(undo_manager=self.undo_manager,
                            accelerator='Ctrl+Shift+Z'),
                 id='UndoGroup',
                 name="Undo Group",
             ),
             SGroup(
                 TaskCommandAction(name='New Group',
                                   method='on_new_group',
                                   accelerator='Ctrl+Shift+N',
                                   command_stack_name='command_stack'),
                 TaskCommandAction(name='Delete Group',
                                   method='on_delete_group',
                                   accelerator='Ctrl+Delete',
                                   enabled_name='have_current_group',
                                   command_stack_name='command_stack'),
                 id='LineGroupGroup',
                 name="Line Group Group",
             ),
             id='Edit',
             name="&Edit",
         ),
         SMenu(
             SGroup(
                 TaskAction(name='Next Line',
                            method='on_next_line',
                            enabled_name='survey.survey_lines',
                            accelerator='Ctrl+Right'),
                 TaskCommandAction(name='Previous Line',
                                   method='on_previous_line',
                                   enabled_name='survey.survey_lines',
                                   accelerator='Ctrl+Left'),
                 id='LineGroup',
                 name='Line Group',
             ),
             SGroup(
                 CentralPaneAction(name='Location Data',
                                   method='on_show_location_data',
                                   enabled_name='show_view',
                                   accelerator='Ctrl+Shift+D'),
                 CentralPaneAction(name='Plot View Selection',
                                   method='on_show_plot_view_selection',
                                   enabled_name='show_view',
                                   accelerator='Ctrl+Shift+S'),
                 id='DataGroup',
                 name='Data Group',
             ),
             DockPaneToggleGroup(),
             id='View',
             name="&View",
         ),
         SMenu(
             SGroup(
                 CentralPaneAction(name='Image Adjustment',
                                   method='on_image_adjustment',
                                   enabled_name='show_view',
                                   accelerator='Ctrl+Shift+I'),
                 CentralPaneAction(name='Change Colormap',
                                   method='on_change_colormap',
                                   enabled_name='show_view'),
                 CentralPaneAction(name='Cursor Freeze Key = Alt+c',
                                   method='on_cursor_freeze',
                                   enabled_name='show_view'),
                 CentralPaneAction(name='Box zoom enable = z'),
                 id='ToolGroup',
                 name='Tool Group',
             ),
             id='Tools',
             name="&Tools",
         ),
     )
     return menu_bar