Ejemplo n.º 1
0
    def onAddNode(self):
        name, ok = QInputDialog.getText(self, 'Add new node', 'Insert the name of the node')
        if not ok:
            return

        name = str(name)
        if len(name) == 0:
            return

        scene = self._nodeGraph.scene()
        node = NodeItemImpl(name)
        scene.addNode(node)
        node.setPos(scene.sceneRect().center())
        node.sigRemove.connect(scene.removeNode)
        node.sigAddConnector.connect(self.onAddConnector)
Ejemplo n.º 2
0
    def addDefaultNode(self):
        name, ok = QInputDialog.getText(self, 'Add new node', 'Insert the name of the node')
        if not ok:
            return

        name = str(name)
        if len(name) == 0:
            return

        scene = self._nodeGraph.scene()
        node = NodeItemImpl(name)
        scene.addNode(node)
        node.setPos(scene.sceneRect().center())
        node.sigRemove.connect(scene.removeNode)
        node.sigAddConnector.connect(self.onAddConnector)

        node.addConnector(InputConnectorItem('in', ['in_%d' % i for i in xrange(3)]))
        node.addConnector(OutputConnectorItem('out', ['out_%d' % i for i in xrange(3)]))