Ejemplo n.º 1
0
    def _create_my_menu_bar(self):
        """ Creates the window's menu bar. """

        self.menu_bar_manager = MenuBarManager(
            MenuManager(
                SaveImageAction(self),
                Separator(),
                ExitAction(self),
                name='&File',
            ), MenuManager(
                SaveToClipboardAction(self),
                name='&Edit',
            ),
            MenuManager(
                SpecialViewAction(self, "&Reset Zoom", 'reset_zoom'),
                Separator(),
                SpecialViewAction(self, "&Isometric", 'isometric_view'),
                SpecialViewAction(self, "&X positive", 'x_plus_view'),
                SpecialViewAction(self, "X negative", 'x_minus_view'),
                SpecialViewAction(self, "&Y positive", 'y_plus_view'),
                SpecialViewAction(self, "Y negative", 'y_minus_view'),
                SpecialViewAction(self, "&Z positive", 'z_plus_view'),
                SpecialViewAction(self, "Z negative", 'z_minus_view'),
                name='&View',
            ))
Ejemplo n.º 2
0
def create_ivtk_menu(obj):
    """Creates a menu bar suitable for all IVTK windows.

    Parameters
    ----------

    - obj : A Pyface application window.

      This is the window which requires the menu items.
    """

    menu_bar_manager = MenuBarManager(
        MenuManager(
            SaveImageAction(obj),
            Separator(),
            ExitAction(obj),
            name='&File',
        ), MenuManager(
            SaveToClipboardAction(obj),
            name='&Edit',
        ),
        MenuManager(
            SpecialViewAction(obj, "&Reset Zoom", 'reset_zoom'),
            Separator(),
            SpecialViewAction(obj, "&Isometric", 'isometric_view'),
            SpecialViewAction(obj, "&X positive", 'x_plus_view'),
            SpecialViewAction(obj, "X negative", 'x_minus_view'),
            SpecialViewAction(obj, "&Y positive", 'y_plus_view'),
            SpecialViewAction(obj, "Y negative", 'y_minus_view'),
            SpecialViewAction(obj, "&Z positive", 'z_plus_view'),
            SpecialViewAction(obj, "Z negative", 'z_minus_view'),
            name='&View',
        ))
    return menu_bar_manager
Ejemplo 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
Ejemplo n.º 4
0
    def __init__(self, **traits):
        """ Creates a new application window. """

        # Base class constructor.
        super(MainWindow, self).__init__(**traits)

        # Add a menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(
                Action(name='E&xit', on_perform=self.close),
                name='&File',
            ))

        # Add a menu bar at each location.
        self.add_tool_bar(
            ToolBarManager(Action(name='Foo'), orientation='horizontal'))

        self.add_tool_bar(ToolBarManager(Action(name='Bar'),
                                         orientation='horizontal'),
                          location='bottom')

        self.add_tool_bar(ToolBarManager(Action(name='Baz'),
                                         orientation='vertical'),
                          location='left')

        self.add_tool_bar(ToolBarManager(Action(name='Buz'),
                                         orientation='vertical'),
                          location='right')

        return
Ejemplo n.º 5
0
    def __init__(self, **traits):
        """ Creates a new application window. """

        # Base class constructor.
        super(MainWindow, self).__init__(**traits)

        # Create an action that exits the application.
        exit_action = Action(name='E&xit', on_perform=self.close)

        # Add a menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(exit_action, name='&File'))

        # Add some tool bars.
        self.tool_bar_managers = [
            ToolBarManager(exit_action,
                           name='Tool Bar 1',
                           show_tool_names=False),
            ToolBarManager(exit_action,
                           name='Tool Bar 2',
                           show_tool_names=False),
            ToolBarManager(exit_action,
                           name='Tool Bar 3',
                           show_tool_names=False),
        ]

        # Add a status bar.
        self.status_bar_manager = StatusBarManager()
        self.status_bar_manager.message = 'Example application window'

        return
Ejemplo n.º 6
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")
Ejemplo n.º 7
0
    def __scripts_menu_default(self):
        """ Trait initialiser. """

        # ZZZ: This is temporary until we put the script into a view.
        get_script_manager().on_trait_event(self._on_script_updated,
                'script_updated')

        return MenuManager(StartRecordingAction(), StopRecordingAction(),
                name="&Scripts")
Ejemplo n.º 8
0
    def _menu_bar_manager_default(self):
        """Trait initializer."""

        file_menu = MenuManager(self._new_person_action, self._exit_action,
                name='&File', id='FileMenu')
        view_menu = ViewMenuManager(name='&View', id='ViewMenu', window=self)
        user_menu = UserMenuManager(id='UserMenu', window=self)

        return MenuBarManager(file_menu, view_menu, user_menu, window=self)
Ejemplo n.º 9
0
    def __init__(self, **traits):
        """ Creates a new application window. """

        # Base class constructor.
        super(MainWindow, self).__init__(**traits)

        # Add a menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(
                Action(name='E&xit', on_perform=self.close),
                name='&File',
            ))

        return
Ejemplo n.º 10
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")
Ejemplo n.º 11
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")
Ejemplo n.º 12
0
    def _create_action_bars(self):
        """ Creates the window's menu, tool and status bars. """

        # Common actions.
        highest = Action(name='Highest', style='radio')
        higher = Action(name='Higher', style='radio', checked=True)
        lower = Action(name='Lower', style='radio')
        lowest = Action(name='Lowest', style='radio')

        self._actions = [highest, higher, lower, lowest]

        # Menu bar.
        self.menu_bar_manager = MenuBarManager(
            MenuManager(
                ExampleAction(name='Foogle'),
                Separator(),
                highest,
                higher,
                lower,
                lowest,
                Separator(),
                Action(name='E&xit', on_perform=self.close),
                name='&File',
            ))

        # Tool bar.
        self.tool_bar_manager = ToolBarManager(ExampleAction(name='Foo'),
                                               Separator(),
                                               ExampleAction(name='Bar'),
                                               Separator(),
                                               ExampleAction(name='Baz'),
                                               Separator(), highest, higher,
                                               lower, lowest)

        # Status bar.
        self.status_bar_manager = StatusBarManager()

        return
Ejemplo n.º 13
0
    def __file_menu_default(self):
        """ Trait initialiser. """

        return MenuManager(self._exit_action, name="&File")
Ejemplo n.º 14
0

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'
    ),

    Group(
        Action(name='Exit'),

        id = 'ExitGroup'
    ),
)
file_menu.dump()