diff options
author | gm10 <[email protected]> | 2019-08-11 23:55:34 +0200 |
---|---|---|
committer | Victor Kareh <[email protected]> | 2019-08-11 23:52:21 -0400 |
commit | 65283e661834a7282cac64b0c3442218bca1d618 (patch) | |
tree | 2d3dc362ba8ceef67424f7b31629e88be8c4d3bd /Mozo/MenuEditor.py | |
parent | f03bd64e19284b73182a32df5435a6d85c027935 (diff) | |
download | mozo-65283e661834a7282cac64b0c3442218bca1d618.tar.bz2 mozo-65283e661834a7282cac64b0c3442218bca1d618.tar.xz |
moveItem: Remove redundant code, add missing check for move mode when merging entries
Diffstat (limited to 'Mozo/MenuEditor.py')
-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): |