diff options
author | Jasper St. Pierre <[email protected]> | 2012-05-09 15:31:37 -0300 |
---|---|---|
committer | Alexei Sorokin <[email protected]> | 2016-08-22 23:03:32 +0300 |
commit | 41bebb09eec4c7087f7fd5ad0ae595af8401627e (patch) | |
tree | 0f5a283e549f2c65c3365c5f34f760627d47e757 /Mozo/MenuEditor.py | |
parent | e71b7979a236e4017c34a4b482ecd66c518ef4e2 (diff) | |
download | mozo-41bebb09eec4c7087f7fd5ad0ae595af8401627e.tar.bz2 mozo-41bebb09eec4c7087f7fd5ad0ae595af8401627e.tar.xz |
MenuEditor: put removeWhitespaceNodes somewhere else
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') |