def __on_new_editor(self, editor): menu = editor.getMenu('Languages') for action in menu.actions(): if action.text() == self.tr("Python2"): action.trigger() else: action.setChecked(False) itemstoHide = ['Revert to last saved state', 'Check spelling...', 'Check spelling of selection...', 'Remove from dictionary', 'Shorten empty lines', 'Languages', 'Encodings', 'End-of-Line Type', 'Use Monospaced Font', 'New Document View', 'New Document View (with new split)', 'Close', 'Re-Open With Encoding', 'Save', 'Save As...', 'Save Copy...'] UiHelper.hideWidgetActions(editor.menu, itemstoHide)
def __setupMenu(self): """ Private method that hides pro-level menus and makes the others non-detachable. """ # hide unused menus for menu in ["debug", "start", "unittest", "multiproject"]: UiHelper.hideUnusedMenu(self.__ui, menu) # make menus non-detachable for menu in [ "file", "edit", "view", "project", "extras", "settings", "window", "bookmarks", "plugins", "help", "subwindow", "toolbars", "wizards", "macros" ]: UiHelper.setMenuNonDetachable(self.__ui, menu) toRemove = { "file": ["New &Window"], "edit": [ "Clear", "C&omment", "Unco&mment", "Stream Comment", "Box Comment" ], "view": ["Zoom &in", "Zoom &out", "Zoom &reset", "&Zoom", "Preview"], "project": ["Debugger", "&Version Control"], "extras": ["&Builtin Tools"], "settings": [ "Manage SSL Certificates...", "Reload &APIs", "&View Profiles...", "Edit Message Filters..." ], "subwindow": [ "&Multiproject-Viewer", "Templ&ate-Viewer", "S&ymbols-Viewer", "&Debug-Viewer", "Co&operation-Viewer", "&IRC" ], "help": [ "&Helpviewer...", "&Eric API Documentation", "&Pymakr API Documentation", "Python &3 Documentation", "Python &2 Documentation", "Qt&4 Documentation", "Qt&5 Documentation", "PyQt&4 Documentation", "PyQt&5 Documentation", "&About Pymakr", "About &Qt" ], "plugins": ["Configure..."] } for menu, items in toRemove.iteritems(): UiHelper.removeWidgetActions(self.__ui.getMenu(menu), items) toHide = { "window": ["&Right Sidebar", "Edit Profile", "Debug Profile"], } for menu, items in toHide.iteritems(): UiHelper.hideWidgetActions(self.__ui.getMenu(menu), items) # add help entries self.__addLinksIntoHelp()
def __on_new_editor(self, editor): itemstoHide = [ "Autosave enabled", "Typing aids enabled", "Automatic Completion enabled", "Complete", "Calltip", "Check", "Show", "Diagrams", "Tools", "New Document View", "New Document View (with new split)", "Close", "Re-Open With Encoding", "Save", "Save As...", "Save Copy..." ] UiHelper.hideWidgetActions(editor.menu, itemstoHide)