Esempio n. 1
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
Esempio n. 2
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',
            ))
Esempio n. 3
0
    def set_common_menu_29(self):
        menubar = SMenuBar(
            SMenu(Separator(id="NewGroup", separator=False),
                  Separator(id="NewGroupEnd", separator=False),
                  Group(OpenAction(), id="OpenGroup"),
                  Separator(id="OpenGroupEnd", separator=False),
                  Separator(id="SaveGroupEnd", separator=False),
                  Group(ExitAction(), id="ExitGroup"),
                  id='File',
                  name='&File'),
            SMenu(PreferencesAction(), id='Edit', name='&Edit'),
            SMenu(AboutAction(), id='Help', name='&Help'),
        )
        app = wx.GetApp()
        # Create a fake task so we can use the menu creation routines
        window = TaskWindow(application=self.application)
        log.debug("OSXMenuBarPlugin: minimal menu extra items: %s" %
                  str(self.minimal_menu_actions))
        task = OSXMinimalTask(menu_bar=menubar,
                              window=window,
                              extra_actions=self.minimal_menu_actions)

        t = TaskActionManagerBuilder(task=task)
        mgr = t.create_menu_bar_manager()
        control = mgr.create_menu_bar(app)
        wx.MenuBar.MacSetCommonMenuBar(control)

        # Prevent wx from exiting when the last window is closed
        app.SetExitOnFrameDelete(False)
Esempio n. 4
0
 def get_actions_Menu_Bytes_HexModifyGroup(self):
     return [
         va.ZeroAction(),
         va.FFAction(),
         va.NOPAction(),
         va.SetValueAction(),
         Separator(),
         va.SetHighBitAction(),
         va.ClearHighBitAction(),
         va.BitwiseNotAction(),
         va.OrWithAction(),
         va.AndWithAction(),
         va.XorWithAction(),
         Separator(),
         va.LeftShiftAction(),
         va.RightShiftAction(),
         va.LeftRotateAction(),
         va.RightRotateAction(),
         va.ReverseBitsAction(),
         Separator(),
         va.AddValueAction(),
         va.SubtractValueAction(),
         va.SubtractFromAction(),
         va.MultiplyAction(),
         va.DivideByAction(),
         va.DivideFromAction(),
         Separator(),
         va.RampUpAction(),
         va.RampDownAction(),
         va.RandomBytesAction(),
         Separator(),
         va.ReverseSelectionAction(),
         va.ReverseGroupAction(),
     ]
Esempio n. 5
0
 def get_actions_Menu_Segment_ActionGroup(self):
     return [
         ba.GetSegmentFromSelectionAction(),
         ba.MultipleSegmentsFromSelectionAction(),
         ba.InterleaveSegmentsAction(),
         ba.SetSegmentOriginAction(),
         Separator(),
         va.AddCommentAction(),
         va.RemoveCommentAction(),
         va.AddLabelAction(),
         va.RemoveLabelAction(),
         SMenu(Group(ba.ImportSegmentLabelsAction(name="Import"),
                     id="sl1",
                     separator=True),
               Group(ba.ExportSegmentLabelsAction(
                   name="Export User Defined Labels"),
                     ba.ExportSegmentLabelsAction(
                         name="Export All Labels",
                         include_disassembly_labels=True),
                     id="sl2",
                     separator=True),
               id='segmentlabels1',
               separator=False,
               name="Manage Segment Labels"),
         Separator(),
         va.StartTraceAction(),
         va.AddTraceStartPointAction(),
         va.ApplyTraceSegmentAction(),
         va.ClearTraceAction(),
     ]
Esempio n. 6
0
    def build_menu(self):
        menu_entries = []
        if STYLE_EDITOR_ACTION_NAME in self.action_list:
            action = Action(name=STYLE_EDITOR_ACTION_NAME,
                            on_perform=self.request_style_editor)
            menu_entries.append(action)
            menu_entries.append(Separator())
        if FILE_EXPORT_ACTION_NAME in self.action_list:
            action = Action(name=FILE_EXPORT_ACTION_NAME,
                            on_perform=self.export_plot_to_file)
            menu_entries.append(action)
            menu_entries.append(Separator())

        if DELETE_ACTION_NAME in self.action_list:
            action = Action(name=DELETE_ACTION_NAME,
                            on_perform=self.request_delete)
            menu_entries.append(action)
            menu_entries.append(Separator())

        if CREATE_TEMPLATE_ACTION_NAME in self.action_list:
            action = Action(name=CREATE_TEMPLATE_ACTION_NAME,
                            on_perform=self.request_plot_template)
            menu_entries.append(action)
            menu_entries.append(Separator())

        menu = MenuManager(*menu_entries)
        return menu
