Exemplo n.º 1
0
	def addNewInformation(self, l, camMod = False):
		coord_center = CoordTransformer()
		#coord_center.setInfo(640, 480, 400, 300)
		coord_center.setInfo(640, 480, 900, 550)
		
		i = int(l[1])
		typ = l[0]
		x = -1.
		y = -1.
		if (len(l) > 2):
		 	x = int(l[2])
		 	y = int(l[3])
			if camMod:
				(x, y) = coord_center.newCoord(x, y)
				#print (x, y)
		d = 0.
		maxd = -1.
		# down & rien
		if len(self.gestureList) == 0 and typ != "up":
			self.newCoordonate(i, typ, x, y)
		elif len(self.gestureList) > 0 and typ == "up":
			self.newCoordonate(i, typ, x, y)
		elif len(self.gestureList) > 0 and typ == "down":
			lastG = None
			for g in self.gestureList:
				(sx, sy, sx0, sy0, t) = g.getCoordonate()
				#g.printGesture()
				d = self.distance(x, y, sx, sy)
				#print "D = ", d, "<", x, y, "> <", sx, sy, ">"
				if (d <= maxd or maxd == -1) and d <= self.maxBruit:
					maxd = d
					lastG = g
					i = g.getId()
			if not lastG is None:
				lastG.printGesture()
			if (maxd != -1):
				self.newCoordonate(i, typ, x, y)
Exemplo n.º 2
0
g_center = GestureCenter()
w_center = WidgetCenter()
center = MoveNotificationCenter()
loader = WidgetLoader()
files = glob.glob("../Widgets/WidgetsFiles/*")
for f in files:
	w_center.subscribeNewWidget(loader.loadFile(f))
widget_menu = w_center.getWidgetMenu()
w_center.subscribeNewWidget(widget_menu)
w_center.printWidgetList()
#w_center.subscribeNewWidget(w)
#w_center.subscribeNewWidget(w2)

#w_center.subscribeNewWidget(view1)
gf_center = GfCenter()
coord_center = CoordTransformer()
#coord_center.setInfo(640, 480, 400, 300)
coord_center.setInfo(640, 480, 900, 550)


def connectToInputStream(filename = ""):
	if (filename != ""):
		try:
			f = open(filename, "r")
			return f
		except Exception as inst:
			print type(inst)
			print inst
			return connectToInputStream("")
	else:
		try:
Exemplo n.º 3
0
from CoordTransformer.CoordTransformer import *

t = CoordTransformer()
t.setInfo(640, 43, 900, 550)
x = 0
y = 43

(x, y) = t.newCoord(x, y)
print x, y