34 import time |
34 import time |
35 from time import localtime |
35 from time import localtime |
36 import shutil |
36 import shutil |
37 import re |
37 import re |
38 import tempfile |
38 import tempfile |
39 from types import ListType |
|
40 from threading import Timer |
39 from threading import Timer |
41 from datetime import datetime |
40 from datetime import datetime |
42 from weakref import WeakKeyDictionary |
41 from weakref import WeakKeyDictionary |
43 from six.moves import xrange |
42 from six.moves import xrange |
44 |
43 |
71 |
70 |
72 |
71 |
73 def ExtractChildrenTypesFromCatalog(catalog): |
72 def ExtractChildrenTypesFromCatalog(catalog): |
74 children_types = [] |
73 children_types = [] |
75 for n, d, _h, c in catalog: |
74 for n, d, _h, c in catalog: |
76 if isinstance(c, ListType): |
75 if isinstance(c, list): |
77 children_types.extend(ExtractChildrenTypesFromCatalog(c)) |
76 children_types.extend(ExtractChildrenTypesFromCatalog(c)) |
78 else: |
77 else: |
79 children_types.append((n, GetClassImporter(c), d)) |
78 children_types.append((n, GetClassImporter(c), d)) |
80 return children_types |
79 return children_types |
81 |
80 |
82 |
81 |
83 def ExtractMenuItemsFromCatalog(catalog): |
82 def ExtractMenuItemsFromCatalog(catalog): |
84 menu_items = [] |
83 menu_items = [] |
85 for n, d, h, c in catalog: |
84 for n, d, h, c in catalog: |
86 if isinstance(c, ListType): |
85 if isinstance(c, list): |
87 children = ExtractMenuItemsFromCatalog(c) |
86 children = ExtractMenuItemsFromCatalog(c) |
88 else: |
87 else: |
89 children = [] |
88 children = [] |
90 menu_items.append((n, d, h, children)) |
89 menu_items.append((n, d, h, children)) |
91 return menu_items |
90 return menu_items |