def moveRight(self): """ 当前节点上移 """ parentItem = self.parent() row_position = self.row() if row_position<=0: return upperItem = parentItem.childItems[row_position-1] currentItem = parentItem.childItems.pop(self.row()) currentItem.parentItem = upperItem upperItem.childItems.append(currentItem) currentNote = currentItem.note() currentNote['parentId'] = upperItem.note()['id'] currentNote['position'] = currentItem.row() pimDb.update_note(currentNote)
def moveLeft(self): """ 当前节点上移 """ parentItem = self.parent() if parentItem ==None:return grandpaItem = parentItem.parent() if grandpaItem == None: return currentItem = parentItem.childItems.pop(self.row()) currentItem.parentItem = grandpaItem grandpaItem.childItems.append(currentItem) currentNote = currentItem.note() currentNote['parentId'] = grandpaItem.note()['id'] currentNote['position'] = currentItem.row() pimDb.update_note(currentNote)