Пример #1
0
def _model_to_tree(
        item: QStandardItem,
        selection: List,
        with_selection: bool
) -> Union[Dict, OntoType]:
    tree = {}
    for i in range(item.rowCount()):
        tree[item.child(i).text()] = \
            _model_to_tree(item.child(i), selection, with_selection)
    return (tree, item.index() in selection) if with_selection else tree
Пример #2
0
def _model_to_words(item: QStandardItem) -> List:
    words = [item.text()] if item.text() else []
    for i in range(item.rowCount()):
        words.extend(_model_to_words(item.child(i)))
    return words