-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
151 lines (138 loc) · 4.32 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
from subprocess import check_output
from os import system
import logging
logging.basicConfig(level=logging.INFO)
# import gntp.notifier
import sys
import os
# sys.path.insert(0, "C:\Users\Kartikye\Downloads\Leap_Motion_SDK_Windows_2.2.2\LeapDeveloperKit_2.2.2+24469_win\LeapSDK\lib")
sys.path.insert(0, "/LeapSDK/lib")
import LeapPython
import Leap
# import speech_recognition as sr
import time
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~BUUUUUGGGGGGGGG
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~BUUUUUGGGGGGGGGs
controller = Leap.Controller();
controller.set_policy(Leap.Controller.POLICY_BACKGROUND_FRAMES)
controller.set_policy(Leap.Controller.POLICY_IMAGES)
controller.set_policy(Leap.Controller.POLICY_OPTIMIZE_HMD)
controller.enable_gesture(Leap.Gesture.TYPE_SWIPE)
controller.enable_gesture(Leap.Gesture.TYPE_CIRCLE)
# growl = gntp.notifier.GrowlNotifier(
# applicationName = "GIT",
# notifications = ["New Updates","New Messages"],
# defaultNotifications = ["New Messages"],
# hostname = "localhost", # Defaults to localhost
# password = "" # Defaults to a blank password
# )
# growl.register()
while True:
frame = controller.frame()
time
for gesture in frame.gestures():
swipe = Leap.SwipeGesture(gesture)
'''print swipe.direction[0]
print swipe.direction[1]
print swipe.direction[2]
print "\n"'''
# if gesture == Leap.Gesture.TYPE_CIRCLE:
# growl.notify(
# noteType = "New Messages",
# title = "Merging",
# description = "Your Git is being merged",
# icon = "http://example.com/icon.png",
# sticky = False,
# priority = 1,
# )
# print "merge"
# print os.system('git merge')
# growl.notify(
# noteType = "New Messages",
# title = "Stashed",
# description = "Your Git was merged",
# icon = "http://example.com/icon.png",
# sticky = False,
# priority = 1,
# )
if abs(swipe.direction[0]) > abs(swipe.direction[1]) and abs(swipe.direction[0]) > abs(swipe.direction[2]):
if swipe.direction[0] < .5:
print "stash"
print os.system('git stash')
# growl.notify(
# noteType = "New Messages",
# title = "Stashed",
# description = "Your Git was stashed",
# icon = "http://example.com/icon.png",
# sticky = False,
# priority = 1,
# )
elif abs(swipe.direction[1]) > abs(swipe.direction[0]) and abs(swipe.direction[1]) > abs(swipe.direction[2]):
if swipe.direction[1] < .5:
# growl.notify(
# noteType = "New Messages",
# title = "Committing",
# description = "Your Git is being committing",
# icon = "http://example.com/icon.png",
# sticky = False,
# priority = 1,
# )
print "commit"
print os.system('git add -A')
print os.system('git commit -a -m "from my leap"')
system('say commit')
# growl.notify(
# noteType = "New Messages",
# title = "Commited",
# description = "Your Git was commited",
# icon = "http://example.com/icon.png",
# sticky = False,
# priority = 1,
# )
elif abs(swipe.direction[2]) > abs(swipe.direction[1]) and abs(swipe.direction[2]) > abs(swipe.direction[0]):
if swipe.direction[2] > .5:
# growl.notify(
# noteType = "New Messages",
# title = "Pulling",
# description = "Your Git is being pulled",
# icon = "http://example.com/icon.png",
# sticky = False,
# priority = 1,
# )
print "pull"
print os.system('git pull')
system('say pull')
# growl.notify(
# noteType = "New Messages",
# title = "Pulled",
# description = "Your Git was pulled",
# icon = "http://example.com/icon.png",
# sticky = False,
# priority = 1,
# )
if swipe.direction[2] < .5:
# growl.notify(
# noteType = "New Messages",
# title = "Pushing",
# description = "Your Git is being pushed",
# icon = "http://example.com/icon.png",
# sticky = False,
# priority = 1,
# )
print "push"
print os.system('git push')
system('say push, hellyeah!')
# growl.notify(
# noteType = "New Messages",
# title = "Pushed",
# description = "Your Git was pushed",
# icon = "http://example.com/icon.png",
# sticky = False,
# priority = 1,
# )
'''if gesture.type == Leap.Gesture.TYPE_SCREEN_TAP:
print "0hello"
print os.system('git commit')
elif gesture.type == Leap.Gesture.TYPE_KEY_TAP:
print "bye"
print check_output("git push")'''