Skip to content

Commit

Permalink
Block signals when updating model in workflowgraphicsscene.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
hsorby committed Nov 6, 2023
1 parent 9a60dbe commit 446efde
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/mapclient/core/managers/workflowmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def title(self):
self._title = self._title + ' - ' + self._location
else:
self._title = self._title + ' - ' + os.path.basename(self._location)

if self._saveStateIndex != self._currentStateIndex:
self._title = self._title + ' *'

Expand Down
5 changes: 3 additions & 2 deletions src/mapclient/settings/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def get_log_location():
with lock:
try:
with open(database_file, "r") as file:
database = json.loads(file.read())
database = json.load(file)

except IOError:
database = []

Expand Down Expand Up @@ -210,7 +211,7 @@ def mark_workflow_in_use(workflow_dir):

database_file = _get_pid_database_file()
with open(database_file, "w") as file:
file.write(json.dumps(database))
json.dump(database, file)

return True

Expand Down
5 changes: 5 additions & 0 deletions src/mapclient/view/workflow/workflowgraphicsscene.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def update_model(self):
Clears the QGraphicScene and re-populates it with what is currently
in the WorkflowScene.
"""
self.blockSignals(True)
QtWidgets.QGraphicsScene.clear(self)
self.blockSignals(False)
meta_steps = {}
connections = []
for workflowitem in list(self._workflow_scene.items()):
Expand All @@ -93,13 +95,16 @@ def update_model(self):
workflowitem.getStep().registerDoneExecution(self.doneExecution)
workflowitem.getStep().registerOnExecuteEntry(self.setCurrentWidget, self.setWidgetUndoRedoStack)
workflowitem.getStep().registerIdentifierOccursCount(self.identifierOccursCount)

# Put the node into the scene straight away so that the items scene will
# be valid when we set the position.
QtWidgets.QGraphicsScene.addItem(self, node)

self.blockSignals(True)
node.setPos(workflowitem.getPos())
node.setSelected(workflowitem.getSelected())
self.blockSignals(False)

meta_steps[workflowitem] = node
elif workflowitem.Type == Connection.Type:
connections.append(workflowitem)
Expand Down

0 comments on commit 446efde

Please sign in to comment.