Spine-Toolbox icon indicating copy to clipboard operation
Spine-Toolbox copied to clipboard

Problem with renaming Data Stores

Open PiispaH opened this issue 1 year ago • 0 comments

There is this edge case that if two Data Stores A and B point to the same .sqlite file that is in the directory .../.spinetoolbox/items/A and A is renamed to A', trying to open B afterwards causes the following error:

image

This happens because the .sqlite file is moved to the new directory .../.spinetoolbox/items/A' but the Data Store B doesn't get notified of this move.

Maybe there should be a warning that other items may not function the way they used to when renaming a Data Store which's directory other project items depend on. Or maybe even automatically update the file references of the other items when the directory is changed.

Also this very specific thing happens:

Rename Data Store C to C', rename A to A' try to open B. Then exit Toolbox without saving. While exiting the following Traceback pops up twice:

Traceback (most recent call last):
  File "C:\spine-toolbox\spinetoolbox\mvcmodels\project_item_model.py", line 84, in _rename_item
    self._remove_leaf_item(old_name)
  File "C:\spine-toolbox\spinetoolbox\mvcmodels\project_item_model.py", line 74, in _remove_leaf_item
    self.remove_item(leaf_item, category_index)
  File "C:\spine-toolbox\spinetoolbox\mvcmodels\project_item_model.py", line 292, in remove_item
    self.beginRemoveRows(parent, row, row)
  File "C:\spine-toolbox\spinetoolbox\mvcmodels\project_item_model.py", line 128, in parent
    return self.createIndex(parent_item.row(), 0, parent_item)
AttributeError: 'PySide6.QtWidgets.QGroupBox' object has no attribute 'row'

PiispaH avatar Dec 20 '23 09:12 PiispaH