#
# Making a basic plot
#
import os
import subprocess

#
# location of Petronode install folder
#
cBatchProcessorFolder = "C:\\Program Files\\Petronode"

#
# create plot
#
def Create_Plot ( workfolder, output, cdl):
	Params = [os.path.join( cBatchProcessorFolder, "Petronode.SlideComposer.exe")]
	Params += [ os.path.join( workfolder, output + ".def")]
	Params += [ workfolder]
	Params += [ workfolder]
	Params += [ "/s"]
	print( "Creating control file " + Params[1])
	f = open (Params[1], "w")
	for l in cdl: f.write( l + "\n")
	f.close()
	print( "Starting Slide Composer: ")
	print( Params)
	subprocess.call( Params)
	print( "Image Processing Completed")

Name = input ( "What is your name? ")
lines = []
lines += ["#"]
lines += ["#  Create test image"]
lines += ["#"]
lines += ["slide (Test, 300, 200, png)"]
lines += ["shape (10, 10, 280, 120, rectangle, 3.0, FF000000, FFAA0000)"]
lines += ["labelover ( 20, 20, 260, 30)"]
lines += ["\tText =Hello, " + Name + "!" ]
lines += ["\tFontSize = 12.0"]

Create_Plot( ".", "Example_09", lines)
os.startfile( "Test_image.png")
