diff options
author | Thayne McCombs <astrothayne@gmail.com> | 2018-11-18 23:16:19 -0700 |
---|---|---|
committer | Thomas Kluyver <thomas@kluyver.me.uk> | 2020-10-18 13:16:18 +0000 |
commit | 91508d030f6952b6e7a571deda0e72b62d4b6aba (patch) | |
tree | 9d64649c55a790309dd516fe136cbc23d09c0e1d /xdg | |
parent | dca88c4f35ab7ca7f0bc6105f26968ab3b071076 (diff) |
Create a new array the Layout order
Instead of appending to the _default_order array.
Fixes #11
Diffstat (limited to 'xdg')
-rw-r--r-- | xdg/Menu.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/xdg/Menu.py b/xdg/Menu.py index 6aed383..1dd2af5 100644 --- a/xdg/Menu.py +++ b/xdg/Menu.py @@ -722,11 +722,12 @@ class XMLMenuBuilder(object): inline_header=_to_bool(node.attrib.get("inline_header", True)), inline_alias=_to_bool(node.attrib.get("inline_alias", False)) ) + order = [] for child in node: tag, text = child.tag, child.text text = text.strip() if text else None if tag == "Menuname" and text: - layout.order.append([ + order.append([ "Menuname", text, _to_bool(child.attrib.get("show_empty", False)), @@ -736,14 +737,15 @@ class XMLMenuBuilder(object): _to_bool(child.attrib.get("inline_alias", False)) ]) elif tag == "Separator": - layout.order.append(['Separator']) + order.append(['Separator']) elif tag == "Filename" and text: - layout.order.append(["Filename", text]) + order.append(["Filename", text]) elif tag == "Merge": - layout.order.append([ + order.append([ "Merge", child.attrib.get("type", "all") ]) + layout.order = order return layout def parse_move(self, node): |