Skip to content

Commit

Permalink
Fix setting fetch parents obsolete on DB editor close (#2766)
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen authored May 14, 2024
2 parents c291307 + fee50a2 commit 19468dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions spinetoolbox/mvcmodels/minimal_tree_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ class MinimalTreeModel(QAbstractItemModel):
"""Base class for all tree models."""

def __init__(self, parent):
"""Init class.
"""
Args:
parent (SpineDBEditor)
"""
Expand Down
7 changes: 3 additions & 4 deletions spinetoolbox/spine_db_editor/mvcmodels/tree_model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
######################################################################################################################

"""Models to represent things in a tree."""
from PySide6.QtCore import QObject, Qt, QModelIndex, Slot
from PySide6.QtCore import Qt, QModelIndex
from spinetoolbox.mvcmodels.minimal_tree_model import MinimalTreeModel
from .tree_item_utility import StandardTreeItem

Expand All @@ -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(self._tear_down_tree)
self.destroyed.connect(lambda _: self._tear_down_tree)

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

@Slot(QObject)
def _tear_down_tree(self, obj=None):
def _tear_down_tree(self):
"""Tears down tree items recursively"""
self._invisible_root_item.tear_down_recursively()
2 changes: 1 addition & 1 deletion tests/spine_db_editor/mvcmodels/test_scenario_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _fetch_recursively(model):
for item in model.visit_all():
while item.can_fetch_more():
item.fetch_more()
qApp.processEvents()
QApplication.processEvents()


class TestScenarioModel(_TestBase):
Expand Down

0 comments on commit 19468dd

Please sign in to comment.