def _initKL(self, unguarded, noopt): """Initializes the Fabric client. The core client is what drives the application and what the user interface interacts with to create data types and process the data. The client is required in all Fabric based applications. Arguments: unguarded (bool): Sets the client to run in guarded mode or not. noopt (bool): Set the client to skip KL code optimization """ self.rtvalEncoderDecoder = RTValEncoderDecoder(None) clientOpts = { 'guarded': not unguarded, 'noOptimization': noopt, 'interactive': True, 'reportCallback': self._reportCallback, 'rtValToJSONEncoder': self.rtvalEncoderDecoder.encode, 'rtValFromJSONDecoder': self.rtvalEncoderDecoder.decode, } client = Core.createClient(clientOpts) client.loadExtension('Math') client.loadExtension('Parameters') client.loadExtension('Util') client.setStatusCallback(self._statusCallback) self.client = client self.qUndoStack = QtGui.QUndoStack() self.rtvalEncoderDecoder.client = self.client
def test_fe_6548(core_client): from FabricEngine.Canvas.RTValEncoderDecoder import RTValEncoderDecoder core_client.loadExtension('FileIO') encdec = RTValEncoderDecoder(core_client) filepath = core_client.RT.types.FilePath.create( os.path.join('home', 'user', 'test.txt')) print 'filepath:' + str(filepath) filepath_str = encdec.getAsString(filepath) print 'filepath_str:' + filepath_str dec_filepath = encdec.getFromString('FilePath', filepath_str) print 'dec_filepath:' + str(dec_filepath) assert str(filepath) == str(dec_filepath) vec3 = core_client.RT.types.Vec3(1, 2, 3) print 'vec3:' + str(vec3) vec3_str = encdec.getAsString(vec3) print 'vec3_str:' + vec3_str dec_vec3 = encdec.getFromString('Vec3', vec3_str) print 'dec_vec3:' + str(dec_vec3) assert str(vec3) == str(dec_vec3)
def __init__(self, client, binding, qUndoStack): self.client = client self.binding = binding self.qUndoStack = qUndoStack self.rtvalEncoderDecoder = RTValEncoderDecoder(self.client)
class BindingWrapper: def __init__(self, client, binding, qUndoStack): self.client = client self.binding = binding self.qUndoStack = qUndoStack self.rtvalEncoderDecoder = RTValEncoderDecoder(self.client) @staticmethod def splitInts(packedIndices): if not packedIndices: return [] return map( lambda indexStr: int(indexStr), packedIndices.split('|') ) @staticmethod def splitNames(names): if not names: return [] return names.split('|') @staticmethod def splitPoss(posXs, posYs): if not posXs: return [] if isinstance(posXs, basestring): posXs = map( lambda str: float(str), posXs.split('|') ) elif not hasattr(posXs, '__iter__'): posXs = [posXs] if isinstance(posYs, basestring): posYs = map( lambda str: float(str), posYs.split('|') ) elif not hasattr(posYs, '__iter__'): posYs = [posYs] result = [] for i in range(0, len(posXs)): result.append(QtCore.QPointF(posXs[i], posYs[i])) return result def decodePortType(self, portType): portTypeLower = portType.lower() if portTypeLower == "io": return self.client.DFG.PortTypes.IO elif portTypeLower == "out": return self.client.DFG.PortTypes.Out else: return self.client.DFG.PortTypes.In def undo( self, ): self.qUndoStack.undo() def redo( self, ): self.qUndoStack.redo() def instPreset( self, execPath, presetPath, posX, posY ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_InstPreset( self.binding, execPath, exec_, presetPath, QtCore.QPointF(posX, posY) ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNodeName() def addGraph( self, execPath, title, posX, posY ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddGraph( self.binding, execPath, exec_, title, QtCore.QPointF(posX, posY) ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNodeName() def addFunc( self, execPath, title, initialCode, posX, posY ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddFunc( self.binding, execPath, exec_, title, initialCode, QtCore.QPointF(posX, posY) ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNodeName() def addBackDrop( self, execPath, title, posX, posY, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddBackDrop( self.binding, execPath, exec_, title, QtCore.QPointF(posX, posY) ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNodeName() def addVar( self, execPath, desiredNodeName, dataType, extDep, posX, posY ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddVar( self.binding, execPath, exec_, desiredNodeName, dataType, extDep, QtCore.QPointF(posX, posY) ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNodeName() def addGet( self, execPath, desiredNodeName, varPath, posX, posY ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddGet( self.binding, execPath, exec_, desiredNodeName, varPath, QtCore.QPointF(posX, posY) ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNodeName() def addSet( self, execPath, desiredNodeName, varPath, posX, posY ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddSet( self.binding, execPath, exec_, desiredNodeName, varPath, QtCore.QPointF(posX, posY) ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNodeName() def moveNodes( self, execPath, packedNodeNames, packedNewTopLeftPosXs, packedNewTopLeftPosYs ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) nodeNames = BindingWrapper.splitNames(packedNodeNames) newTopLeftPoss = BindingWrapper.splitPoss( packedNewTopLeftPosXs, packedNewTopLeftPosYs ) cmd = DFG.DFGUICmd_MoveNodes( self.binding, execPath, exec_, nodeNames, newTopLeftPoss ) InvokeCmd(cmd, self.qUndoStack) def resizeBackDrop( self, execPath, backDropNodeName, newTopLeftPosX, newTopLeftPosY, newSizeW, newSizeH, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_ResizeBackDrop( self.binding, execPath, exec_, backDropNodeName, QtCore.QPointF(newTopLeftPosX, newTopLeftPosY), QtCore.QSizeF(newSizeW, newSizeH), ) InvokeCmd(cmd, self.qUndoStack) def removeNodes( self, execPath, packedNodeNames, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) nodeNames = BindingWrapper.splitNames(packedNodeNames) cmd = DFG.DFGUICmd_RemoveNodes( self.binding, execPath, exec_, nodeNames, ) InvokeCmd(cmd, self.qUndoStack) def implodeNodes( self, execPath, packedNodeNames, desiredNodeName ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) nodeNames = BindingWrapper.splitNames(packedNodeNames) cmd = DFG.DFGUICmd_ImplodeNodes( self.binding, execPath, exec_, nodeNames, desiredNodeName ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualImplodedNodeName() def explodeNode( self, execPath, nodeName ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_ExplodeNode( self.binding, execPath, exec_, nodeName ) InvokeCmd(cmd, self.qUndoStack) return cmd.getExplodedNodeNames() def connect( self, execPath, packedSrcPorts, packedDstPorts, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) srcPorts = BindingWrapper.splitNames(packedSrcPorts) dstPorts = BindingWrapper.splitNames(packedDstPorts) cmd = DFG.DFGUICmd_Connect( self.binding, execPath, exec_, srcPorts, dstPorts ) InvokeCmd(cmd, self.qUndoStack) def disconnect( self, execPath, packedSrcPorts, packedDstPorts, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) srcPorts = BindingWrapper.splitNames(packedSrcPorts) dstPorts = BindingWrapper.splitNames(packedDstPorts) cmd = DFG.DFGUICmd_Disconnect( self.binding, execPath, exec_, srcPorts, dstPorts ) InvokeCmd(cmd, self.qUndoStack) def addPort( self, execPath, desiredPortName, portType, typeSpec, pathToConnect, extDep, metaData, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddPort( self.binding, execPath, exec_, desiredPortName, self.decodePortType(portType), typeSpec, pathToConnect, extDep, metaData, ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualPortName() def addInstPort( self, execPath, instName, desiredPortName, portType, typeSpec, pathToConnect, connectType, extDep, metaData, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddInstPort( self.binding, execPath, exec_, instName, desiredPortName, self.decodePortType(portType), typeSpec, pathToConnect, self.decodePortType(connectType), extDep, metaData, ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualPortName() def addInstBlockPort( self, execPath, instName, blockName, desiredPortName, typeSpec, pathToConnect, extDep, metaData, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddInstBlockPort( self.binding, execPath, exec_, instName, blockName, desiredPortName, typeSpec, pathToConnect, extDep, metaData, ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualPortName() def editPort( self, execPath, oldPortName, desiredNewPortName, portType, typeSpec, extDep, metaData, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_EditPort( self.binding, execPath, exec_, oldPortName, desiredNewPortName, self.decodePortType(portType), typeSpec, extDep, metaData, ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNewPortName() def removePort( self, execPath, packedPortNames, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) portNames = BindingWrapper.splitNames(packedPortNames) cmd = DFG.DFGUICmd_RemovePort( self.binding, execPath, exec_, portNames, ) InvokeCmd(cmd, self.qUndoStack) def createPreset( self, execPath, nodeName, presetDirPath, presetName, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_CreatePreset( self.binding, execPath, exec_, nodeName, presetDirPath, presetName, ) InvokeCmd(cmd, self.qUndoStack) return cmd.getPathname() def setNodeComment( self, execPath, nodeName, comment, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_SetNodeComment( self.binding, execPath, exec_, nodeName, comment, ) InvokeCmd(cmd, self.qUndoStack) def setCode( self, execPath, code, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_SetCode( self.binding, execPath, exec_, code, ) InvokeCmd(cmd, self.qUndoStack) def editNode( self, execPath, oldNodeName, desiredNewNodeName, nodeMetadata, execMetadata, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_EditNode( self.binding, execPath, exec_, oldNodeName, desiredNewNodeName, nodeMetadata, execMetadata, ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNewNodeName() def renamePort( self, execPath, portPath, desiredNewPortName, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_RenamePort( self.binding, execPath, exec_, portPath, desiredNewPortName, ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualNewPortName() def paste( self, execPath, json, cursorPosX, cursorPosY, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_Paste( self.binding, execPath, exec_, json, QtCore.QPointF(cursorPosX, cursorPosY), ) InvokeCmd(cmd, self.qUndoStack) return cmd.getPastedItemNames() def setArgValue( self, argName, typeName, valueJSON, ): value = self.rtvalEncoderDecoder.getFromString(typeName, valueJSON) cmd = DFG.DFGUICmd_SetArgValue( self.binding, argName, value, ) InvokeCmd(cmd, self.qUndoStack) def setPortDefaultValue( self, execPath, portPath, typeName, valueJSON, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) value = self.rtvalEncoderDecoder.getFromString(typeName, valueJSON) cmd = DFG.DFGUICmd_SetPortDefaultValue( self.binding, execPath, exec_, portPath, value, ) InvokeCmd(cmd, self.qUndoStack) def setRefVarPath( self, execPath, refName, varPath, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_SetRefVarPath( self.binding, execPath, exec_, refName, varPath, ) InvokeCmd(cmd, self.qUndoStack) def reorderPorts( self, execPath, itemPath, packedIndices, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) indices = BindingWrapper.splitInts(packedIndices) cmd = DFG.DFGUICmd_ReorderPorts( self.binding, execPath, exec_, itemPath, indices, ) InvokeCmd(cmd, self.qUndoStack) def dismissLoadDiags( self, packedIndices, ): rootExec = self.binding.getExec() indices = BindingWrapper.splitInts(packedIndices) cmd = DFG.DFGUICmd_DismissLoadDiags( self.binding, indices, ) InvokeCmd(cmd, self.qUndoStack) def setExtDeps( self, execPath, packedExtDeps, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) extDeps = BindingWrapper.splitNames(packedExtDeps) cmd = DFG.DFGUICmd_SetExtDeps( self.binding, execPath, exec_, extDeps, ) InvokeCmd(cmd, self.qUndoStack) def splitFromPreset( self, execPath, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_SplitFromPreset( self.binding, execPath, exec_, ) InvokeCmd(cmd, self.qUndoStack) def addBlock( self, execPath, desiredName, posX, posY, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddBlock( self.binding, execPath, exec_, desiredName, QtCore.QPointF(posX, posY) ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualName() def addBlockPort( self, execPath, blockName, desiredPortName, portType, typeSpec, pathToConnect, connectType, extDep, metaData, ): rootExec = self.binding.getExec() exec_ = rootExec.getSubExec(execPath) cmd = DFG.DFGUICmd_AddBlockPort( self.binding, execPath, exec_, blockName, desiredPortName, self.decodePortType(portType), typeSpec, pathToConnect, self.decodePortType(connectType), extDep, metaData, ) InvokeCmd(cmd, self.qUndoStack) return cmd.getActualPortName()
def __init__(self, client, scriptEditor): super(UICmdHandler, self).__init__() self.client = client self.scriptEditor = scriptEditor self.rtvalEncoderDecoder = RTValEncoderDecoder(self.client)
class UICmdHandler(DFG.DFGUICmdHandler_Python): def __init__(self, client, scriptEditor): super(UICmdHandler, self).__init__() self.client = client self.scriptEditor = scriptEditor self.rtvalEncoderDecoder = RTValEncoderDecoder(self.client) @staticmethod def encodeStringChars(string): result = "" for ch in string: if ch == "\"": result += "\\\"" elif ch == "\r": result += "\\r" elif ch == "\n": result += "\\n" elif ch == "\t": result += "\\t" elif ch == "\\": result += "\\\\" else: result += ch return result @staticmethod def encodeString(string): return "\"" + UICmdHandler.encodeStringChars(string) + "\"" @staticmethod def encodeStrings(strings): result = "\"" for i in range(0, len(strings)): if i > 0: result += "|" result += UICmdHandler.encodeStringChars(strings[i]) result += "\"" return result @staticmethod def encodeInt(x): return str(x) @staticmethod def encodeInts(xs): result = "\"" for i in range(0, len(xs)): if i > 0: result += "|" result += UICmdHandler.encodeInt(xs[i]) result += "\"" return result @staticmethod def encodeFloat(x): return str(x) @staticmethod def encodePosXs(poss): result = "\"" for i in range(0, len(poss)): if i > 0: result += "|" result += UICmdHandler.encodeFloat(poss[i].x()) result += "\"" return result @staticmethod def encodePosYs(poss): result = "\"" for i in range(0, len(poss)): if i > 0: result += "|" result += UICmdHandler.encodeFloat(poss[i].y()) result += "\"" return result def encodePortType(self, portType): if portType == self.client.DFG.PortTypes.IO: return "\"io\"" elif portType == self.client.DFG.PortTypes.Out: return "\"out\"" else: return "\"in\"" def evalCmdWithArgs(self, cmd, encodedArgs): code = "binding." code += cmd code += "(" code += ", ".join(encodedArgs) code += ")" return self.scriptEditor.eval(code) def dfgDoInstPreset( self, binding, execPath, exec_, presetPath, pos ): return self.evalCmdWithArgs( "instPreset", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(presetPath), UICmdHandler.encodeFloat(pos.x()), UICmdHandler.encodeFloat(pos.y()), ] ) def dfgDoAddGraph( self, binding, execPath, exec_, title, pos ): return self.evalCmdWithArgs( "addGraph", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(title), UICmdHandler.encodeFloat(pos.x()), UICmdHandler.encodeFloat(pos.y()), ] ) def dfgDoAddFunc( self, binding, execPath, exec_, title, initialCode, pos ): return self.evalCmdWithArgs( "addFunc", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(title), UICmdHandler.encodeString(initialCode), UICmdHandler.encodeFloat(pos.x()), UICmdHandler.encodeFloat(pos.y()), ] ) def dfgDoAddBackDrop( self, binding, execPath, exec_, title, pos ): return self.evalCmdWithArgs( "addBackDrop", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(title), UICmdHandler.encodeFloat(pos.x()), UICmdHandler.encodeFloat(pos.y()), ] ) def dfgDoAddVar( self, binding, execPath, exec_, desiredNodeName, dataType, extDep, pos ): return self.evalCmdWithArgs( "addVar", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(desiredNodeName), UICmdHandler.encodeString(dataType), UICmdHandler.encodeString(extDep), UICmdHandler.encodeFloat(pos.x()), UICmdHandler.encodeFloat(pos.y()), ] ) def dfgDoAddGet( self, binding, execPath, exec_, desiredNodeName, varPath, pos ): return self.evalCmdWithArgs( "addGet", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(desiredNodeName), UICmdHandler.encodeString(varPath), UICmdHandler.encodeFloat(pos.x()), UICmdHandler.encodeFloat(pos.y()), ] ) def dfgDoAddSet( self, binding, execPath, exec_, desiredNodeName, varPath, pos ): return self.evalCmdWithArgs( "addSet", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(desiredNodeName), UICmdHandler.encodeString(varPath), UICmdHandler.encodeFloat(pos.x()), UICmdHandler.encodeFloat(pos.y()), ] ) def dfgDoMoveNodes( self, binding, execPath, exec_, nodeNames, newTopLeftPoss ): self.evalCmdWithArgs( "moveNodes", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeStrings(nodeNames), UICmdHandler.encodePosXs(newTopLeftPoss), UICmdHandler.encodePosYs(newTopLeftPoss), ] ) def dfgDoResizeBackDrop( self, binding, execPath, exec_, backDropNodeName, newTopLeftPos, newSize, ): self.evalCmdWithArgs( "resizeBackDrop", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(backDropNodeName), UICmdHandler.encodeFloat(newTopLeftPos.x()), UICmdHandler.encodeFloat(newTopLeftPos.y()), UICmdHandler.encodeFloat(newSize.width()), UICmdHandler.encodeFloat(newSize.height()), ] ) def dfgDoRemoveNodes( self, binding, execPath, exec_, nodeNames, ): self.evalCmdWithArgs( "removeNodes", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeStrings(nodeNames), ] ) def dfgDoImplodeNodes( self, binding, execPath, exec_, nodeNames, desiredNodeName ): return self.evalCmdWithArgs( "implodeNodes", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeStrings(nodeNames), UICmdHandler.encodeString(desiredNodeName), ] ) def dfgDoExplodeNode( self, binding, execPath, exec_, nodeName ): return self.evalCmdWithArgs( "explodeNode", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(nodeName), ] ) def dfgDoConnect( self, binding, execPath, exec_, srcPorts, dstPorts, ): return self.evalCmdWithArgs( "connect", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeStrings(srcPorts), UICmdHandler.encodeStrings(dstPorts), ] ) def dfgDoDisconnect( self, binding, execPath, exec_, srcPorts, dstPorts, ): return self.evalCmdWithArgs( "disconnect", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeStrings(srcPorts), UICmdHandler.encodeStrings(dstPorts), ] ) def dfgDoAddPort( self, binding, execPath, exec_, desiredPortName, portType, typeSpec, portToConnect, extDep, metaData, ): return self.evalCmdWithArgs( "addPort", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(desiredPortName), self.encodePortType(portType), UICmdHandler.encodeString(typeSpec), UICmdHandler.encodeString(portToConnect), UICmdHandler.encodeString(extDep), UICmdHandler.encodeString(metaData), ] ) def dfgDoAddInstPort( self, binding, execPath, exec_, instName, desiredPortName, portType, typeSpec, pathToConnect, connectType, extDep, metaData, ): return self.evalCmdWithArgs( "addInstPort", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(instName), UICmdHandler.encodeString(desiredPortName), self.encodePortType(portType), UICmdHandler.encodeString(typeSpec), UICmdHandler.encodeString(pathToConnect), self.encodePortType(connectType), UICmdHandler.encodeString(extDep), UICmdHandler.encodeString(metaData), ] ) def dfgDoAddInstBlockPort( self, binding, execPath, exec_, instName, blockName, desiredPortName, typeSpec, pathToConnect, extDep, metaData, ): return self.evalCmdWithArgs( "addInstBlockPort", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(instName), UICmdHandler.encodeString(blockName), UICmdHandler.encodeString(desiredPortName), UICmdHandler.encodeString(typeSpec), UICmdHandler.encodeString(pathToConnect), UICmdHandler.encodeString(extDep), UICmdHandler.encodeString(metaData), ] ) def dfgDoEditPort( self, binding, execPath, exec_, oldPortName, desiredNewPortName, portType, typeSpec, extDep, metaData, ): return self.evalCmdWithArgs( "editPort", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(oldPortName), UICmdHandler.encodeString(desiredNewPortName), self.encodePortType(portType), UICmdHandler.encodeString(typeSpec), UICmdHandler.encodeString(extDep), UICmdHandler.encodeString(metaData), ] ) def dfgDoRemovePort( self, binding, execPath, exec_, portNames, ): return self.evalCmdWithArgs( "removePort", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeStrings(portNames), ] ) def dfgDoCreatePreset( self, binding, execPath, exec_, nodeName, presetDirPath, presetName, ): return self.evalCmdWithArgs( "createPreset", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(nodeName), UICmdHandler.encodeString(presetDirPath), UICmdHandler.encodeString(presetName), ] ) def dfgDoSetNodeComment( self, binding, execPath, exec_, nodeName, comment, ): return self.evalCmdWithArgs( "setNodeComment", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(nodeName), UICmdHandler.encodeString(comment), ] ) def dfgDoSetCode( self, binding, execPath, exec_, code, ): return self.evalCmdWithArgs( "setCode", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(code), ] ) def dfgDoEditNode( self, binding, execPath, exec_, oldNodeName, desiredNewNodeName, nodeMetadata, execMetadata, ): return self.evalCmdWithArgs( "editNode", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(oldNodeName), UICmdHandler.encodeString(desiredNewNodeName), UICmdHandler.encodeString(nodeMetadata), UICmdHandler.encodeString(execMetadata), ] ) def dfgDoRenamePort( self, binding, execPath, exec_, portPath, desiredNewPortName, ): return self.evalCmdWithArgs( "renamePort", [ UICmdHandler.encodeString(exec_.getExecPath()), UICmdHandler.encodeString(portPath), UICmdHandler.encodeString(desiredNewPortName), ] ) def dfgDoPaste( self, binding, execPath, exec_, json, cursorPos, ): return self.evalCmdWithArgs( "paste", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(json), UICmdHandler.encodeFloat(cursorPos.x()), UICmdHandler.encodeFloat(cursorPos.y()), ] ) def dfgDoSetArgValue( self, binding, argName, value, ): return self.evalCmdWithArgs( "setArgValue", [ UICmdHandler.encodeString(argName), UICmdHandler.encodeString(value.getTypeNameStr()), UICmdHandler.encodeString(self.rtvalEncoderDecoder.getAsString(value)), ] ) def dfgDoSetPortDefaultValue( self, binding, execPath, exec_, portPath, value, ): return self.evalCmdWithArgs( "setPortDefaultValue", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(portPath), UICmdHandler.encodeString(value.getTypeNameStr()), UICmdHandler.encodeString(self.rtvalEncoderDecoder.getAsString(value)), ] ) def dfgDoSetRefVarPath( self, binding, execPath, exec_, refName, varPath, ): return self.evalCmdWithArgs( "setRefVarPath", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(refName), UICmdHandler.encodeString(varPath), ] ) def dfgDoReorderPorts( self, binding, execPath, exec_, itemPath, indices, ): return self.evalCmdWithArgs( "reorderPorts", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(itemPath), UICmdHandler.encodeInts(indices), ] ) def dfgDoDismissLoadDiags( self, binding, indices, ): return self.evalCmdWithArgs( "dismissLoadDiags", [ UICmdHandler.encodeInts(indices), ] ) def dfgDoSetExtDeps( self, binding, execPath, exec_, extDeps, ): return self.evalCmdWithArgs( "setExtDeps", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeStrings(extDeps), ] ) def dfgDoSplitFromPreset( self, binding, execPath, exec_, ): return self.evalCmdWithArgs( "splitFromPreset", [ UICmdHandler.encodeString(execPath), ] ) def dfgDoAddBlock( self, binding, execPath, exec_, desiredName, pos ): return self.evalCmdWithArgs( "addBlock", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(desiredName), UICmdHandler.encodeFloat(pos.x()), UICmdHandler.encodeFloat(pos.y()), ] ) def dfgDoAddBlockPort( self, binding, execPath, exec_, blockName, desiredPortName, portType, typeSpec, pathToConnect, connectType, extDep, metaData, ): return self.evalCmdWithArgs( "addBlockPort", [ UICmdHandler.encodeString(execPath), UICmdHandler.encodeString(blockName), UICmdHandler.encodeString(desiredPortName), self.encodePortType(portType), UICmdHandler.encodeString(typeSpec), UICmdHandler.encodeString(pathToConnect), self.encodePortType(connectType), UICmdHandler.encodeString(extDep), UICmdHandler.encodeString(metaData), ] )