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 25KB

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