diff --git a/spinetoolbox/spine_db_manager.py b/spinetoolbox/spine_db_manager.py index bcdf07044..857765c3d 100644 --- a/spinetoolbox/spine_db_manager.py +++ b/spinetoolbox/spine_db_manager.py @@ -561,17 +561,12 @@ def clean_up(self): self.deleteLater() def refresh_session(self, *db_maps): - refreshed_db_maps = set() - for db_map in db_maps: - try: - worker = self._get_worker(db_map) - except KeyError: - continue - worker.refresh_session() - refreshed_db_maps.add(db_map) - self.receive_session_refreshed(refreshed_db_maps) + refreshed_db_maps = self.reset_session(*db_maps) + if refreshed_db_maps: + self.receive_session_refreshed(refreshed_db_maps) def reset_session(self, *db_maps): + reset_db_maps = set() for db_map in db_maps: try: worker = self._get_worker(db_map) @@ -579,6 +574,8 @@ def reset_session(self, *db_maps): continue worker.reset_session() self.undo_stack[db_map].clear() + reset_db_maps.add(db_map) + return reset_db_maps def commit_session(self, commit_msg, *dirty_db_maps, cookie=None): """ @@ -641,8 +638,9 @@ def notify_session_committed(self, cookie, *db_maps): cookie (Any): commit cookie *db_maps: database maps that were committed """ - self.reset_session(*db_maps) - self.receive_session_committed(set(db_maps), cookie) + reset_db_maps = self.reset_session(*db_maps) + if reset_db_maps: + self.receive_session_committed(reset_db_maps, cookie) def rollback_session(self, *dirty_db_maps): """Rolls back the current session.