forked from bgkatz/Dyno-Software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguiFunctions.py
109 lines (90 loc) · 2.62 KB
/
guiFunctions.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
def enableTMControls():
ui.testVMinBox.setEnabled(True)
ui.testVMaxBox.setEnabled(True)
ui.testVSetBox.setEnabled(True)
ui.periodMinBox.setEnabled(True)
ui.periodMaxBox.setEnabled(True)
ui.periodBox.setEnabled(True)
def disableTMControls():
ui.testVMinBox.setEnabled(False)
ui.testVMaxBox.setEnabled(False)
ui.testVSetBox.setEnabled(False)
ui.periodMinBox.setEnabled(False)
ui.periodMaxBox.setEnabled(False)
ui.periodBox.setEnabled(False)
def enableRLControls():
ui.jBox.setEnabled(True)
ui.c1Box.setEnabled(True)
ui.c2Box.setEnabled(True)
def disableRLControls():
ui.jBox.setEnabled(False)
ui.c1Box.setEnabled(False)
ui.c2Box.setEnabled(False)
def enableMSControls():
ui.speedSlider.setEnabled(True)
ui.sBox.setEnabled(True)
def disableMSControls():
ui.speedSlider.setEnabled(False)
ui.sBox.setEnabled(False)
def enableProfileControls():
ui.browseButton.setEnabled(True)
ui.csvEdit.setEnabled(True)
ui.startButton.setEnabled(True)
ui.stopButton.setEnabled(True)
def disableProfileControls():
ui.browseButton.setEnabled(False)
ui.csvEdit.setEnabled(False)
ui.startButton.setEnabled(False)
ui.stopButton.setEnabled(False)
def enableBuckControls():
ui.buckBox.setEnabled(True)
ui.iMaxBox.setEnabled(True)
def disableBuckControls():
ui.buckBox.setEnabled(False)
ui.iMaxBox.setEnabled(False)
def disableSelected():
disableRLControls()
disableMSControls()
disableProfileControls()
ui.speedSlider.setValue(0)
ui.sBox.setValue(0)
def rlSelected():
enableRLControls()
enableBuckControls()
enableTMControls()
disableMSControls()
disableProfileControls()
ui.sBox.setValue(0)
ui.speedSlider.setValue(0)
#dynoAbsorber.speedcmd = 0
def msSelected():
enableMSControls()
enableBuckControls()
enableTMControls()
disableRLControls()
disableProfileControls()
def profileSelected():
enableProfileControls()
disableRLControls()
disableMSControls()
disableTMControls()
disableBuckControls()
ui.sBox.setValue(0)
ui.speedSlider.setValue(0)
def logSelected():
if ui.logButton.isChecked():
filename = ui.filenameEdit.text()
filename = "Logs/" + filename+".csv"
try:
global writer, logFile
logFile = open(filename, "a")
writer = csv.writer(logFile, delimiter=',')
print("file opened")
except:
print("that's not a file")
else:
try:
logFile.close()
print("file closed")
except:
pass