TNLData už umí vyrábět dummy vrcholy i jen ze seznamu TNLDat
This commit is contained in:
parent
9ba5c65326
commit
6e79237cef
1 changed files with 8 additions and 4 deletions
|
@ -106,16 +106,20 @@ class TNLData(object):
|
|||
return out
|
||||
|
||||
@classmethod
|
||||
def filter_treenode(cls, treenode, predicate):
|
||||
tnll = cls._filter_treenode_recursive(treenode, predicate) # TreeNodeList List :-)
|
||||
# Teď vyrobíme virtuální TNL, který nemá obsah, ale má za potomky všecny nalezené TNLData
|
||||
def from_tnldata_list(cls, tnllist):
|
||||
"""Vyrobíme virtuální TNL, který nemá obsah, ale má za potomky všechna zadaná TNLData"""
|
||||
result = cls(None)
|
||||
for idx, tnl in enumerate(tnll):
|
||||
for idx, tnl in enumerate(tnllist):
|
||||
result.children.append(tnl)
|
||||
tnl.parent = result
|
||||
tnl.index = idx
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def filter_treenode(cls, treenode, predicate):
|
||||
tnll = cls._filter_treenode_recursive(treenode, predicate) # TreeNodeList List :-)
|
||||
return TNLData.from_tnldata_list(tnll)
|
||||
|
||||
@classmethod
|
||||
def _filter_treenode_recursive(cls, treenode, predicate):
|
||||
if predicate(treenode):
|
||||
|
|
Loading…
Reference in a new issue