def on_right_up(self, event): """[summary] Arguments: event {[type]} -- [description] """ menu = wx.Menu() util.menu_item(menu, 'Open Link', self.on_open_link) util.menu_item(menu, 'Copy Link', self.on_copy_link) self.PopupMenu(menu, event.GetPosition())
def on_right_up(self, event): menu = wx.Menu() util.menu_item(menu, 'Open Link', self.on_open_link) util.menu_item(menu, 'Copy Link', self.on_copy_link) self.PopupMenu(menu, event.GetPosition())
def create_context_menu(self, control): selection = bool(control.GetSelectedText()) menu = wx.Menu() util.menu_item(self, menu, 'Cut', self.on_cut, 'cut.png').Enable(selection) util.menu_item(self, menu, 'Copy', self.on_copy, 'page_copy.png').Enable(selection) util.menu_item(self, menu, 'Paste', self.on_paste, 'paste_plain.png').Enable(control.CanPaste()) util.menu_item(self, menu, 'Delete', self.on_delete, 'delete.png').Enable(selection) menu.AppendSeparator() util.menu_item(self, menu, 'Select All', self.on_select_all, 'table_go.png') menu.AppendSeparator() util.menu_item(self, menu, 'Mark Selection', self.on_mark_text, 'pencil_add.png').Enable(selection) util.menu_item(self, menu, 'Unmark Selection', self.on_unmark_text, 'blank.png').Enable(selection) util.menu_item(self, menu, 'Unmark All', self.on_unmark_all, 'pencil_delete.png').Enable(bool(control._markers)) return menu
def create_menu(self): menubar = wx.MenuBar() file = self.create_file_menu() menubar.Append(file, '&File') edit = wx.Menu() util.menu_item(self, edit, '&Undo\tCtrl+Z', self.on_undo, 'arrow_undo.png') util.menu_item(self, edit, '&Redo\tCtrl+Y', self.on_redo, 'arrow_redo.png') edit.AppendSeparator() util.menu_item(self, edit, 'Cut\tCtrl+X', self.on_cut, 'cut.png') util.menu_item(self, edit, 'Copy\tCtrl+C', self.on_copy, 'page_copy.png') util.menu_item(self, edit, 'Paste\tCtrl+V', self.on_paste, 'paste_plain.png') util.menu_item(self, edit, 'Delete\tDel', self.on_delete, 'delete.png') edit.AppendSeparator() util.menu_item(self, edit, 'Select All\tCtrl+A', self.on_select_all, 'table_go.png') edit.AppendSeparator() util.menu_item(self, edit, 'Indent\tTab', self.on_indent, 'text_indent.png') util.menu_item(self, edit, 'Unindent\tShift+Tab', self.on_unindent, 'text_indent_remove.png') util.menu_item(self, edit, 'Toggle Comment\tCtrl+/', self.on_comment, 'text_padding_left.png') edit.AppendSeparator() util.menu_item(self, edit, 'Sort', self.on_sort, 'arrow_down.png') util.menu_item(self, edit, 'Lowercase', self.on_lowercase, 'text_lowercase.png') util.menu_item(self, edit, 'Uppercase', self.on_uppercase, 'text_uppercase.png') menubar.Append(edit, '&Edit') search = wx.Menu() util.menu_item(self, search, 'Find...\tCtrl+F', self.on_find, 'find.png') util.menu_item(self, search, 'Find Next\tF3', self.on_find_next, 'page_white_put.png') util.menu_item(self, search, 'Find Previous\tCtrl+F3', self.on_find_previous, 'page_white_get.png') util.menu_item(self, search, 'Find In Files...\tCtrl+Shift+F', self.on_event, 'magnifier.png').Enable(False) util.menu_item(self, search, 'Replace...\tCtrl+H', self.on_replace, 'text_replace.png') util.menu_item(self, search, 'Goto Line...\tCtrl+G', self.on_goto_line, 'text_linespacing.png') search.AppendSeparator() util.menu_item(self, search, 'Mark Selection', self.on_mark_text, 'pencil_add.png') util.menu_item(self, search, 'Unmark Selection', self.on_unmark_text, 'blank.png') util.menu_item(self, search, 'Unmark All', self.on_unmark_all, 'pencil_delete.png') menubar.Append(search, '&Search') view = wx.Menu() util.menu_item(self, view, 'Next Tab\tCtrl+Tab', self.on_next_tab, 'arrow_right.png') util.menu_item(self, view, 'Previous Tab\tCtrl+Shift+Tab', self.on_previous_tab, 'arrow_left.png') view.AppendSeparator() util.menu_item(self, view, 'Toggle Word Wrap', self.on_word_wrap, 'text_padding_bottom.png') util.menu_item(self, view, 'Toggle Class Browser', self.on_class_browser, 'blank.png') menubar.Append(view, '&View') tools = wx.Menu() util.menu_item(self, tools, 'Options...', self.on_event, 'cog.png').Enable(False) util.menu_item(self, tools, 'Fonts && Colors...', self.on_styles, 'palette.png') tools.AppendSeparator() util.menu_item(self, tools, 'Record Macro\tCtrl+Shift+R', self.on_record_macro, 'bullet_red.png') util.menu_item(self, tools, 'Play Macro\tCtrl+Shift+P', self.on_play_macro, 'control_play.png') util.menu_item(self, tools, 'Play Macro to End of File', self.on_play_macro_to_end, 'control_end.png') menubar.Append(tools, '&Tools') help = wx.Menu() util.menu_item(self, help, 'About %s...' % settings.APP_NAME, self.on_about, 'information.png') menubar.Append(help, '&Help') self.SetMenuBar(menubar)
def create_file_menu(self): file = wx.Menu() util.menu_item(self, file, '&New\tCtrl+N', self.on_new, 'page.png') util.menu_item(self, file, '&Open...\tCtrl+O', self.on_open, 'folder_page.png') util.menu_item(self, file, '&Save\tCtrl+S', self.on_save, 'disk.png') util.menu_item(self, file, '&Save As...\tCtrl+Shift+S', self.on_save_as, 'blank.png') util.menu_item(self, file, 'Save All', self.on_save_all, 'disk_multiple.png') file.AppendSeparator() util.menu_item(self, file, 'Close\tCtrl+F4', self.on_close_tab, 'page_delete.png') util.menu_item(self, file, 'Close All\tCtrl+Shift+F4', self.on_close_tabs, 'blank.png') file.AppendSeparator() util.menu_item(self, file, 'Reload', self.on_reload, 'arrow_refresh_small.png') #util.menu_item(self, file, 'Rename...', self.on_event, 'drive_edit.png') util.menu_item(self, file, 'Delete From Disk', self.on_delete_file, 'cross.png') file.AppendSeparator() util.menu_item(self, file, 'Print...\tCtrl+P', self.on_event, 'printer.png').Enable(False) file.AppendSeparator() recent_files = self.get_recent_files() if recent_files and settings.SHOW_RECENT_FILES: for path in recent_files: text = util.abbreviate(path, 60) item = util.menu_item(self, file, text, self.on_open_recent, 'blank.png') item.SetHelp(path) file.AppendSeparator() util.menu_item(self, file, 'Open All Recent Documents', self.on_open_all_recent, 'folder_star.png') util.menu_item(self, file, 'Clear Recent Documents', self.on_clear_recent, 'blank.png') file.AppendSeparator() util.menu_item(self, file, '&Exit\tAlt+F4', self.on_exit, 'door_out.png') return file
def create_tab_menu(self): menu = wx.Menu() util.menu_item(self, menu, 'Close', self.on_close_tab, 'page_delete.png') util.menu_item(self, menu, 'Close Others', self.on_close_other_tabs, 'blank.png') util.menu_item(self, menu, 'Close All', self.on_close_tabs, 'blank.png') menu.AppendSeparator() util.menu_item(self, menu, 'Save', self.on_save, 'disk.png') util.menu_item(self, menu, 'Save As...', self.on_save_as, 'blank.png') menu.AppendSeparator() util.menu_item(self, menu, 'Open Containing Folder', self.on_containing_folder, 'folder.png') return menu