-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
83 lines (61 loc) · 2.8 KB
/
main.py
File metadata and controls
83 lines (61 loc) · 2.8 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
from LoadCellMath import Load_cell_math
from LoadCellGraph import testing_UI
from PyQt6.QtWidgets import QApplication, QWidget, QLineEdit, QPushButton, QVBoxLayout, QFormLayout, QLabel, QHBoxLayout, QMessageBox
import sys
import traceback
import os
class Window(QWidget):
def main():
def submit(): #this runs when you submit your values
os.system('cls')
values = {
#'lowerthrust': float(lower_thrust_input.text()),
'min_pressure': float(min_pressure_input.text()),
#'maxthrust_precent': float(maxthrust_precent_input.text()),
#'spacing': int(spacing_input.text())
}
try:
math = Load_cell_math(values["min_pressure"])
filtered_pressure_above_20N, filtered_thrust_above_20N, filtered_time_above_20N, impulse, time_ms, end_A20N, start_A20N = math.calculations()
graph = testing_UI()
graph.plots(filtered_pressure_above_20N, filtered_thrust_above_20N,
filtered_time_above_20N, impulse, time_ms, end_A20N, start_A20N)
except Exception as e:
print(f"Basic error:\n {e} \n")
print("Advanced error log: ")
traceback.print_exc()
QMessageBox.information(window, "Error", "Failed Calculations & Graphing.")
app = QApplication(sys.argv)
#Create window
window = QWidget()
window.resize(100,100)
window.setWindowTitle("Import values")
layout = QFormLayout()
#Create inputs
#lower_thrust_label = QLabel("Lower Thrust: ")
#lower_thrust_input = QLineEdit()
min_pressure_label = QLabel("Min Pressure (filter points w/ pressure below this, recommend 10psi): ")
min_pressure_input = QLineEdit()
#maxthrust_precent_label = QLabel("Max Thrust %: ")
#maxthrust_precent_input = QLineEdit()
#spacing_label = QLabel("Spacing: ")
#spacing_input = QLineEdit()
#Make inputs visible
#layout.addRow(lower_thrust_label, lower_thrust_input)
layout.addRow(min_pressure_label, min_pressure_input)
#layout.addRow(maxthrust_precent_label, maxthrust_precent_input)
#layout.addRow(spacing_label, spacing_input)
#Add submit values button
button_layout = QHBoxLayout()
submit_button = QPushButton('Submit')
submit_button.clicked.connect(submit)
button_layout.addWidget(submit_button)
#make entire UI visible
main_layout = QVBoxLayout()
main_layout.addLayout(layout)
main_layout.addLayout(button_layout)
window.setLayout(main_layout)
window.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()