Skip to content

Commit

Permalink
Fix Reload button in Database editor (#2857)
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen authored Jun 26, 2024
2 parents a654b0c + 0d708f1 commit 16dc7b3
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions spinetoolbox/spine_db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,24 +561,21 @@ 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)
except KeyError:
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):
"""
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 16dc7b3

Please sign in to comment.