Example #1
0
 def cutNode(self):
     """
         Cuts the current node(s).
     """
     # Call the copyNode function to save the data of the selected nodes
     self.copyNode()
     buttleData = ButtleDataSingleton().get()
     # If we are sure that at least one node is selected
     if buttleData.getCurrentSelectedNodeWrappers() != []:
         for node in buttleData.getCurrentSelectedNodeWrappers():
             # We precise that we want to cut the node and not only copy it
             buttleData.getCurrentCopiedNodesInfo()[node.getName()].update({"mode": ""})
             # And we delete it
             self.destructionNodes()
             # And update the view if necessary
             if buttleData.getCurrentViewerNodeName() in buttleData.getCurrentSelectedNodeNames():
                 buttleData.setCurrentViewerNodeName(None)
             if buttleData.getCurrentParamNodeName() in buttleData.getCurrentSelectedNodeNames():
                 buttleData.setCurrentParamNodeName(None)
             # Emit the change for the toolbar
             buttleData.pastePossibilityChanged.emit()
Example #2
0
 def cutNode(self):
     """
         Cuts the current node(s).
     """
     # Call the copyNode function to save the data of the selected nodes
     self.copyNode()
     buttleData = ButtleDataSingleton().get()
     # If we are sure that at least one node is selected
     if buttleData.getCurrentSelectedNodeWrappers() != []:
         for node in buttleData.getCurrentSelectedNodeWrappers():
             # We precise that we want to cut the node and not only copy it
             buttleData.getCurrentCopiedNodesInfo()[node.getName()].update(
                 {"mode": ""})
             # And we delete it
             self.destructionNodes()
             # And update the view if necessary
             if buttleData.getCurrentViewerNodeName(
             ) in buttleData.getCurrentSelectedNodeNames():
                 buttleData.setCurrentViewerNodeName(None)
             if buttleData.getCurrentParamNodeName(
             ) in buttleData.getCurrentSelectedNodeNames():
                 buttleData.setCurrentParamNodeName(None)
             # Emit the change for the toolbar
             buttleData.pastePossibilityChanged.emit()
Example #3
0
 def copyNode(self):
     """
         Copies the current node(s).
     """
     buttleData = ButtleDataSingleton().get()
     # Clear the info saved in currentCopiedNodesInfo
     buttleData.clearCurrentCopiedNodesInfo()
     # Save new data in currentCopiedNodesInfo for each selected node
     if buttleData.getCurrentSelectedNodeWrappers() != []:
         for node in buttleData.getCurrentSelectedNodeWrappers():
             copyNode = {}
             copyNode.update({"nodeType": node.getNode().getType()})
             copyNode.update({"nameUser": node.getNode().getNameUser()})
             copyNode.update({"color": node.getNode().getColor()})
             copyNode.update({"params": node.getNode().getTuttleNode().getParamSet()})
             copyNode.update({"mode": "_copy"})
             buttleData.getCurrentCopiedNodesInfo()[node.getName()] = copyNode
             # Emit the change for the toolbar
             buttleData.pastePossibilityChanged.emit()
Example #4
0
 def copyNode(self):
     """
         Copies the current node(s).
     """
     buttleData = ButtleDataSingleton().get()
     # Clear the info saved in currentCopiedNodesInfo
     buttleData.clearCurrentCopiedNodesInfo()
     # Save new data in currentCopiedNodesInfo for each selected node
     if buttleData.getCurrentSelectedNodeWrappers() != []:
         for node in buttleData.getCurrentSelectedNodeWrappers():
             copyNode = {}
             copyNode.update({"nodeType": node.getNode().getType()})
             copyNode.update({"nameUser": node.getNode().getNameUser()})
             copyNode.update({"color": node.getNode().getColor()})
             copyNode.update(
                 {"params": node.getNode().getTuttleNode().getParamSet()})
             copyNode.update({"mode": "_copy"})
             buttleData.getCurrentCopiedNodesInfo()[
                 node.getName()] = copyNode
             # Emit the change for the toolbar
             buttleData.pastePossibilityChanged.emit()
Example #5
0
    def pasteNode(self):
        """
            Pasts the current node(s).
        """
        buttleData = ButtleDataSingleton().get()
        # If nodes have been copied previously
        if buttleData.getCurrentCopiedNodesInfo():
            # Create a copy for each node copied
            for node in buttleData.getCurrentCopiedNodesInfo():
                buttleData.getGraph().createNode(buttleData.getCurrentCopiedNodesInfo()[node]["nodeType"], 20, 20)
                newNode = buttleData.getGraph().getNodes()[-1]
                newNode.setColor(buttleData.getCurrentCopiedNodesInfo()[node]["color"])
                newNode.setNameUser(buttleData.getCurrentCopiedNodesInfo()[node]["nameUser"] + buttleData.getCurrentCopiedNodesInfo()[node]["mode"])
                newNode.getTuttleNode().getParamSet().copyParamsValues(buttleData.getCurrentCopiedNodesInfo()[node]["params"])

        # update undo/redo display
        self.undoRedoChanged()
Example #6
0
    def pasteNode(self):
        """
            Pasts the current node(s).
        """
        buttleData = ButtleDataSingleton().get()
        # If nodes have been copied previously
        if buttleData.getCurrentCopiedNodesInfo():
            # Create a copy for each node copied
            for node in buttleData.getCurrentCopiedNodesInfo():
                buttleData.getGraph().createNode(
                    buttleData.getCurrentCopiedNodesInfo()[node]["nodeType"],
                    20, 20)
                newNode = buttleData.getGraph().getNodes()[-1]
                newNode.setColor(
                    buttleData.getCurrentCopiedNodesInfo()[node]["color"])
                newNode.setNameUser(
                    buttleData.getCurrentCopiedNodesInfo()[node]["nameUser"] +
                    buttleData.getCurrentCopiedNodesInfo()[node]["mode"])
                newNode.getTuttleNode().getParamSet().copyParamsValues(
                    buttleData.getCurrentCopiedNodesInfo()[node]["params"])

        # update undo/redo display
        self.undoRedoChanged()