# Path: pygaze/settings.py
# class Settings(object):
#     def __init__(self):
#     def read_module(self, mod):
#     def __getattr__(self, setting):
#     def __setattr__(self, setting, value):


from pygaze import settings
	from PIL import Image
import sys
		import vidcap
	import pygame.camera
	import pygame.image
	# if this fails, we try vidcap (only works on Windows)
	except:
		if sys.platform == 'win32':
			# loop through 100 numbers (0-99) and see if they work
			devlist = []
			for i in range(100):
				# try if this device number works
				try:
					dev = vidcap.new_Dev(i, 0)	# new device
					devlist.append(i)			# add dev nr to list
					del dev				# delete device again
				# if the device number does not work, simply do nothing
				except:
					pass
		# if PyGame did not work and we're not on Windows, raise exception
		else:
			raise Exception("Error in libwebcam.available_devices: could not use PyGame or vidcap to find devices!")
	
	return devlist


# # # # #
# classes

class Camera:
	
	"""A class for communication with webcams, that uses vidcap on Windows
	and PyGame on all other platforms (even if DISPTYPE is set to
	'psychopy'!)"""
	

# Path: pygaze/settings.py
# class Settings(object):
#     def __init__(self):
#     def read_module(self, mod):
#     def __getattr__(self, setting):
#     def __setattr__(self, setting, value):


# Path: additional_libraries/libwebcam.py
from pygaze import settings
	from PIL import Image
import sys
		import vidcap
	import pygame.camera
	import pygame.image

	# if this fails, we try vidcap (only works on Windows)
	except:
		if sys.platform == 'win32':
			# loop through 100 numbers (0-99) and see if they work
			devlist = []
			for i in range(100):
				# try if this device number works
				try:
					dev = vidcap.new_Dev(i, 0)	# new device
					devlist.append(i)			# add dev nr to list
					del dev				# delete device again
				# if the device number does not work, simply do nothing
				except:
					pass
		# if PyGame did not work and we're not on Windows, raise exception
		else:
			raise Exception("Error in libwebcam.available_devices: could not use PyGame or vidcap to find devices!")
	
	return devlist


# # # # #
# classes

class Camera:
	
	"""A class for communication with webcams, that uses vidcap on Windows
	and PyGame on all other platforms (even if DISPTYPE is set to
	'psychopy'!)"""
	

	def __init__(self, disptype=settings.DISPTYPE, dev=None, devtype='pygame',