-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
90 lines (72 loc) · 3.72 KB
/
main.py
File metadata and controls
90 lines (72 loc) · 3.72 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
import customtkinter as ctk
from tkinter import filedialog
import os
from DeflectionData.deflection import Deflection
import ExcelPrint
import workbookCreation
save_file_location = "C:\\Users\\" + os.path.expanduser('~').split("\\")[-1] + "\\OneDrive - DuPont\\Desktop"
def upload():
if entry1.get() == "":
save_file = "Results.xlsx"
else:
save_file = entry1.get() + " Deflection Results.xlsx"
file_path = filedialog.askopenfilenames(filetypes=[("csv file", ".csv")])
root.after(0, run(save_file=save_file, file_path=file_path))
def save_location():
global save_file_location
save_file_location = filedialog.askdirectory()
def run(save_file, file_path):
workbook_class = workbookCreation.Workbook(save_file_location=save_file_location,
save_file=save_file,
number_of_samples=len(file_path))
number_of_sheets = 1
for filename in file_path:
if filename.split('/')[-1].split('_')[0] == "Specimen":
header = 0
else:
header = 2
my_deflection = Deflection(filename=filename,
headers_num=8,
headers_offset=header)
ExcelPrint.worksheet_raw_print(workbook=workbook_class.workbook,
my_deflection=my_deflection)
ExcelPrint.print_summary_worksheet(worksheet=workbook_class.worksheet_summary,
my_deflection=my_deflection,
number_of_sheets=number_of_sheets)
# Pressure-Deflection
ExcelPrint.insert_values_into_chart(chart=workbook_class.pressure_deflection_chart,
data_length=len(my_deflection.sample_load_array),
x_col=5,
y_col=3,
sample_name=my_deflection.sample_name)
# Force-Displacement
ExcelPrint.insert_values_into_chart(chart=workbook_class.force_displacement_chart,
data_length=len(my_deflection.sample_load_array),
x_col=1,
y_col=2,
sample_name=my_deflection.sample_name)
# Pressure-CompressionRate
ExcelPrint.insert_values_into_chart(chart=workbook_class.pressure_compression_rate_chart,
data_length=len(my_deflection.sample_load_array),
x_col=7,
y_col=4,
sample_name=my_deflection.sample_name)
number_of_sheets += 1
workbook_class.workbook.close()
ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("dark-blue")
root = ctk.CTk()
root.geometry("500x350")
frame = ctk.CTkFrame(master=root)
frame.pack(pady=20, padx=60, fill="both", expand=True)
label = ctk.CTkLabel(master=frame, text="Write save file name,\nchoose save location,\nthen select samples.",
font=("Helvetica", 24))
label.pack(pady=12, padx=10)
entry1 = ctk.CTkEntry(master=frame, placeholder_text="Save File Name")
entry1.pack(pady=12, padx=10)
button = ctk.CTkButton(master=frame, text="Select Save Location", command=save_location)
button.pack(pady=12, padx=10)
button2 = ctk.CTkButton(master=frame, text="Select Samples", command=upload)
button2.pack(pady=12, padx=10)
if __name__ == "__main__":
root.mainloop()