Skip to content

Commit

Permalink
Ensure tree items get torn down for real
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen committed Oct 30, 2024
1 parent f8ea1db commit 343a469
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class MultiDBTreeModel(MinimalTreeModel):
"""Base class for all tree models in Spine db editor."""

def __init__(self, db_editor, db_mngr, *db_maps):
"""Init class.
"""
Args:
db_editor (SpineDBEditor)
db_mngr (SpineDBManager): A manager for the given db_maps
Expand Down
6 changes: 1 addition & 5 deletions spinetoolbox/spine_db_editor/mvcmodels/tree_model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, db_editor, db_mngr, *db_maps):
self.db_editor = db_editor
self.db_mngr = db_mngr
self.db_maps = db_maps
self.destroyed.connect(lambda _: self._tear_down_tree)
self.destroyed.connect(lambda _: self._invisible_root_item.tear_down_recursively())

def columnCount(self, parent=QModelIndex()):
"""Returns the number of columns under the given parent. Always 2.
Expand Down Expand Up @@ -66,7 +66,3 @@ def db_item(item):

def db_row(self, item):
return self.db_item(item).child_number()

def _tear_down_tree(self):
"""Tears down tree items recursively"""
self._invisible_root_item.tear_down_recursively()

0 comments on commit 343a469

Please sign in to comment.