def on_splitter_layoutChanged(self): for action in self.menuFocusGroup.actions()[3:]: self.menuFocusGroup.removeAction(action) for action in self.menuMoveEditorToGroup.actions()[3:]: self.menuMoveEditorToGroup.removeAction(action) for index, group in enumerate(self.centralWidget().allGroups(), 1): # TODO: Estos shortcuts no son configurables action = create_action(self, { "text": "Group %d" % index, "sequence": ("Global", "Group %d" % index, "Ctrl+%d" % index), "triggered": lambda checked=False, group=group: self.setCurrentGroup(group) }) self.menuFocusGroup.addAction(action) action = create_action(self, { "text": "Group %d" % index, "sequence": ("Global", "Group %d" % index, "Shift+Ctrl+%d" % index), "triggered": lambda checked=False, group=group: self.moveEditorToGroup(group) }) self.menuMoveEditorToGroup.addAction(action)
def on_menuRecentFiles_aboutToShow(self): actions = self.menuRecentFiles.actions()[-3:] # TODO Algo mejor para no estar creando y matando actions como bestia for action in self.menuRecentFiles.actions(): if action not in actions: self.menuRecentFiles.removeAction(action) for index, filePath in enumerate(self.application.fileManager.fileHistory, 1): action = create_action(self, { "text": "%s (%s)\t&%d" % (self.application.fileManager.basename(filePath), filePath, index), "triggered": lambda file = filePath: self.application.openFile(file) }) self.menuRecentFiles.addAction(action) self.menuRecentFiles.addActions(actions)