# Path: kelpy/DragDrop.py
# class DragSprite(CommandableImageSprite, Dragable):
# 	"""
# 		The DragSprite is used to create a dragable sprite. It is written so that you feed it similar parameters that you would feed a regualar CommandableImageSprite.
# 		The only difference is that this sprite is able to be dragged around, once the drag and drop function is run in the main event loop (object.process_dragndrop(event))
# 	"""
# 	def __init__(self, canvas, initial_position, imgpath, rotation=0, scale=.20):
# 		CommandableImageSprite.__init__(self, canvas, initial_position, imgpath, rotation, scale)
# 		Dragable.__init__(self)
# 		self.set_x(initial_position[0])
# 		self.set_y(initial_position[1])
# 		self.set_height(self.display_image.get_height())
# 		self.set_width(self.display_image.get_width())
# 
# class DropSprite(CommandableImageSprite, Arrangeable):
# 	"""
# 		The DropSprite class is used to create a sprite with a drop zone on top of it. You then register the drop zone via the DragSprite.register_drop_zone(DropSprite) line.
# 		
# 	"""
# 	def __init__(self, canvas, initial_position, imgpath, rotation=0, scale=.20):
# 		CommandableImageSprite.__init__(self, canvas, initial_position, imgpath, rotation, scale)
# 		Arrangeable.__init__(self)
# 		self.set_x(initial_position[0])
# 		self.set_y(initial_position[1])
# 		self.set_height(self.display_image.get_height())
# 		self.set_width(self.display_image.get_width())


import os, sys
import pygame
import glob
import numpy
from random import randint, choice, sample, shuffle
from time import time,sleep
from kelpy.GIFImage import *
from kelpy.CommandableImageSprite import *
from kelpy.Miscellaneous import *
from kelpy.DisplayQueue import *
from kelpy.OrderedUpdates import *
from kelpy.EventHandler import *
from kelpy.DragDrop import DragSprite, DropSprite
from kelpy.DragDrop import *
from kelpy.tobii.TobiiSimController import *
from kelpy.tobii.TobiiSprite import *
	#to calculate proportion of looks
	w0,w1,w2,w3=0,0,0,0
	w0_counter = 0
	item_start=time()
	#in order to pause the experiment
	global paused
	if not paused:

		#haven't looked away yet, keep running
		started_lookaway = False

		#if they lookaway for _ seconds
		lookaway_for_time =2.0

		if not use_tobii_sim:
		# start recording the "eye gaze" data
			tobii_controller.start_tracking()

		# A queue of animation operations
		trial_start = time()
		#create the windows as TobiiSprites so they are eye-trackable

		w0 = TobiiSprite(screen, window_positions[0], kstimulus("laura_diss/window.jpg"), scale=.35,tobii_controller=tobii_controller)
		w1 = TobiiSprite(screen, window_positions[1], kstimulus("laura_diss/window.jpg"), scale=.35,tobii_controller=tobii_controller)
		w2 = TobiiSprite(screen, window_positions[2], kstimulus("laura_diss/window.jpg"), scale=.35,tobii_controller=tobii_controller)
		w3 = TobiiSprite(screen, window_positions[3], kstimulus("laura_diss/window.jpg"), scale=.35,tobii_controller=tobii_controller)
		# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

		images = [
		CommandableImageSprite(screen, OFF_LEFT, images[0], scale=IMAGE_SCALE, name="0"),

# Path: kelpy/DragDrop.py
# class DragSprite(CommandableImageSprite, Dragable):
# 	"""
# 		The DragSprite is used to create a dragable sprite. It is written so that you feed it similar parameters that you would feed a regualar CommandableImageSprite.
# 		The only difference is that this sprite is able to be dragged around, once the drag and drop function is run in the main event loop (object.process_dragndrop(event))
# 	"""
# 	def __init__(self, canvas, initial_position, imgpath, rotation=0, scale=.20):
# 		CommandableImageSprite.__init__(self, canvas, initial_position, imgpath, rotation, scale)
# 		Dragable.__init__(self)
# 		self.set_x(initial_position[0])
# 		self.set_y(initial_position[1])
# 		self.set_height(self.display_image.get_height())
# 		self.set_width(self.display_image.get_width())
# 
# class DropSprite(CommandableImageSprite, Arrangeable):
# 	"""
# 		The DropSprite class is used to create a sprite with a drop zone on top of it. You then register the drop zone via the DragSprite.register_drop_zone(DropSprite) line.
# 		
# 	"""
# 	def __init__(self, canvas, initial_position, imgpath, rotation=0, scale=.20):
# 		CommandableImageSprite.__init__(self, canvas, initial_position, imgpath, rotation, scale)
# 		Arrangeable.__init__(self)
# 		self.set_x(initial_position[0])
# 		self.set_y(initial_position[1])
# 		self.set_height(self.display_image.get_height())
# 		self.set_width(self.display_image.get_width())


# Path: examples/LauraSequences/Main.py
import os, sys
import pygame
import glob
import numpy
from random import randint, choice, sample, shuffle
from time import time,sleep
from kelpy.GIFImage import *
from kelpy.CommandableImageSprite import *
from kelpy.Miscellaneous import *
from kelpy.DisplayQueue import *
from kelpy.OrderedUpdates import *
from kelpy.EventHandler import *
from kelpy.DragDrop import DragSprite, DropSprite
from kelpy.DragDrop import *
from kelpy.tobii.TobiiSimController import *
from kelpy.tobii.TobiiSprite import *

	#to calculate proportion of looks
	w0,w1,w2,w3=0,0,0,0
	w0_counter = 0
	item_start=time()
	#in order to pause the experiment
	global paused
	if not paused:

		#haven't looked away yet, keep running
		started_lookaway = False

		#if they lookaway for _ seconds
		lookaway_for_time =2.0

		if not use_tobii_sim:
		# start recording the "eye gaze" data
			tobii_controller.start_tracking()

		# A queue of animation operations
		trial_start = time()
		#create the windows as TobiiSprites so they are eye-trackable

		w0 = TobiiSprite(screen, window_positions[0], kstimulus("laura_diss/window.jpg"), scale=.35,tobii_controller=tobii_controller)
		w1 = TobiiSprite(screen, window_positions[1], kstimulus("laura_diss/window.jpg"), scale=.35,tobii_controller=tobii_controller)
		w2 = TobiiSprite(screen, window_positions[2], kstimulus("laura_diss/window.jpg"), scale=.35,tobii_controller=tobii_controller)
		w3 = TobiiSprite(screen, window_positions[3], kstimulus("laura_diss/window.jpg"), scale=.35,tobii_controller=tobii_controller)
		# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

		images = [
		CommandableImageSprite(screen, OFF_LEFT, images[0], scale=IMAGE_SCALE, name="0"),

		CommandableImageSprite(screen, OFF_LEFT, images[1], scale=IMAGE_SCALE,name="1"),