Skip to content

Commit

Permalink
Remove before update before add in DB editor
Browse files Browse the repository at this point in the history
To try and avoid ugly transient states. For example, if I remove and
add stuff and the addition is processed first, some views might
complain they don't find the items I removed. So it's better to process
the removal first so the view is clean when the addition is processed.
  • Loading branch information
manuelma committed Nov 23, 2023
1 parent 6f8c87f commit 341da0d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spinetoolbox/fetch_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ def increment_position(self, db_map):
def _apply_pending_changes(self):
if self.is_obsolete:
return
for db_map in list(self._items_to_add):
data = self._items_to_add.pop(db_map)
self.handle_items_added({db_map: data})
for db_map in list(self._items_to_update):
data = self._items_to_update.pop(db_map)
self.handle_items_updated({db_map: data})
for db_map in list(self._items_to_remove):
data = self._items_to_remove.pop(db_map)
self.handle_items_removed({db_map: data})
for db_map in list(self._items_to_update):
data = self._items_to_update.pop(db_map)
self.handle_items_updated({db_map: data})
for db_map in list(self._items_to_add):
data = self._items_to_add.pop(db_map)
self.handle_items_added({db_map: data})
QTimer.singleShot(0, lambda: self.set_busy(False))

def bind_item(self, item, db_map):
Expand Down

0 comments on commit 341da0d

Please sign in to comment.