def regenerateClientServerCode(self): generate(self.ASGroot.listNodes,defaultSCXMLOutputFileName) #here we must also perform a second transformation to add a pause state. #this is interesting, because it means the js and scxml code you get from Export* will actually be different than the code that is generated by starting the client server. #the client server code will be instrumented with this transformation (to support a pause state), while the export code will not addPauseSupportToSCXMLDocument(defaultSCXMLOutputFileName,defaultSCXMLOutputFileName) results = compile_from_path([defaultSCXMLOutputFileName]) #write results rfile = open(defaultJsOutputFileName,"w"); for result in results: rfile.write(result) rfile.close()
def exportJavaScript(self): #FIXME: this code will prompt for a dialog for exportSCXML. maybe we don't want that behaviour? location = exportSCXML(self) file=tkFileDialog.asksaveasfilename(initialfile=defaultJsOutputFileName, filetypes=[("JavaScript files", "*.js")], initialdir=self.initialDirectoryDict[ 'OpenSaveModel' ]) self.initialDirectoryDict[ 'OpenSaveModel' ] = os.path.dirname(file) #set directory preference results = compile_from_path([location]); rfile = open(file,"w"); for result in results: rfile.write(result) rfile.close()