def update_from_implicit(self, implicit): def flatten(item_list, level): for model_item in item_list: if model_item.active: # text = " " * level + str(model_item.text) text = str(model_item.text) if model_item.extra: text += " [" + model_item.extra + "]" items.append(text) if model_item.children: flatten(model_item.children, level + 1) items = [] try: model = create_model(implicit, show_all=False) except Exception: traceback.print_exc() print("create_model failed") else: flatten(model.items, 0) self.set_items(items)