def compile(atom3i): """ Entry point for ATOM3. Compiles all ROS nodes. """ global gPath a3t.setInstance(atom3i) outPath = genPath("") if not compileNodes() and hasErrors(): return getError() else: tkMessageBox.showinfo("RDIS", "Files generated in: " + outPath)
def json_serialize(atom3i): """ Main entry point for ATom3. """ a3t.setInstance(atom3i) root = dict() print print print "=============== COMPILING =====================" print print asg = getASG() graphName = a3t.evalAtom3Type(asg.name) graphAuthor = a3t.evalAtom3Type(asg.author) fp = None filename = None filepath = None if graphName == None or len(graphName) == 0: reportError("Please give your model a name.") else: try: filename = graphName + ".rdis.json" filepath = genPath(filename) fp = open(filepath, "w") except IOError as e: reportError(str(e)) root["name"] = graphName root["author"] = graphAuthor addPrimitives(root) addInterfaces(root) addConnections(root) addDomainInterfaces(root) addDomainOutputs(root) addStateVars(root) if not hasErrors(): json.dump(root, fp, indent=2) fp.close() tkMessageBox.showinfo("RDIS", "Model successfully serialized to file: " + filepath) else: errors = getErrors() print (str(len(errors)) + " error(s) in total.") i = 0 for error in errors: i += 1 print " {:2}. ".format(i) + error[0] return errors[0]