Skip to content

Commit 226f03a

Browse files
adds recursive loop for more children
Co-authored-by: Jeff Krzywon <[email protected]>
1 parent 1cd36a6 commit 226f03a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/sas/qtgui/Plotting/Slicers/SlicerUtils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ def generate_unique_plot_id(base_id: str, item) -> str:
1313
parent_item = item if item.parent() is None else item.parent()
1414

1515
existing: int = 0
16+
def _row_count_for_level(parent_item, count: int):
1617
for i in range(parent_item.rowCount()):
18+
it = parent_item.child(i)
19+
d = it.data()
20+
if hasattr(d, "id") and isinstance(d.id, str) and d.id.startswith(base_id):
21+
count += 1
22+
if it.rowCount() > 0:
23+
count += _row_count_for_level(it, count)
24+
return count
1725
it = parent_item.child(i)
1826
d = it.data()
1927
if hasattr(d, "id") and isinstance(d.id, str) and d.id.startswith(base_id):

0 commit comments

Comments
 (0)