-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathController.py
74 lines (54 loc) · 2.26 KB
/
Controller.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
from PyQt5 import QtWidgets, uic
from PyQt5.QtCore import pyqtSlot
from motionViewController import Ui_MainWindow
import sys
motorNamesArray = ["headPitchBox", "headYawBox",
"elbowPitchRightBox", "shoulderRollRightBox", "shoulderPitchRightBox",
"elbowPitchLeftBox", "shoulderRollLeftBox", "shoulderPitchLeftBox",
"hipPitchRightBox", "hipRollRightBox", "hipYawRightBox", "hipPitchLeftBox",
"hipRollLeftBox", "hipYawLeftBox",
"kneePitchRightBox",
"kneePitchLeftBox",
"ankleRollLeftBox", "anklePitchLeftBox",
"ankleRollRightBox", "anklePitchRightBox"]
oldMotorValues = []
class motionToolWindow(QtWidgets.QMainWindow):
def __init__(self):
super(motionToolWindow, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
# Buttons
self.clearButton = self.findChild(QtWidgets.QPushButton, 'clearButton')
self.clearButton.clicked.connect(self.clearButtonClicked)
self.setButton = self.findChild(QtWidgets.QPushButton, 'setButton')
self.setButton.clicked.connect(self.setButtonClicked)
self.pos0Button = self.findChild(QtWidgets.QPushButton, 'pos0Button')
self.pos0Button.clicked.connect(self.pos0ButtonClicked)
self.show()
def clearButtonClicked(self):
global motorNamesArray
print('clear Button Clicked')
for x in motorNamesArray:
# print(motorNamesArray)
self.nameOfMotors = self.findChild(QtWidgets.QDoubleSpinBox, x)
self.nameOfMotors.setValue(0.0)
print(self.nameOfMotors.value())
def setButtonClicked(self):
for nameOfObject in motorNamesArray:
self.nameOfMotors = self.findChild(QtWidgets.QDoubleSpinBox, nameOfObject)
currentValue = self.nameOfMotors.value()
self.nameOfMotors.setValue(currentValue)
print("set " + str(currentValue) + " for " + str(nameOfObject))
print('set Button Clicked')
_set()
def pos0ButtonClicked(self):
print('pos0 Button Clicked')
def get():
print("get func called")
def _set():
print("_set func called")
if __name__ == '__main__':
app = QtWidgets.QApplication([])
application = motionToolWindow()
application.show()
sys.exit(app.exec())