You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.py 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. """
  2. Abhängigkeiten:
  3. - tkinter (Tkinter-Bibliothek)
  4. - recording (Modul für die Videoaufnahme)
  5. - processing (Modul für die Videoverarbeitung)
  6. - tkinter.filedialog (Dateiauswahldialog)
  7. - os
  8. Autor: Roberto Gelsinger
  9. Datum: 07.12.2023
  10. Version: Modulversion
  11. """
  12. import tkinter as tk
  13. from recording import start_recording, recording_finished_event
  14. from recording import start_recording,start_normal_recording,stop_normal_recording
  15. from processing import process_video
  16. from tkinter import filedialog
  17. from tkinter import simpledialog
  18. import os
  19. from PIL import ImageTk, Image
  20. import pandas as pd
  21. from excel_processing import process_all_videos_and_save_results
  22. from datetime import datetime
  23. recording_finished = False
  24. code_version= "1.0"
  25. current_dir = os.getcwd()
  26. testcase_excel_file_path = os.path.join(current_dir, 'code/testing/excel/Testcase_excel_dataset.xlsx')
  27. testruns_excel_file_path = os.path.join(current_dir, 'code/testing/excel/Testruns.xlsx')
  28. evaluation_excel_file_path = os.path.join(current_dir, 'Testcases_nach_Genauigkeit.xlsx')
  29. class VideoProcessingApp(tk.Tk):
  30. def __init__(self):
  31. super().__init__()
  32. self.title("Driving Simulator EVM")
  33. self.geometry('530x380')
  34. #self.resizable(False, False)
  35. self.frames = {}
  36. #init user interface()
  37. self.initialize_header_frame()
  38. self.initialize_toolbar()
  39. self.initialize_icon()
  40. self.setup_recording_controls()
  41. self.setup_testcase_controls()
  42. self.setup_testing_controls()
  43. self.setup_video_processing_controls()
  44. self.center_window()
  45. self.selected_button = None
  46. self.check_recording_status()
  47. self.mainloop()
  48. def open_testcase_excel_file(self):
  49. os.startfile(testcase_excel_file_path)
  50. def open_testrun_excel_file(self):
  51. os.startfile(testruns_excel_file_path)
  52. def open_evaluation_excel_file(self):
  53. os.startfile(evaluation_excel_file_path)
  54. def test_data_set(self):
  55. kommentar = self.testrun_kommentar_entry.get("1.0", "end-1c")
  56. process_all_videos_and_save_results(testcase_excel_file_path,testruns_excel_file_path,code_version,kommentar)
  57. def start_normal_recording_with_input(self):
  58. """
  59. Startet die Videoaufnahme mit dem eingegebenen Videonamen.
  60. Der Name wird aus dem Tkinter Entry-Widget gelesen.
  61. """
  62. video_name = self.video_name_entry.get() # Holt den Text aus dem Textfeld
  63. video_resolution1 = int(self.aufnahme_aufloesung1_entry.get())
  64. video_resolution2 = int(self.aufnahme_aufloesung2_entry.get())
  65. fps = int(self.aufnahme_fps_entry.get())
  66. start_normal_recording(video_name,video_resolution1,video_resolution2,fps)
  67. def write_to_excel(self, video_name, excel_path):
  68. # Datenerfassung
  69. date = datetime.now().strftime("%Y-%m-%d")
  70. time = datetime.now().strftime("%H:%M:%S")
  71. licht = self.testcase_licht_entry.get()
  72. webcam_name = self.testcase_kamera_entry.get()
  73. testperson_name = self.testcase_testperson_entry.get()
  74. abstand = int(self.testcase_abstand_entry.get())
  75. winkel = self.testcase_winkel_entry.get()
  76. hintergrund = self.testcase_hintergrund_entry.get()
  77. video_length = int(self.video_length_entry.get())
  78. auflösung = f"{int(self.testcase_resolution1_entry.get())}x{int(self.testcase_resolution2_entry.get())}"
  79. fps = int(self.testcase_fps_entry.get())
  80. kommentar = self.testcase_kommentar_entry.get("1.0", "end-1c")
  81. # Entferne die Dateiendung (z.B. '.avi') und extrahiere dann den Puls
  82. video_name_without_extension = video_name.split('.')[0]
  83. puls_part = video_name_without_extension.split('_')[-1]
  84. try:
  85. puls = int(puls_part)
  86. except ValueError:
  87. puls = '' # Setze Puls auf einen leeren String, falls keine gültige Zahl gefunden wird
  88. # Versuche, die vorhandene Datei zu lesen, erstelle eine neue, wenn sie nicht existiert
  89. try:
  90. existing_df = pd.read_excel(excel_path)
  91. except FileNotFoundError:
  92. existing_df = pd.DataFrame(columns=['Testcase','Date', 'Time', 'VideoName', 'CodeVersion', 'Testperson',
  93. 'Abstand', 'Videolänge', 'Webcam', 'Auflösung', 'FPS',
  94. 'Winkel', 'Hintergrund', 'Licht', 'Puls', 'Kommentar'])
  95. # Neue Datenreihe erstellen
  96. next_testcase_index = len(existing_df) + 1
  97. new_data = pd.DataFrame({'Testcase': [next_testcase_index],'Date': [date], 'Time': [time], 'VideoName': [video_name],
  98. 'CodeVersion': [code_version], 'Testperson': [testperson_name],
  99. 'Abstand': [abstand], 'Videolänge': [video_length], 'Webcam': [webcam_name],
  100. 'Auflösung': [auflösung], 'FPS': [fps], 'Winkel': [winkel],
  101. 'Hintergrund': [hintergrund], 'Licht': [licht], 'Puls': [puls],
  102. 'Kommentar': [kommentar]})
  103. # Daten zur existierenden DataFrame hinzufügen
  104. updated_df = existing_df._append(new_data, ignore_index=True)
  105. # DataFrame in Excel schreiben
  106. if not existing_df.empty:
  107. # Modus 'a' (Anhängen) verwenden, wenn die DataFrame nicht leer ist
  108. with pd.ExcelWriter(excel_path, engine='openpyxl', mode='a', if_sheet_exists='replace') as writer:
  109. updated_df.to_excel(writer, index=False, sheet_name='Sheet1')
  110. else:
  111. # Modus 'w' (Schreiben) verwenden, wenn die DataFrame leer ist oder die Datei nicht existiert
  112. with pd.ExcelWriter(excel_path, engine='openpyxl', mode='w') as writer:
  113. updated_df.to_excel(writer, index=False, sheet_name='Sheet1')
  114. def start_recording_with_input(self):
  115. """
  116. Startet die Videoaufnahme mit dem eingegebenen Videonamen.
  117. Der Name wird aus dem Tkinter Entry-Widget gelesen.
  118. """
  119. video_name = self.testcase_name_entry.get()
  120. video_length = int(self.video_length_entry.get()) # Hole die Länge des Videos
  121. testcase_resolution1 = int(self.testcase_resolution1_entry.get())
  122. testcase_resolution2 = int(self.testcase_resolution2_entry.get())
  123. testcase_fps=int(self.testcase_fps_entry.get())
  124. start_recording(video_name, video_length,testcase_resolution1,testcase_resolution2,testcase_fps)
  125. def select_video(self):
  126. """
  127. Öffnet einen Dateidialog zum Auswählen eines Videos und setzt den Namen des ausgewählten Videos
  128. in das Tkinter Entry-Widget für die Videoverarbeitung.
  129. """
  130. selected_video_path = filedialog.askopenfilename() # Den ausgewählten Videopfad abfragen
  131. if selected_video_path:
  132. selected_video_name = os.path.basename(selected_video_path) # Extrahieren Sie den Videonamen
  133. self.videoprocessing_name_entry.delete(0, tk.END) # Löschen Sie den aktuellen Text im Textfeld
  134. self.videoprocessing_name_entry.insert(0, selected_video_name) # Fügen Sie den Videonamen ein
  135. def process_selected_video(self):
  136. """
  137. Verarbeitet das ausgewählte Video, dessen Name aus dem Tkinter Entry-Widget gelesen wird.
  138. """
  139. selected_video_name = self.videoprocessing_name_entry.get()
  140. # Den ausgewählten Videonamen abfragen
  141. if selected_video_name:
  142. process_video(selected_video_name)
  143. def check_recording_status(self):
  144. excel_file_path = 'code/testing/excel/Testcase_excel_dataset.xlsx'
  145. global recording_finished
  146. if recording_finished_event.is_set():
  147. recording_finished_event.clear()
  148. video_name = self.testcase_name_entry.get()
  149. length = int(self.video_length_entry.get())
  150. pulse = simpledialog.askinteger("Puls", "Bitte geben Sie Ihren Puls ein:")
  151. if pulse is not None:
  152. new_video_name = f"{video_name}_{length}_{pulse}.avi"
  153. original_video_path = os.path.join('code', 'videos', f"{video_name}.avi")
  154. new_video_path = os.path.join('code', 'videos', new_video_name)
  155. if not os.path.exists(original_video_path):
  156. print(f"Datei nicht gefunden: {original_video_path}")
  157. return
  158. try:
  159. os.rename(original_video_path, new_video_path)
  160. print(f"Video umbenannt zu {new_video_name}")
  161. self.write_to_excel(new_video_name, excel_file_path)
  162. except Exception as e:
  163. print(f"Fehler beim Umbenennen der Datei: {e}")
  164. else:
  165. print("Kein Puls eingegeben.")
  166. self.after(100, self.check_recording_status)
  167. #ui relateted methods
  168. def center_window(self):
  169. # Aktualisieren der "idle" Aufgaben um die Größe korrekt zu erhalten
  170. self.update_idletasks()
  171. # Berechnen der Breite und Höhe für das Zentrieren des Fensters
  172. window_width = self.winfo_width()
  173. window_height = self.winfo_height()
  174. # Finden der Mitte des Bildschirms
  175. screen_width = self.winfo_screenwidth()
  176. screen_height = self.winfo_screenheight()
  177. # Berechnen der x und y Koordinaten, um das Fenster in der Mitte des Bildschirms zu positionieren
  178. x_coordinate = int((screen_width / 2) - (window_width / 2))
  179. y_coordinate = int((screen_height / 2) - (window_height / 2))
  180. self.geometry(f"{window_width}x{window_height}+{x_coordinate}+{y_coordinate}")
  181. #displaying selected frame
  182. def show_frame(self, frame_name):
  183. # Verstecke alle Frames und setze die Button-Farben zurück Create Testcase
  184. for name, fr in self.frames.items():
  185. fr.pack_forget()
  186. if name == "Recording":
  187. self.btn_recording.configure(bg='white',fg='black', relief=tk.RAISED)
  188. elif name == "Processing":
  189. self.btn_processing.configure(bg='white',fg='black', relief=tk.RAISED)
  190. elif name == "Testing":
  191. self.btn_testing.configure(bg='white',fg='black', relief=tk.RAISED)
  192. elif name == "Create Testcase":
  193. self.btn_testcase.configure(bg='white',fg='black', relief=tk.RAISED)
  194. # Zeige den ausgewählten Frame
  195. frame = self.frames[frame_name]
  196. frame.pack(fill="both", expand=True)
  197. # Hebe den entsprechenden Button hervor
  198. if frame_name == "Recording":
  199. self.btn_recording.configure(bg='#c82423',fg='white', relief=tk.SUNKEN)
  200. elif frame_name == "Processing":
  201. self.btn_processing.configure(bg='#c82423',fg='white', relief=tk.SUNKEN)
  202. elif frame_name == "Testing":
  203. self.btn_testing.configure(bg='#c82423',fg='white', relief=tk.SUNKEN)
  204. elif frame_name == "Create Testcase":
  205. self.btn_testcase.configure(bg='#c82423',fg='white', relief=tk.SUNKEN)
  206. def initialize_header_frame(self):
  207. # Header-Frame für App-Name und Icon
  208. header_frame = tk.Frame(self, bd=1, relief=tk.RAISED, bg='white')
  209. header_frame.pack(side=tk.TOP, fill=tk.X)
  210. # App-Name Label
  211. self.app_name_label = tk.Label(header_frame, text="Driving Simulator-EVM", font=('Helvetica', 28, 'bold'), bg='white', fg='red')
  212. self.app_name_label.pack(side=tk.LEFT, padx=10)
  213. self.app_name_label.config(fg="#c82423", bg="#FFFFFF")
  214. # Laden Sie das Bild mit PIL und konvertieren Sie es in ein Format, das Tkinter verwenden kann
  215. self.image = Image.open(r"code\interface\ohmbild2.png")
  216. self.resized_image = self.image.resize((50, 30), Image.LANCZOS)
  217. self.photo = ImageTk.PhotoImage(self.resized_image)
  218. # Erstellen Sie ein Label-Widget, um das Bild anzuzeigen
  219. self.picture = tk.Label(self, image=self.photo)
  220. self.picture.place(x=445, y=0)
  221. self.picture.config(bg="#FFFFFF")
  222. def initialize_toolbar(self):
  223. toolbar = tk.Frame(self, bd=1, relief=tk.RAISED, bg='white')
  224. toolbar.pack(side=tk.TOP, fill=tk.X)
  225. self.btn_recording = tk.Button(toolbar, text="Recording", bg='white', command=lambda: self.show_frame("Recording"))
  226. self.btn_recording.pack(side=tk.LEFT, padx=2, pady=2)
  227. self.btn_processing = tk.Button(toolbar, text="Processing", bg='white', command=lambda: self.show_frame("Processing"))
  228. self.btn_processing.pack(side=tk.LEFT, padx=2, pady=2)
  229. self.btn_testcase = tk.Button(toolbar, text="Create Testcase", bg='white', command=lambda: self.show_frame("Create Testcase"))
  230. self.btn_testcase.pack(side=tk.LEFT, padx=3, pady=3)
  231. self.btn_testing = tk.Button(toolbar, text="Testing", bg='white', command=lambda: self.show_frame("Testing"))
  232. self.btn_testing.pack(side=tk.LEFT, padx=3, pady=3)
  233. def setup_recording_controls(self):
  234. self.recording_frame = tk.Frame(self)
  235. self.recording_frame.configure(bg='white')
  236. self.frames["Recording"] = self.recording_frame
  237. # mainlabel for recording
  238. self.recording_main_label = tk.Label(self.recording_frame, text="Recording", font=("Helvetica", 20))
  239. self.recording_main_label.place(x=25, y=10)
  240. self.recording_main_label.config(bg="#FFFFFF")
  241. self.video_name_entry_label = tk.Label(self.recording_frame, text="Videoname(Output)", font=("Helvetica", 10))
  242. self.video_name_entry_label.place(x=25, y=60)
  243. self.video_name_entry_label.config(bg="#FFFFFF")
  244. self.video_name_entry = tk.Entry(self.recording_frame)
  245. self.video_name_entry.place(x=25, y=85)
  246. self.video_name_entry.config(bg="#FFFFFF")
  247. self.aufnahme_entry_label = tk.Label(self.recording_frame, text="Auflösung,FPS", font=("Helvetica", 10))
  248. self.aufnahme_entry_label.place(x=25, y=110)
  249. self.aufnahme_entry_label.config(bg="#FFFFFF")
  250. self.aufnahme_aufloesung1_entry = tk.Entry(self.recording_frame)
  251. self.aufnahme_aufloesung1_entry.place(x=25, y=140)
  252. self.aufnahme_aufloesung1_entry.config(bg="#FFFFFF", width=5)
  253. self.aufnahme_aufloesung1_entry.insert(0, 2560)
  254. self.aufnahme_aufloesung_x_entry_label = tk.Label(self.recording_frame, text="x", font=("Helvetica", 8))
  255. self.aufnahme_aufloesung_x_entry_label.place(x=60, y=140)
  256. self.aufnahme_aufloesung_x_entry_label.config(bg="#FFFFFF")
  257. self.aufnahme_aufloesung2_entry = tk.Entry(self.recording_frame)
  258. self.aufnahme_aufloesung2_entry.place(x=72, y=140)
  259. self.aufnahme_aufloesung2_entry.config(bg="#FFFFFF", width=5)
  260. self.aufnahme_aufloesung2_entry.insert(0, 1440)
  261. self.aufnahme_aufloesung_komma_entry_label = tk.Label(self.recording_frame, text=",", font=("Helvetica", 8))
  262. self.aufnahme_aufloesung_komma_entry_label.place(x=105, y=140)
  263. self.aufnahme_aufloesung_komma_entry_label.config(bg="#FFFFFF")
  264. self.aufnahme_fps_entry = tk.Entry(self.recording_frame)
  265. self.aufnahme_fps_entry.place(x=115, y=140)
  266. self.aufnahme_fps_entry.config(bg="#FFFFFF", width=4)
  267. self.aufnahme_fps_entry.insert(0, 20)
  268. # Buttons
  269. self.start_button = tk.Button(self.recording_frame, text="Aufnahme starten", command=self.start_normal_recording_with_input)
  270. self.start_button.place(x=25, y=175)
  271. self.start_button.config(bg="#c82423", fg="#FFFFFF")
  272. self.stop_button = tk.Button(self.recording_frame, text="Aufnahme stoppen", command=stop_normal_recording)
  273. self.stop_button.place(x=25, y=210)
  274. self.stop_button.config(bg="#c82423", fg="#FFFFFF")
  275. def setup_video_processing_controls(self):
  276. self.processing_frame = tk.Frame(self)
  277. self.processing_frame.configure(bg='white')
  278. self.frames["Processing"] = self.processing_frame
  279. # mainlabel for processing
  280. self.processing_main_label = tk.Label(self.processing_frame, text="Processing", font=("Helvetica", 20))
  281. self.processing_main_label.place(x=10, y=10)
  282. self.processing_main_label.config(bg="#FFFFFF")
  283. self.videoprocessing_name_entry_label = tk.Label(self.processing_frame, text="Videoname(Loaded)", font=("Helvetica", 10))
  284. self.videoprocessing_name_entry_label.place(x=10, y=60)
  285. self.videoprocessing_name_entry_label.config(bg="#FFFFFF")
  286. self.videoprocessing_name_entry = tk.Entry(self.processing_frame)
  287. self.videoprocessing_name_entry.place(x=10, y=85)
  288. self.videoprocessing_name_entry.config(bg="#FFFFFF")
  289. # Button to select video for processing
  290. self.select_video_button = tk.Button(self.processing_frame, text="Video auswählen", command=self.select_video)
  291. self.select_video_button.place(x=10, y=120)
  292. self.select_video_button.config(bg="#c82423", fg="#FFFFFF")
  293. # Button to start processing
  294. self.processing_button = tk.Button(self.processing_frame, text="Verarbeiten", command=self.process_selected_video)
  295. self.processing_button.place(x=10, y=160)
  296. self.processing_button.config(bg="#c82423", fg="#FFFFFF")
  297. def setup_testcase_controls(self):
  298. self.testcase_frame = tk.Frame(self, bg='white')
  299. self.frames["Create Testcase"] = self.testcase_frame
  300. # mainlabel for Recording(Testcase)
  301. self.recording_testcase_label = tk.Label(self.testcase_frame, text="Record Testcase", font=("Helvetica", 20))
  302. self.recording_testcase_label.place(x=10, y=10)
  303. self.recording_testcase_label.config(bg="#FFFFFF")
  304. #kommentar
  305. self.testcase_kommentar_entry_label = tk.Label(self.testcase_frame, text="Kommentar", font=("Helvetica", 10))
  306. self.testcase_kommentar_entry_label.place(x=320, y=60)
  307. self.testcase_kommentar_entry_label.config(bg="#FFFFFF")
  308. self.testcase_kommentar_entry = tk.Text(self.testcase_frame, height=4.5, width=20)
  309. self.testcase_kommentar_entry.place(x=320, y=85)
  310. self.testcase_kommentar_entry.config(bg="#FFFFFF")
  311. #code version
  312. self.testcase_version_entry_label = tk.Label(self.testcase_frame, text="Version: "+code_version, font=("Helvetica", 10))
  313. self.testcase_version_entry_label.place(x=240, y=20)
  314. self.testcase_version_entry_label.config(bg="#FFFFFF")
  315. #licht
  316. self.testcase_licht_entry_label = tk.Label(self.testcase_frame, text="Licht", font=("Helvetica", 10))
  317. self.testcase_licht_entry_label.place(x=10, y=180)
  318. self.testcase_licht_entry_label.config(bg="#FFFFFF")
  319. self.testcase_licht_entry = tk.Entry(self.testcase_frame)
  320. self.testcase_licht_entry.place(x=10, y=205)
  321. self.testcase_licht_entry.config(bg="#FFFFFF")
  322. #kamera
  323. self.testcase_kamera_entry_label = tk.Label(self.testcase_frame, text="Webcam(Name)", font=("Helvetica", 10))
  324. self.testcase_kamera_entry_label.place(x=10, y=240)
  325. self.testcase_kamera_entry_label.config(bg="#FFFFFF")
  326. self.testcase_kamera_entry = tk.Entry(self.testcase_frame)
  327. self.testcase_kamera_entry.place(x=10, y=265)
  328. self.testcase_kamera_entry.config(bg="#FFFFFF")
  329. #testperson
  330. self.testcase_testperson_entry_label = tk.Label(self.testcase_frame, text="Testperson(Name)", font=("Helvetica", 10))
  331. self.testcase_testperson_entry_label.place(x=160, y=60)
  332. self.testcase_testperson_entry_label.config(bg="#FFFFFF")
  333. self.testcase_testperson_entry = tk.Entry(self.testcase_frame)
  334. self.testcase_testperson_entry.place(x=160, y=85)
  335. self.testcase_testperson_entry.config(bg="#FFFFFF")
  336. #abstand
  337. self.testcase_abstand_entry_label = tk.Label(self.testcase_frame, text="Abstand zur Kamera", font=("Helvetica", 10))
  338. self.testcase_abstand_entry_label.place(x=160, y=120)
  339. self.testcase_abstand_entry_label.config(bg="#FFFFFF")
  340. self.testcase_abstand_entry = tk.Entry(self.testcase_frame)
  341. self.testcase_abstand_entry.place(x=160, y=145)
  342. self.testcase_abstand_entry.config(bg="#FFFFFF")
  343. #Winkel
  344. self.testcase_winkel_entry_label = tk.Label(self.testcase_frame, text="Kamerawinkel", font=("Helvetica", 10))
  345. self.testcase_winkel_entry_label.place(x=160, y=180)
  346. self.testcase_winkel_entry_label.config(bg="#FFFFFF")
  347. self.testcase_winkel_entry = tk.Entry(self.testcase_frame)
  348. self.testcase_winkel_entry.place(x=160, y=205)
  349. self.testcase_winkel_entry.config(bg="#FFFFFF")
  350. #Hintergrund
  351. self.testcase_hintergrund_entry_label = tk.Label(self.testcase_frame, text="Hintergrund", font=("Helvetica", 10))
  352. self.testcase_hintergrund_entry_label.place(x=160, y=240)
  353. self.testcase_hintergrund_entry_label.config(bg="#FFFFFF")
  354. self.testcase_hintergrund_entry = tk.Entry(self.testcase_frame)
  355. self.testcase_hintergrund_entry.place(x=160, y=265)
  356. self.testcase_hintergrund_entry.config(bg="#FFFFFF")
  357. #videoname
  358. self.testcase_name_entry_label = tk.Label(self.testcase_frame, text="Videoname(Output)", font=("Helvetica", 10))
  359. self.testcase_name_entry_label.place(x=10, y=60)
  360. self.testcase_name_entry_label.config(bg="#FFFFFF")
  361. self.testcase_name_entry = tk.Entry(self.testcase_frame)
  362. self.testcase_name_entry.place(x=10, y=85)
  363. self.testcase_name_entry.config(bg="#FFFFFF")
  364. #videolänge
  365. self.video_length_entry_label = tk.Label(self.testcase_frame, text="Videolänge (Sek.)", font=("Helvetica", 10))
  366. self.video_length_entry_label.place(x=10, y=120)
  367. self.video_length_entry_label.config(bg="#FFFFFF")
  368. self.video_length_entry = tk.Entry(self.testcase_frame)
  369. self.video_length_entry.place(x=10, y=145)
  370. self.video_length_entry.config(bg="#FFFFFF")
  371. #auflösung und fps
  372. self.testcase_resolution_label = tk.Label(self.testcase_frame, text="Auflösung,FPS", font=("Helvetica", 10))
  373. self.testcase_resolution_label.place(x=320, y=180)
  374. self.testcase_resolution_label.config(bg="#FFFFFF")
  375. self.testcase_resolution1_entry = tk.Entry(self.testcase_frame)
  376. self.testcase_resolution1_entry.place(x=320, y=205)
  377. self.testcase_resolution1_entry.config(bg="#FFFFFF", width=5)
  378. self.testcase_resolution1_entry.insert(0, 2560)
  379. self.resolution_x_label = tk.Label(self.testcase_frame, text="x", font=("Helvetica", 8))
  380. self.resolution_x_label.place(x=365, y=205)
  381. self.resolution_x_label.config(bg="#FFFFFF")
  382. self.testcase_resolution2_entry = tk.Entry(self.testcase_frame)
  383. self.testcase_resolution2_entry.place(x=377, y=205)
  384. self.testcase_resolution2_entry.config(bg="#FFFFFF", width=5)
  385. self.testcase_resolution2_entry.insert(0, 1440)
  386. self.resolution_comma_label = tk.Label(self.testcase_frame, text=",", font=("Helvetica", 8))
  387. self.resolution_comma_label.place(x=410, y=205)
  388. self.resolution_comma_label.config(bg="#FFFFFF")
  389. self.testcase_fps_entry = tk.Entry(self.testcase_frame)
  390. self.testcase_fps_entry.place(x=420, y=205)
  391. self.testcase_fps_entry.config(bg="#FFFFFF", width=4)
  392. self.testcase_fps_entry.insert(0, 20)
  393. # Button to start testcase recording
  394. self.create_testcase_button = tk.Button(self.testcase_frame, text="Testcase aufnehmen", command=self.start_recording_with_input)
  395. self.create_testcase_button.place(x=320, y=240)
  396. self.create_testcase_button.config(bg="#c82423", fg="#FFFFFF")
  397. def setup_testing_controls(self):
  398. self.testing_frame = tk.Frame(self, bg='white')
  399. self.frames["Testing"] = self.testing_frame
  400. #kommentar
  401. self.testrun_kommentar_entry_label = tk.Label(self.testing_frame, text="Kommentar", font=("Helvetica", 10))
  402. self.testrun_kommentar_entry_label.place(x=10, y=60)
  403. self.testrun_kommentar_entry_label.config(bg="#FFFFFF")
  404. self.testrun_kommentar_entry = tk.Text(self.testing_frame, height=4.5, width=20)
  405. self.testrun_kommentar_entry.place(x=10, y=85)
  406. self.testrun_kommentar_entry.config(bg="#FFFFFF")
  407. # mainlabel for testing
  408. self.testing_main_label = tk.Label(self.testing_frame, text="Testing", font=("Helvetica", 20))
  409. self.testing_main_label.place(x=10, y=10)
  410. self.testing_main_label.config(bg="#FFFFFF")
  411. # Button to start test
  412. self.test_button = tk.Button(self.testing_frame, text="Test durchführen", command=self.test_data_set)
  413. self.test_button.place(x=350, y=60)
  414. self.test_button.config(bg="#c82423", fg="#FFFFFF")
  415. # Button open testcase excel
  416. self.open_testcase_button = tk.Button(self.testing_frame, text="Open Testcase Excel", command=self.open_testcase_excel_file)
  417. self.open_testcase_button.place(x=10, y=180)
  418. self.open_testcase_button.config(bg="#c82423", fg="#FFFFFF")
  419. # Button open testrun excel
  420. self.open_testrun_button = tk.Button(self.testing_frame, text="Open Testrun Excel", command=self.open_testrun_excel_file)
  421. self.open_testrun_button.place(x=10, y=215)
  422. self.open_testrun_button.config(bg="#c82423", fg="#FFFFFF")
  423. # Button open sorted excel
  424. self.open_testrun_button = tk.Button(self.testing_frame, text="Open Evaluation Excel", command=self.open_evaluation_excel_file)
  425. self.open_testrun_button.place(x=10, y=250)
  426. self.open_testrun_button.config(bg="#c82423", fg="#FFFFFF")
  427. def initialize_icon(self):
  428. # Icon ändern
  429. self.iconbitmap(r'code\interface\ohm.ico')
  430. # Ändert die Hintergrundfarbe
  431. self.configure(bg="#FFFFFF")
  432. def main():
  433. app = VideoProcessingApp()
  434. app.mainloop()
  435. if __name__ == "__main__":
  436. main()