def updateModel(self): ''' Clears the QGraphicScene and re-populates it with what is currently in the WorkflowScene. ''' QtGui.QGraphicsScene.clear(self) meta_steps = {} connections = [] for workflowitem in self._workflow_scene.items(): if workflowitem.Type == MetaStep.Type: node = Node(workflowitem) workflowitem._step.registerConfiguredObserver(self.stepConfigured) workflowitem._step.registerDoneExecution(self.doneExecution) workflowitem._step.registerOnExecuteEntry(self.setCurrentWidget, self.setWidgetUndoRedoStack) workflowitem._step.registerIdentifierOccursCount(self.identifierOccursCount) # Put the node into the scene straight away so that the items scene will # be valid when we set the position. QtGui.QGraphicsScene.addItem(self, node) node.setPos(workflowitem.pos()) self.blockSignals(True) node.setSelected(workflowitem.selected()) self.blockSignals(False) meta_steps[workflowitem] = node elif workflowitem.Type == Connection.Type: connections.append(workflowitem) for connection in connections: src_port_item = meta_steps[connection.source()]._step_port_items[connection.sourceIndex()] destination_port_item = meta_steps[connection.destination()]._step_port_items[connection.destinationIndex()] arc = Arc(src_port_item, destination_port_item) # Overwrite the connection created in the Arc with the original one that is in the # WorkflowScene arc._connection = connection # Again put the arc into the scene straight away so the scene will be valid QtGui.QGraphicsScene.addItem(self, arc) self.blockSignals(True) arc.setSelected(connection.selected()) self.blockSignals(False) self._previousSelection = self.selectedItems()