diff options
author | rbuj <[email protected]> | 2021-01-16 22:44:43 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-01-27 22:57:19 +0100 |
commit | 91d5df434b6027e79aec429d27a30d1707e5f357 (patch) | |
tree | 85dddf55257f9a16bcd9b46c61021b636716c93b /Mozo | |
parent | 7fee65e6bf5978e0d5d9e491b958f695da004c1e (diff) | |
download | mozo-91d5df434b6027e79aec429d27a30d1707e5f357.tar.bz2 mozo-91d5df434b6027e79aec429d27a30d1707e5f357.tar.xz |
Skip Collection directory
Diffstat (limited to 'Mozo')
-rw-r--r-- | Mozo/MenuEditor.py | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/Mozo/MenuEditor.py b/Mozo/MenuEditor.py index b218eb5..32e358c 100644 --- a/Mozo/MenuEditor.py +++ b/Mozo/MenuEditor.py @@ -262,28 +262,35 @@ class MenuEditor(object): while item_type != MateMenu.TreeItemType.INVALID: if item_type == MateMenu.TreeItemType.DIRECTORY: item = item_iter.get_directory() - yield (item, self.__isVisible(item)) + if item.get_menu_id() != 'Collection': + yield (item, self.__isVisible(item)) item_type = item_iter.next() def getContents(self, item): + class CollectionDirectoryException(Exception): pass + contents = [] item_iter = item.iter() item_type = item_iter.next() while item_type != MateMenu.TreeItemType.INVALID: item = None - 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) + 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 item_type = item_iter.next() return contents |