Skip to content


Fix moving a menu corrupting the menu
Browse files Browse the repository at this point in the history
  • Loading branch information
gm10 authored and raveit65 committed Mar 11, 2019
1 parent 7a677fe commit 30caedb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Mozo/
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def save(self, from_loading=False):
with, menu).path, 'w', 'utf-8') as f:
f.write(getattr(self, menu).dom.toprettyxml())
if not from_loading:

def quit(self):
Expand Down Expand Up @@ -425,11 +426,9 @@ def moveMenu(self, menu, new_parent, before=None, after=None):
if menu.get_parent() != new_parent:
dom = self.__getMenu(menu).dom
path = self.__getPath(menu)
root_path = path[0]
xml_root = self.__getXmlMenu(root_path, dom.documentElement, dom)
old_path = path[1:]
new_path = self.__getPath(new_parent)[1:] + [menu.get_menu_id()]
self.__addXmlMove(xml_root, '/'.join(old_path), '/'.join(new_path), dom)
xml_root = self.__getXmlMenu(path[0], dom.documentElement, dom)
new_path = self.__getPath(new_parent) + [menu.get_menu_id()]
self.__addXmlMove(xml_root, '/'.join(path), '/'.join(new_path), dom)
self.__positionItem(new_parent, menu, before, after)
Expand Down Expand Up @@ -578,6 +577,8 @@ def __getXmlMenuPart(self, element, name):
return None

def __getXmlMenu(self, path, element, dom):
if isinstance(path, str):
return element
for name in path:
found = self.__getXmlMenuPart(element, name)
if found is not None:
Expand Down

0 comments on commit 30caedb

Please sign in to comment.