Esempio n. 7
0
    def add_actions_and_groups(self, menu_items, location, menu_name,
                               group_name):
        actions = self.get_actions_wrapper(location, menu_name, group_name)

        groups = []
        group_suffix = ""
        group_index = 0
        current = []

        for item in actions:
            if isinstance(item, Group) or isinstance(item, SMenu):
                if current:
                    group = Group(*current,
                                  id="%s%s" % (group_name, group_suffix))
                    group_index += 1
                    group_suffix = str(group_index)
                    groups.append(group)
                    current = []
                groups.append(item)
            else:
                current.append(item)
        if current:
            group = Group(*current, id="%s%s" % (group_name, group_suffix))
            groups.append(group)

        menu_items.append(Separator(id="%sStart" % group_name,
                                    separator=False))
        for group in groups:
            menu_items.append(group)
        menu_items.append(Separator(id="%sEnd" % group_name, separator=False))
Esempio n. 8
0
 def get_actions_Menu_DiskImage_ActionGroup(self):
     return [
         ba.ExpandDocumentAction(),
         Separator(),
         ba.LoadBaselineVersionAction(),
         ba.FindNextBaselineDiffAction(),
         ba.FindPrevBaselineDiffAction(),
         ba.ListDiffAction(),
         Separator(),
         ba.SegmentGotoAction(),
     ]
Esempio n. 9
0
 def get_actions_Menu_View_ConfigGroup(self):
     category_actions = {}
     for v in self.known_viewers:
         cat = v.viewer_category
         if cat not in category_actions:
             category_actions[cat] = []
         category_actions[cat].append(ba.AddViewerAction(viewer=v))
     submenus = []
     sid = 1
     first = True
     for cat in sorted(category_actions.keys()):
         submenus.append(
             SMenu(Group(*category_actions[cat],
                         id="a%d" % sid,
                         separator=True),
                   id='ViewerChoiceSubmenu%d' % sid,
                   separator=first,
                   name="Add %s Viewer" % cat))
         sid += 1
         first = False
     submenus.extend([
         Separator(),
         ba.ViewDiffHighlightAction(),
         va.TextFontAction(),
     ])
     return submenus
Esempio n. 10
0
 def get_actions_Menu_File_SaveGroup(self):
     return [
         SaveAction(),
         SaveAsAction(),
         Separator(),
         SaveAsImageAction(),
     ]
Esempio n. 11
0
 def get_actions_Menu_Segment_ActionGroup(self):
     return [
         ba.GetSegmentFromSelectionAction(),
         ba.MultipleSegmentsFromSelectionAction(),
         ba.InterleaveSegmentsAction(),
         ba.SetSegmentOriginAction(),
         Separator(),
         ba.SegmentGotoAction(),
     ]
Esempio 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
Esempio n. 13
0
 def get_actions_Menu_Emulation_CommandGroup(self):
     return [
         ea.PauseResumeAction(),
         ea.PreviousSaveStateAction(),
         ea.NextSaveStateAction(),
         Separator(),
         ea.StepAction(),
         ea.StepIntoAction(),
         ea.StepOverAction(),
         ea.EndOfFrameAction(),
         ea.BreakVBIStart(),
         Separator(),
         ea.StartAction(),
         ea.SelectAction(),
         ea.OptionAction(),
         Separator(),
         ea.WarmstartAction(),
         ea.ColdstartAction(),
     ]
Esempio n. 14
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
Esempio n. 15
0
    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()

###############################################################################

file_menu = MenuManager(
    Action(name='New Project...'),
    Action(name='Open Project...'),
    Separator(),
    Action(name='Close Project'),
    Action(name='Close Active Editor'),
    Separator(),
    Action(name='Export to HTML...'),
    Action(name='Print...'),
    Separator(),
    Action(name='Exit'),
)
file_menu.dump()

###############################################################################


def new_project():
    print 'new project'