From f594a7844f96e41befe37ecbe82aebd462ba4381 Mon Sep 17 00:00:00 2001 From: tangkong Date: Wed, 26 Jun 2024 09:32:59 -0700 Subject: [PATCH] MNT: treat Root like a Nestable in tree construction --- superscore/widgets/tree.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/superscore/widgets/tree.py b/superscore/widgets/tree.py index 2b9711b..e90f1d8 100644 --- a/superscore/widgets/tree.py +++ b/superscore/widgets/tree.py @@ -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__) @@ -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)