Skip to content

Commit

Permalink
MNT: treat Root like a Nestable in tree construction
Browse files Browse the repository at this point in the history
  • Loading branch information
tangkong committed Jun 26, 2024
1 parent 55ef8ca commit f594a78
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions superscore/widgets/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from qtpy import QtCore

from superscore.client import Client
from superscore.model import Entry, Nestable
from superscore.model import Entry, Nestable, Root
from superscore.qt_helpers import QDataclassBridge

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -201,7 +201,10 @@ def build_tree(entry: Entry, parent: Optional[EntryItem] = None) -> EntryItem:
"""

item = EntryItem(entry, tree_parent=parent)
if isinstance(entry, Nestable):
if isinstance(entry, Root):
for child in entry.entries:
build_tree(child, parent=item)
elif isinstance(entry, Nestable):
for child in entry.children:
build_tree(child, parent=item)

Expand Down

0 comments on commit f594a78

Please sign in to comment.