diff options
Diffstat (limited to 'Mozo/MenuEditor.py')
-rw-r--r-- | Mozo/MenuEditor.py | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/Mozo/MenuEditor.py b/Mozo/MenuEditor.py index 623f3c0..7474dcd 100644 --- a/Mozo/MenuEditor.py +++ b/Mozo/MenuEditor.py @@ -47,7 +47,7 @@ class MenuEditor: self.applications.dom = xml.dom.minidom.parseString(util.getUserMenuXml(self.applications.tree)) else: self.applications.dom = xml.dom.minidom.parse(self.applications.path) - self.__remove_whilespace_nodes(self.applications.dom) + util.removeWhitespaceNodes(self.applications.dom) self.settings = Menu() self.settings.tree = matemenu.lookup_tree('mate-settings.menu', matemenu.FLAGS_SHOW_EMPTY|matemenu.FLAGS_INCLUDE_EXCLUDED|matemenu.FLAGS_INCLUDE_NODISPLAY|matemenu.FLAGS_SHOW_ALL_SEPARATORS) @@ -59,7 +59,7 @@ class MenuEditor: self.settings.dom = xml.dom.minidom.parseString(util.getUserMenuXml(self.settings.tree)) else: self.settings.dom = xml.dom.minidom.parse(self.settings.path) - self.__remove_whilespace_nodes(self.settings.dom) + util.removeWhitespaceNodes(self.settings.dom) self.save(True) @@ -98,7 +98,7 @@ class MenuEditor: menu.dom = xml.dom.minidom.parseString(util.getUserMenuXml(menu.tree)) else: menu.dom = xml.dom.minidom.parse(menu.path) - self.__remove_whilespace_nodes(menu.dom) + util.removeWhitespaceNodes(menu.dom) #reset undo/redo, no way to recover from this self.__undo, self.__redo = [], [] self.save() @@ -132,7 +132,7 @@ class MenuEditor: menu.dom = xml.dom.minidom.parseString(util.getUserMenuXml(menu.tree)) else: menu.dom = xml.dom.minidom.parse(menu.path) - self.__remove_whilespace_nodes(menu.dom) + util.removeWhitespaceNodes(menu.dom) self.__redo.append(redo) def redo(self): @@ -156,7 +156,7 @@ class MenuEditor: menu.dom = xml.dom.minidom.parseString(util.getUserMenuXml(menu.tree)) else: menu.dom = xml.dom.minidom.parse(menu.path) - self.__remove_whilespace_nodes(menu.dom) + util.removeWhitespaceNodes(menu.dom) self.__undo.append(undo) def getMenus(self, parent=None): @@ -597,18 +597,6 @@ class MenuEditor: if child.nodeName in name: yield child - def __remove_whilespace_nodes(self, node): - remove_list = [] - for child in node.childNodes: - if child.nodeType == xml.dom.minidom.Node.TEXT_NODE: - child.data = child.data.strip() - if not child.data.strip(): - remove_list.append(child) - elif child.hasChildNodes(): - self.__remove_whilespace_nodes(child) - for node in remove_list: - node.parentNode.removeChild(node) - def __addXmlMove(self, element, old, new, dom): if not self.__undoMoves(element, old, new, dom): node = dom.createElement('Move') |