Esempio n. 1
0
def get_imageFile_from_microscope(winReg_location, winReg_separator, winReg_waitIntervall):
	txt_out("waiting for microscope...")

	wr = WindowsRegistry()
	#reg = wr.writeRegistry(winReg_location,"Code","0")
	#reg = wr.writeRegistry(winReg_location,"filepath",test_filename)
	#txt_out("write: "+reg)

	while True:
		# check microscope status 
		time.sleep(winReg_waitIntervall)
		
		output = wr.readRegistry(winReg_location,"Code")
		#txt_out("microscope status: " + str(output))
		#winReg_address, winReg_name, winReg_type, winReg_value =  output.split(winReg_separator)
		winReg_rest, winReg_value = output.split(winReg_separator)
		code = winReg_value.strip()
		if (code==LSM510_CODE_READIMAGE) or (code==LSM510_CODE_READIMAGE_HIGHRES) :
			txt_out("microscope requesting action! obtaining image file name...")
			output = wr.readRegistry(winReg_location,"filepath")
			#winReg_address, winReg_name, winReg_type, winReg_value =  output.split(winReg_separator)
			winReg_rest, winReg_value = output.split(winReg_separator)
			image_file = winReg_value.strip()  # get rid of the line feed and stuff like this
			txt_out("image file name: " + image_file)
			txt_out("code: " + code)
			# tell all programs to wait
			reg = wr.writeRegistry(winReg_location,"Code",LSM510_CODE_ALLWAIT)
			break
			
	return code, image_file