summaryrefslogtreecommitdiff
path: root/Mozo/MenuEditor.py
diff options
context:
space:
mode:
authorgm10 <[email protected]>2019-08-11 23:55:34 +0200
committerVictor Kareh <[email protected]>2019-08-11 23:52:21 -0400
commit65283e661834a7282cac64b0c3442218bca1d618 (patch)
tree2d3dc362ba8ceef67424f7b31629e88be8c4d3bd /Mozo/MenuEditor.py
parentf03bd64e19284b73182a32df5435a6d85c027935 (diff)
downloadmozo-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.py15
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):