def pipelineTest(): import sys n = node.Node("pycauv-pl",sys.argv[1:]) model = pipeline.Model(n) print 'Setting debug level to -3' n.send(messaging.DebugLevelMessage(-3), "debug") print 'Adding stuff to the pipeline...' n.send(messaging.ClearPipelineMessage(), "pipeline") n.send(messaging.AddNodeMessage(messaging.NodeType.FileInput, messaging.NodeInputArcVec(), messaging.NodeOutputArcVec()), "pipeline") n.send(messaging.AddNodeMessage(messaging.NodeType.GuiOutput, messaging.NodeInputArcVec(), messaging.NodeOutputArcVec()), "pipeline") print 'Getting pipeline state...' saved = model.get() print 'before:', saved print 'Clearing pipeline state...' model.clear() print 'Setting pipeline state...' model.set(saved) print 'after:', model.get()
p_AddNodeMessage = pp.Group(l \ + p_str + c \ + p_NodeType + c \ + p_NodeInputArcVec + c \ + p_NodeOutputArcVec \ + r).streamline() p_AddNodeMessage.setParseAction(lambda x: messaging.AddNodeMessage(*x[0])) p_RemoveNodeMessage = pp.Group(l \ + p_str + c \ + p_int \ + r).streamline() p_RemoveNodeMessage.setParseAction(lambda x: messaging.RemoveNodeMessage(*x[0])) p_ClearPipelineMessage = pp.Group(l \ + p_str \ + r).streamline() p_ClearPipelineMessage.setParseAction(lambda x: messaging.ClearPipelineMessage(*x[0])) p_SetNodeParameterMessage = pp.Group(l \ + p_str + c \ + p_int + c \ + p_str + c \ + p_ParamValue \ + r).streamline() p_SetNodeParameterMessage.setParseAction(lambda x: messaging.SetNodeParameterMessage(*x[0])) p_AddArcMessage = pp.Group(l \ + p_str + c \ + p_NodeOutput + c \ + p_NodeInput \ + r).streamline() p_AddArcMessage.setParseAction(lambda x: messaging.AddArcMessage(*x[0])) p_RemoveArcMessage = pp.Group(l \ + p_str + c \
+ p_NodeType + c \ + p_NodeInputArcVec + c \ + p_NodeOutputArcVec \ + r).streamline() p_AddNodeMessage.setParseAction(lambda x: messaging.AddNodeMessage(*x[0])) p_RemoveNodeMessage = pp.Group(l \ + p_str + c \ + p_int \ + r).streamline() p_RemoveNodeMessage.setParseAction( lambda x: messaging.RemoveNodeMessage(*x[0])) p_ClearPipelineMessage = pp.Group(l \ + p_str \ + r).streamline() p_ClearPipelineMessage.setParseAction( lambda x: messaging.ClearPipelineMessage(*x[0])) p_SetNodeParameterMessage = pp.Group(l \ + p_str + c \ + p_int + c \ + p_str + c \ + p_ParamValue \ + r).streamline() p_SetNodeParameterMessage.setParseAction( lambda x: messaging.SetNodeParameterMessage(*x[0])) p_AddArcMessage = pp.Group(l \ + p_str + c \ + p_NodeOutput + c \ + p_NodeInput \ + r).streamline() p_AddArcMessage.setParseAction(lambda x: messaging.AddArcMessage(*x[0])) p_RemoveArcMessage = pp.Group(l \
msg = messaging.DebugMessage(messaging.DebugType.Debug, "test message string!") print "created debug message:", msg for i in xrange(1, 11): try: print "setting message string" msg.msg = "msg string %d" % i print "Sending message", i, msg n.send(msg, "test") #print n.mailbox.receive(1000) except Exception, e: print e time.sleep(3) n.send(messaging.ClearPipelineMessage("default"), "pipeline") n.send(messaging.AddNodeMessage("default", messaging.NodeType.FileInput, messaging.NodeInputArcVec(), messaging.NodeOutputArcVec()), "pipeline") n.send(messaging.AddNodeMessage("default", messaging.NodeType.GuiOutput, messaging.NodeInputArcVec(), messaging.NodeOutputArcVec()), "pipeline") print "deleting dmo", dmo del dmo print "deleting o", o del o print "deleting m", m del m