def _menu_bar_default(self): return SMenuBar(SMenu(TaskAction(name='New', method='new', accelerator='Ctrl+N'), id='File', name='&File'), SMenu(DockPaneToggleGroup(), TaskToggleGroup(), id='View', name='&View'))
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)
class SecondTask(ExampleTask): """ A simple task for opening a blank editor. """ #### Task interface ####################################################### id = 'example.second_task' name = 'Second Multi-Tab Editor' menu_bar = SMenuBar( SMenu(TaskAction(name='New', method='new', accelerator='Ctrl+N'), id='File', name='&File'), SMenu(DockPaneToggleGroup(), TaskToggleGroup(), id='View', name='&View')) tool_bars = [ SToolBar(TaskAction(method='new', tooltip='New file', image=ImageResource('document_new')), image_size=(32, 32)), ] ########################################################################### # 'Task' interface. ########################################################################### def _default_layout_default(self): return TaskLayout(left=Tabbed(PaneItem('steps.first_pane'), PaneItem('steps.second_pane'), PaneItem('steps.third_pane')))
def get_actions_Menu_View_FontGroup(self): font_mapping_actions = self.get_font_mapping_actions() font_renderer_actions = [] for r in machine.predefined['font_renderer']: font_renderer_actions.append( va.FontRendererAction(font_renderer=r)) return [ SMenu(Group(va.UseFontAction(font=fonts.A8DefaultFont), va.UseFontAction(font=fonts.A8ComputerFont), va.UseFontAction(font=fonts.A2DefaultFont), va.UseFontAction(font=fonts.A2MouseTextFont), id="a1", separator=True), va.FontChoiceGroup(id="a2", separator=True), Group(va.LoadFontAction(), ba.GetFontFromSelectionAction(), id="a3", separator=True), id='mm5', separator=False, name="Font"), SMenu(Group(*font_renderer_actions, id="a1", separator=True), Group(*font_mapping_actions, id="a2", separator=True), id='mm6', separator=False, name="Character Display"), ]
def _menu_bar_default(self): """A menu bar with functions relevant to the Setup task. """ menu_bar = SMenuBar(SMenu(TaskToggleGroup(), id='File', name='&File'), SMenu(id='Edit', name='&Edit'), SMenu(TaskToggleGroup(), id='View', name='&View')) return menu_bar
class PythonShellTask(Task): """ A task which provides a simple Python Shell to the user. """ # Task Interface id = "pyface.tasks.contrib.python_shell" name = "Python Shell" # The list of bindings for the shell bindings = List(Dict) # The list of commands to run on shell startup commands = List(Str) # the IPythonShell instance that we are interacting with pane = Instance(PythonShellPane) # Task Interface menu_bar = SMenuBar( SMenu( TaskAction(name="Open...", method="open", accelerator="Ctrl+O"), id="File", name="&File", ), SMenu(id="View", name="&View"), ) def create_central_pane(self): """ Create a view pane with a Python shell """ logger.debug("Creating Python shell pane in central pane") self.pane = PythonShellPane(bindings=self.bindings, commands=self.commands) return self.pane # PythonShellTask API def open(self): """ Shows a dialog to open a file. """ logger.debug("PythonShellTask: opening file") dialog = FileDialog(parent=self.window.control, wildcard="*.py") if dialog.open() == OK: self._open_file(dialog.path) # Private API def _open_file(self, path): """ Execute the selected file in the editor's interpreter """ logger.debug('PythonShellTask: executing file "%s"' % path) self.pane.editor.execute_file(path)
class ExampleTask(Task): """ A simple task for opening a blank editor. """ #### Task interface ####################################################### id = 'example.example_task' name = 'Multi-Tab Editor' active_editor = Property(Instance(IEditor), depends_on='editor_area.active_editor') editor_area = Instance(IEditorAreaPane) menu_bar = SMenuBar( SMenu(TaskAction(name='New', method='new', accelerator='Ctrl+N'), id='File', name='&File'), SMenu(DockPaneToggleGroup(), id='View', name='&View')) tool_bars = [ SToolBar(TaskAction(method='new', tooltip='New file', image=ImageResource('document_new')), image_size=(32, 32)), ] ########################################################################### # 'Task' interface. ########################################################################### def create_central_pane(self): """ Create the central pane: the script editor. """ self.editor_area = EditorAreaPane() return self.editor_area ########################################################################### # 'ExampleTask' interface. ########################################################################### def new(self): """ Opens a new empty window """ editor = Editor() self.editor_area.add_editor(editor) self.editor_area.activate_editor(editor) self.activated() #### Trait property getter/setters ######################################## def _get_active_editor(self): if self.editor_area is not None: return self.editor_area.active_editor return None
def _menu_bar_default(self): return SMenuBar( SMenu( TaskAction(name="New", method="new", accelerator="Ctrl+N"), id="File", name="&File", ), SMenu( DockPaneToggleGroup(), TaskToggleGroup(), id="View", name="&View", ), )
class SecondTask(ExampleTask): """ A simple task for opening a blank editor. """ # Task interface ------------------------------------------------------- id = "example.second_task" name = "Second Multi-Tab Editor" menu_bar = SMenuBar( SMenu( TaskAction(name="New", method="new", accelerator="Ctrl+N"), id="File", name="&File", ), SMenu(DockPaneToggleGroup(), TaskToggleGroup(), id="View", name="&View"), ) tool_bars = [ SToolBar( TaskAction( method="new", tooltip="New file", image=ImageResource("document_new"), ), image_size=(32, 32), ) ] # ------------------------------------------------------------------------ # 'Task' interface. # ------------------------------------------------------------------------ def _default_layout_default(self): return TaskLayout(left=VSplitter( HSplitter( PaneItem("steps.pane1"), PaneItem("steps.pane2"), PaneItem("steps.pane3"), ), HSplitter( PaneItem("steps.pane4"), PaneItem("steps.pane5"), PaneItem("steps.pane6"), ), ))
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
def get_actions_Menu_Jumpman_LevelGroup(self): return [ SMenu(LevelListGroup(id="a2", separator=True), id='segmentlist1', separator=False, name="Edit Level"), ]
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(), ]
def file_menu(self): """ File menu schema. """ return SMenu( TaskAction( name="Open Workflow...", method="setup_task.open_workflow", enabled_name="setup_task.save_load_enabled", accelerator="Ctrl+O", ), TaskAction( id="Save", name="Save Workflow", method="setup_task.save_workflow", enabled_name="setup_task.save_load_enabled", accelerator="Ctrl+S", ), TaskAction( name="Save Workflow as...", method="setup_task.save_workflow_as", enabled_name="setup_task.save_load_enabled", accelerator="Shift+Ctrl+S", ), TaskAction(name="Plugins...", method="setup_task.open_plugins"), name="&File", )
def get_actions_Menu_Segment_ListGroup(self): return [ SMenu(ba.SegmentChoiceGroup(id="a2", separator=True), id='segmentlist1', separator=False, name="View Segment"), ]
def get_actions_Menu_DiskImage_ParserGroup(self): groups = [] for mime, pretty, parsers in iter_known_segment_parsers(): actions = [ ba.SegmentParserAction(segment_parser=s) for s in parsers ] if not pretty: groups.append( Group(ba.CurrentSegmentParserAction(), separator=True)) groups.append(Group(*actions, separator=True)) else: groups.append( SMenu(Group(*actions, separator=True), name=pretty)) return [ SMenu(*groups, id='submenu1', separator=False, name="File Type"), ]
def _extra_actions_default(self): """ Extra application-wide menu items This adds a collection of standard Tasks application menu items and groups to a Task's set of menus. Whether or not they actually appear depends on whether the appropriate menus are provided by the Task. These default additions assume that the window will hold an editor pane so that Ctrl-N and Ctrl-W will be bound to creating/closing new editors rather than new task windows. """ from pyface.action.api import ( AboutAction, CloseActiveWindowAction, ExitAction, ) from pyface.tasks.action.api import ( CreateTaskWindowAction, SchemaAddition, SMenu, TaskWindowToggleGroup, ) return [ SchemaAddition( factory=CreateTaskWindowAction.factory( application=self, accelerator="Ctrl+Shift+N"), path="MenuBar/File/new_group", ), SchemaAddition( id="close_action", factory=CloseActiveWindowAction.factory( application=self, accelerator="Ctrl+Shift+W"), path="MenuBar/File/close_group", ), SchemaAddition( id="exit_action", factory=ExitAction.factory(application=self), path="MenuBar/File/close_group", absolute_position="last", ), SchemaAddition( # id='Window', factory=lambda: SMenu( TaskWindowToggleGroup(application=self), id="Window", name="&Window", ), path="MenuBar", after="View", before="Help", ), SchemaAddition( id="about_action", factory=AboutAction.factory(application=self), path="MenuBar/Help", absolute_position="first", ), ]
def _menu_bar_default(self): menu_bar = SMenuBar( SMenu(SGroup(group_factory=DockPaneToggleGroup, id='tests.bogus_task.DockPaneToggleGroup'), id='View', name='&View')) return menu_bar
def get_actions_Menu_Help_DebugFrameworkGroup(self): return [ ShowLoggerAction(), SMenu(WidgetInspectorAction(), GarbageObjectsAction(), id="Debug", name="More Debugging"), ]
def get_actions_Menu_File_SaveGroup(self): return [ fa.SaveAction(), fa.SaveAsAction(), SMenu(ba.SaveSegmentGroup(), id='SaveSegmentAsSubmenu', name="Save Segment As"), fa.SaveAsImageAction(), ]
def get_actions_Menu_Edit_CopyPasteGroup(self): v = self.known_viewers[0] # any one will work copy_special_actions = [ cls() for cls in v.all_known_copy_special_actions(self) ] paste_special_actions = [ cls() for cls in v.all_known_paste_special_actions(self) ] return [ fa.CutAction(), fa.CopyAction(), SMenu(*copy_special_actions, id='copyspecial', name="Copy Special"), fa.PasteAction(), SMenu(*paste_special_actions, id='pastespecial', name="Paste Special"), ]
def get_actions_Menu_View_ProcessorGroup(self): actions = [] for r in machine.predefined['disassembler']: actions.append(va.ProcessorTypeAction(disassembler=r)) return [ SMenu(Group(*actions, id="a1", separator=True), id='mm1', separator=True, name="Processor"), ]
def get_actions_Menu_View_PredefinedGroup(self): actions = [] for m in machine.predefined['machine']: actions.append(va.PredefinedMachineAction(machine=m)) return [ SMenu(Group(*actions, id="a1", separator=True), id='MachineChoiceSubmenu1', separator=False, name="Predefined Machines"), ]
def get_actions_Menu_View_SizeGroup(self): return [ SMenu(Group(va.ViewerWidthAction(), va.ViewerZoomAction(), id="a1", separator=True), id='mm8', separator=False, name="Viewer Size"), ]
def get_actions_Menu_View_BitmapGroup(self): actions = [] for r in machine.predefined['bitmap_renderer']: actions.append(va.BitmapRendererAction(bitmap_renderer=r)) return [ SMenu(Group(*actions, id="a1", separator=True), id='mm7', separator=False, name="Bitmap Display"), ]
def get_actions_Menu_View_MemoryMapGroup(self): actions = [] for r in machine.predefined['memory_map']: actions.append(va.MemoryMapAction(memory_map=r)) return [ SMenu(Group(*actions, id="a1", separator=True), id='mm3', separator=False, name="Memory Map"), ]
def help_menu(self): """ Help menu schema. """ return SMenu(TaskAction(name="About WorkflowManager...", method="setup_task.open_about"), TaskAction(name="Online Documentation", method="setup_task.open_documentation"), TaskAction(name="BDSS Tutorial", method="setup_task.open_tutorial"), name="&Help", id='Help')
def _menu_bar_default(self): menu_bar = SMenuBar( SMenu( SGroup( group_factory=DockPaneToggleGroup, id="tests.bogus_task.DockPaneToggleGroup", ), id="View", name="&View", )) return menu_bar
def get_actions_Menu_View_AssemblerGroup(self): return [ SMenu(va.AssemblerChoiceGroup(id="a2", separator=True), Group(va.AddNewAssemblerAction(), va.EditAssemblersAction(), va.SetSystemDefaultAssemblerAction(), id="a3", separator=True), id='mm2', separator=False, name="Assembler Syntax"), ]
def get_actions_Menu_Edit_SelectGroup(self): return [ fa.SelectAllAction(), fa.SelectNoneAction(), fa.SelectInvertAction(), SMenu(ba.MarkSelectionAsCodeAction(), ba.MarkSelectionAsDataAction(), ba.MarkSelectionAsUninitializedDataAction(), ba.MarkSelectionAsDisplayListAction(), ba.MarkSelectionAsJumpmanLevelAction(), ba.MarkSelectionAsJumpmanHarvestAction(), id="mark1", name="Mark Selection As"), ]
def _osx_actions_default(self): from omnivore.framework.actions import NewFileGroup submenu = lambda: SMenu(id='NewFileSubmenu', name="New") actions = [ SchemaAddition(factory=submenu, path='MenuBar/File', before="OpenGroup"), SchemaAddition( factory=NewFileGroup, path='MenuBar/File/NewFileSubmenu', ), ] return actions