コード例 #1
0
def exportSCXML(self):
	#launch dialog, choose location to write file, return that location
	file=tkFileDialog.asksaveasfilename(initialfile=defaultSCXMLOutputFileName, 
	      filetypes=[("SCXML files", "*.scxml")], 
	      initialdir=self.initialDirectoryDict[ 'OpenSaveModel' ])

	self.initialDirectoryDict[ 'OpenSaveModel' ] = os.path.dirname(file) 	#set directory preference

	generate(self.ASGroot.listNodes,file)
	return file
コード例 #2
0
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()