super(MainGuiController, self).__init__(
			data, 
			'Energy',
			'EnergyErr',
			'Count',
			'CountErr',
			basefilename, 
			start, 
			end, 
			config.test_x_axis_label, 
			config.test_y_axis_label, 
			x_majorticks=config.test_x_majorticks, 
			x_minorticks=config.test_x_minorticks, 
			x_length=end-start, 
			fontsize = config.fontsize, 
			figWidth=config.plotwidth, 
			figHeight=config.plotheight, 
			config=config)

if __name__ == '__main__': #means it's only gonna work when run from the command line
	#Start script
	printHello()
	datafilename = config.datafile
	bkgfilename = config.backgroundfile
	energycalibrationfilename = config.energycalibrationfile
	data = loadTestFileAndCalculateEnergy(datafilename, bkgfilename, energycalibrationfilename, config.durationRegex)
	basefilename = os.path.basename(datafilename)[0:-4] #basename gets just the filename, [0:-4] gets the part without the extension
	mgc = MainGuiController(data, basefilename, config.datastart, config.dataend)
	mgc.printInstructions(intro="Remember: its:", prefix='\t')
	mgc.show()
		
	def show(self):
		plt.show()

	#Callback functions
	def addTestData(self): 
		pass
	def deleteLastPlot(self):
		pass
	
	#Handle key presses
	def handle_key(self, event):
		if event.key in ['A', 'a']:
			addTestData()
		elif event.key in ['D', 'd']:
			deleteLastPlot()
		else:
			print 'Detected keypress {0}, unknown command'.format(event.key)



if __name__ == '__main__':
	mgc = MainGuiController()
	mgc.init(config.datastart, config.dataend)
	mgc.setTitle(config.title)
	for (filepath, background, energyfitpath, label, fmt) in config.inputfiles:
		data = loadTestFileAndCalculateEnergy(filepath, background, energyfitpath, config.durationRegex, config.rescaletoduration)
		mgc.addPlot(data, label, fmt)
	mgc.generateLegend()
	mgc.show()