-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector_program.py
More file actions
275 lines (221 loc) · 10.9 KB
/
Copy pathvector_program.py
File metadata and controls
275 lines (221 loc) · 10.9 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
import json
import os
import threading
from pathlib import Path
from IPython.external.qt_for_kernel import QtCore
import hateTouch, text_screen, play_audio, show_photo, camera, pingpong, eyeGame
import remote_control, command_change, Chatbot, accel_balancing
import anki_vector
import random
from anki_vector.events import Events
from anki_vector.user_intent import UserIntent, UserIntentEvent
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QToolTip, QMainWindow, QDesktopWidget, qApp, QAction, \
QMessageBox, QLabel
from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtGui import QIcon
class ThreadClass(QtCore.QThread):
def __init__(self, parent = None):
super(ThreadClass,self).__init__(parent)
def run(self):
pass
class MyApp(QMainWindow):
hate = hateTouch.HateTouch()
def __init__(self):
super().__init__()
#self.threadclass = ThreadClass()
self.initUI()
def initUI(self):
QToolTip.setFont(QFont('SansSerif', 10))
self.setWindowTitle('ANKI Vector SDK Coding')
#self.move(300, 300) #위젯을 스크린의 x=300px, y=300px의 위치로 이동시킵니다.
#self.resize(400, 200)#위젯의 크기를 너비 400px, 높이 200px로 조절합니다.
self.setWindowIcon(QIcon('vector.ico'))
#self.setGeometry(0, 0, 600, 600)#창의 위치와 크기를 설정합니다. 앞의 두 매개변수는 창의 x, y 위치를 결정하고, 뒤의 두 매개변수는 각각 창의 너비와 높이를 결정합니다.
self.setFixedSize(600, 620)
label1 = QLabel('1. 벡터 얼굴 글씨 띄우기', self)
label1.resize(230,30)
label1.move(10, 45)
label1.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label2 = QLabel('2. 벡터 만지거나 들지마', self)
label2.resize(230,30)
label2.move(10, 85)
label2.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label3 = QLabel('3. 벡터 음악 재생', self)
label3.resize(230, 30)
label3.move(10, 125)
label3.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label4 = QLabel('4. 벡터 찍은 사진 보기', self)
label4.resize(230, 30)
label4.move(10, 165)
label4.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label5 = QLabel('5. 벡터 화면 카메라 띄우기', self)
label5.resize(230, 30)
label5.move(10, 205)
label5.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label6 = QLabel('6. 벡터 채팅봇 beta', self)
label6.resize(230, 30)
label6.move(10, 245)
label6.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label7 = QLabel('7. 벡터 명령응답 조작', self)
label7.resize(230, 30)
label7.move(10, 285)
label7.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label8 = QLabel('8. 벡터 직접 조종', self)
label8.resize(230, 30)
label8.move(10, 325)
label8.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label9 = QLabel('9. 벡터 핑퐁', self)
label9.resize(230, 30)
label9.move(10, 365)
label9.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label10 = QLabel('10. 벡터 눈색깔 맞추기', self)
label10.resize(230, 30)
label10.move(10, 405)
label10.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
label11 = QLabel('11. 벡터 수평 유지', self)
label11.resize(230, 30)
label11.move(10, 445)
label11.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
# label12 = QLabel('12. 벡터 지형 뷰어', self)
# label12.resize(230, 30)
# label12.move(10, 485)
# label12.setStyleSheet("background-color:#DDDDDD;color:green;font-size:15px;font-weight:bold")
#========================================================================
btn1 = QPushButton('시작', self)
btn1.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn1.move(250, 45)
btn1.resize(50,30)
btn1.clicked.connect(text_screen.run)
btn2 = QPushButton('시작', self)
btn2.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn2.move(250, 85)
btn2.resize(50,30)
btn2.clicked.connect(lambda : self.btn2_isClicked(True))
btn2_ = QPushButton('종료', self)
btn2_.move(310, 85)
btn2_.resize(50,30)
btn2_.clicked.connect(lambda : self.btn2_isClicked(False))
btn3 = QPushButton('시작', self)
btn3.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn3.move(250, 125)
btn3.resize(50, 30)
btn3.clicked.connect(lambda : self.btn3_isClicked(True))
btn3_ = QPushButton('종료', self)
btn3_.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn3_.move(310, 125)
btn3_.resize(50, 30)
btn3_.clicked.connect(lambda : self.btn3_isClicked(False))
btn4 = QPushButton('시작', self)
btn4.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn4.move(250, 165)
btn4.resize(50, 30)
btn4.clicked.connect(show_photo.main)
btn5 = QPushButton('시작', self)
btn5.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn5.move(250, 205)
btn5.resize(50, 30)
btn5.clicked.connect(lambda : self.btn5_isClicked(True))
btn5_ = QPushButton('종료', self)
btn5_.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn5_.move(310, 205)
btn5_.resize(50, 30)
btn5_.clicked.connect(lambda : self.btn5_isClicked(False))
btn6 = QPushButton('시작', self)
btn6.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn6.move(250, 245)
btn6.resize(50, 30)
btn6.clicked.connect(lambda : self.btn6_isClicked(True))
btn6_ = QPushButton('종료', self)
btn6_.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn6_.move(310, 245)
btn6_.resize(50, 30)
btn6_.clicked.connect(lambda : self.btn6_isClicked(False))
btn7 = QPushButton('시작', self)
btn7.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn7.move(250, 285)
btn7.resize(50, 30)
btn7.clicked.connect(lambda : self.btn7_isClicked(True))
btn7_ = QPushButton('종료', self)
btn7_.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn7_.move(310, 285)
btn7_.resize(50, 30)
btn7_.clicked.connect(lambda : self.btn7_isClicked(False))
btn8 = QPushButton('시작', self)
btn8.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn8.move(250, 325)
btn8.resize(50, 30)
btn8.clicked.connect(remote_control.run)
btn9 = QPushButton('시작', self)
btn9.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn9.move(250, 365)
btn9.resize(50, 30)
btn9.clicked.connect(pingpong.main)
btn10 = QPushButton('시작', self)
btn10.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn10.move(250, 405)
btn10.resize(50, 30)
btn10.clicked.connect(eyeGame.main)
btn11 = QPushButton('시작', self)
btn11.setToolTip('벡터가 <b>text.txt</b>에 써져있는 대사를 합니다.')
btn11.move(250, 445)
btn11.resize(50, 30)
btn11.clicked.connect(accel_balancing.main)
self.statusBar().reformat()
self.statusBar().setStyleSheet("color: red; background-color: yellow; font-size:25px;font-weight:bold")
self.statusBar().showMessage('벡터 자율행동중..')
exitAction = QAction(QIcon('exit.png'), 'Exit', self)#객체 저장
exitAction.setShortcut('Ctrl+Q')#단축키
exitAction.setStatusTip('Exit application')#상태 팁
exitAction.triggered.connect(qApp.quit)#생성된(triggered) 시그널이 QApplication 위젯의 quit() 메서드에 연결되고, 어플리케이션을 종료시키게 됩니다.
menubar = self.menuBar()#menuBar() 메서드는 메뉴바를 생성합니다. 이어서 ‘File’ 메뉴를 하나 만들고, 거기에 ‘exitAction’ 동작을 추가합니다.
menubar.setNativeMenuBar(False)
fileMenu = menubar.addMenu('&File')#‘&File’의 앰퍼샌드(ampersand, &)는 간편하게 단축키를 설정하도록 해줍니다. ‘F’ 앞에 앰퍼샌드가 있으므로 ‘Alt+F’가 File 메뉴의 단축키가 됩니다. 만약 ‘i’의 앞에 앰퍼샌드를 넣으면 ‘Alt+I’가 단축키가 됩니다.
fileMenu.addAction(exitAction)
self.center()#화면 가운데로
self.show()
def center(self):
qr = self.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
def btn2_isClicked(self, bool):
if bool:
self.statusBar().showMessage('벡터 2번 명령 수행중..')
self.hate.run()
else :
self.statusBar().showMessage('벡터 자율행동중..')
self.hate.stop()
def btn3_isClicked(self, bool):
if bool:
self.statusBar().showMessage('벡터 3번 명령 수행중..')
play_audio.run()
else :
self.statusBar().showMessage('벡터 자율행동중..')
play_audio.stop()
def btn5_isClicked(self, bool):
if bool:
self.statusBar().showMessage('벡터 5번 명령 수행중..')
camera.run()
else :
self.statusBar().showMessage('벡터 자율행동중..')
camera.stop()
def btn6_isClicked(self, bool):
if bool:
self.statusBar().showMessage('벡터 6번 명령 수행중..')
Chatbot.run()
else :
self.statusBar().showMessage('벡터 자율행동중..')
Chatbot.stop()
def btn7_isClicked(self, bool):
if bool:
self.statusBar().showMessage('벡터 7번 명령 수행중..')
command_change.run()
else :
self.statusBar().showMessage('벡터 자율행동중..')
command_change.stop()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = MyApp()
sys.exit(app.exec_())