diff options
author | mbkma <[email protected]> | 2021-08-19 09:35:23 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-09-02 18:47:09 +0200 |
commit | 1824bef1dec2cc271fba4f4047dd2f02d168ed1f (patch) | |
tree | 0bb27ca0960192c736aed4bbc4eaa76cb43a0b62 | |
parent | 558d88aa8346a5534b24c5c9362d63e8e473d769 (diff) | |
download | mozo-1824bef1dec2cc271fba4f4047dd2f02d168ed1f.tar.bz2 mozo-1824bef1dec2cc271fba4f4047dd2f02d168ed1f.tar.xz |
make the collection menu item removeable
-rw-r--r-- | Mozo/MenuEditor.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/Mozo/MenuEditor.py b/Mozo/MenuEditor.py index 947a2b7..892fab1 100644 --- a/Mozo/MenuEditor.py +++ b/Mozo/MenuEditor.py @@ -268,7 +268,6 @@ class MenuEditor(object): item_type = item_iter.next() def getContents(self, item): - class CollectionDirectoryException(Exception): pass contents = [] item_iter = item.iter() @@ -276,22 +275,18 @@ class MenuEditor(object): while item_type != MateMenu.TreeItemType.INVALID: item = None - try: - if item_type == MateMenu.TreeItemType.DIRECTORY: - item = item_iter.get_directory() - if item.get_menu_id() == 'Collection': raise CollectionDirectoryException() - elif item_type == MateMenu.TreeItemType.ENTRY: - item = item_iter.get_entry() - elif item_type == MateMenu.TreeItemType.HEADER: - item = item_iter.get_header() - elif item_type == MateMenu.TreeItemType.ALIAS: - item = item_iter.get_alias() - elif item_type == MateMenu.TreeItemType.SEPARATOR: - item = item_iter.get_separator() - if item: - contents.append(item) - except CollectionDirectoryException: - pass + if item_type == MateMenu.TreeItemType.DIRECTORY: + item = item_iter.get_directory() + elif item_type == MateMenu.TreeItemType.ENTRY: + item = item_iter.get_entry() + elif item_type == MateMenu.TreeItemType.HEADER: + item = item_iter.get_header() + elif item_type == MateMenu.TreeItemType.ALIAS: + item = item_iter.get_alias() + elif item_type == MateMenu.TreeItemType.SEPARATOR: + item = item_iter.get_separator() + if item: + contents.append(item) item_type = item_iter.next() return contents |