diff options
author | gm10 <[email protected]> | 2019-08-11 23:55:34 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-09-12 17:52:12 +0200 |
commit | bf2767f66437fb7d9f2c21fd9a3d1f9fa15f8bf8 (patch) | |
tree | 3aefb8e5d9944d16d41a2d5dbad5ce301e49bfa8 | |
parent | 30e99493fcbe7018c5d90310fab81e9d3cd10c5e (diff) | |
download | mozo-bf2767f66437fb7d9f2c21fd9a3d1f9fa15f8bf8.tar.bz2 mozo-bf2767f66437fb7d9f2c21fd9a3d1f9fa15f8bf8.tar.xz |
moveItem: Remove redundant code, add missing check for move mode when merging entries
-rw-r--r-- | Mozo/MenuEditor.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Mozo/MenuEditor.py b/Mozo/MenuEditor.py index 1db4feb..738456f 100644 --- a/Mozo/MenuEditor.py +++ b/Mozo/MenuEditor.py @@ -411,17 +411,18 @@ class MenuEditor(object): undo = [] if item.get_parent() != new_parent: # create new item - file_id = self.copyItem(item, new_parent) + self.copyItem(item, new_parent) # hide old item self.deleteItem(item) - item = ('Item', file_id) - self.__positionItem(new_parent, item, before, after) + else: + self.__positionItem(new_parent, item, before, after) undo.append(self.__getMenu(new_parent)) self.__addUndo(undo) - # merge the undo entries created by the previous operations in the - # correct order so we can undo in one go - items = self.__undo.pop()[::-1] + self.__undo.pop()[::-1] + self.__undo.pop()[::-1] - self.__undo.append(items[::-1]) + if item.get_parent() != new_parent: + # merge the undo entries created by the previous operations in the + # correct order so we can undo in one go + items = self.__undo.pop()[::-1] + self.__undo.pop()[::-1] + self.__undo.pop()[::-1] + self.__undo.append(items[::-1]) self.save() def moveMenu(self, menu, new_parent, before=None, after=None): |