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

10 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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. 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 = 'code/testing/excel/Testcase_excel_dataset.xlsx'
  142. global recording_finished
  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())
  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('code', 'videos', f"{video_name}.avi")
  151. new_video_path = os.path.join('code', 'videos', new_video_name)
  152. if not os.path.exists(original_video_path):
  153. print(f"Datei nicht gefunden: {original_video_path}")
  154. return
  155. try:
  156. os.rename(original_video_path, new_video_path)
  157. print(f"Video umbenannt zu {new_video_name}")
  158. self.write_to_excel(new_video_name, excel_file_path)
  159. except Exception as e:
  160. print(f"Fehler beim Umbenennen der Datei: {e}")
  161. else:
  162. print("Kein Puls eingegeben.")
  163. self.after(100, self.check_recording_status)
  164. #ui relateted methods
  165. def center_window(self):
  166. # Aktualisieren der "idle" Aufgaben um die Größe korrekt zu erhalten
  167. self.update_idletasks()
  168. # Berechnen der Breite und Höhe für das Zentrieren des Fensters
  169. window_width = self.winfo_width()
  170. window_height = self.winfo_height()
  171. # Finden der Mitte des Bildschirms
  172. screen_width = self.winfo_screenwidth()
  173. screen_height = self.winfo_screenheight()
  174. # Berechnen der x und y Koordinaten, um das Fenster in der Mitte des Bildschirms zu positionieren
  175. x_coordinate = int((screen_width / 2) - (window_width / 2))
  176. y_coordinate = int((screen_height / 2) - (window_height / 2))
  177. self.geometry(f"{window_width}x{window_height}+{x_coordinate}+{y_coordinate}")
  178. #displaying selected frame
  179. def show_frame(self, frame_name):
  180. # Verstecke alle Frames und setze die Button-Farben zurück Create Testcase
  181. for name, fr in self.frames.items():
  182. fr.pack_forget()
  183. if name == "Recording":
  184. self.btn_recording.configure(bg='white',fg='black', relief=tk.RAISED)
  185. elif name == "Processing":
  186. self.btn_processing.configure(bg='white',fg='black', relief=tk.RAISED)
  187. elif name == "Testing":
  188. self.btn_testing.configure(bg='white',fg='black', relief=tk.RAISED)
  189. elif name == "Create Testcase":
  190. self.btn_testcase.configure(bg='white',fg='black', relief=tk.RAISED)
  191. # Zeige den ausgewählten Frame
  192. frame = self.frames[frame_name]
  193. frame.pack(fill="both", expand=True)
  194. # Hebe den entsprechenden Button hervor
  195. if frame_name == "Recording":
  196. self.btn_recording.configure(bg='#c82423',fg='white', relief=tk.SUNKEN)
  197. elif frame_name == "Processing":
  198. self.btn_processing.configure(bg='#c82423',fg='white', relief=tk.SUNKEN)
  199. elif frame_name == "Testing":
  200. self.btn_testing.configure(bg='#c82423',fg='white', relief=tk.SUNKEN)
  201. elif frame_name == "Create Testcase":
  202. self.btn_testcase.configure(bg='#c82423',fg='white', relief=tk.SUNKEN)
  203. def initialize_header_frame(self):
  204. # Header-Frame für App-Name und Icon
  205. header_frame = tk.Frame(self, bd=1, relief=tk.RAISED, bg='white')
  206. header_frame.pack(side=tk.TOP, fill=tk.X)
  207. # App-Name Label
  208. self.app_name_label = tk.Label(header_frame, text="Driving Simulator-EVM", font=('Helvetica', 28, 'bold'), bg='white', fg='red')
  209. self.app_name_label.pack(side=tk.LEFT, padx=10)
  210. self.app_name_label.config(fg="#c82423", bg="#FFFFFF")
  211. # Laden Sie das Bild mit PIL und konvertieren Sie es in ein Format, das Tkinter verwenden kann
  212. self.image = Image.open("code\Interface\ohmbild2.png")
  213. self.resized_image = self.image.resize((50, 30), Image.LANCZOS)
  214. self.photo = ImageTk.PhotoImage(self.resized_image)
  215. # Erstellen Sie ein Label-Widget, um das Bild anzuzeigen
  216. self.picture = tk.Label(self, image=self.photo)
  217. self.picture.place(x=445, y=0)
  218. self.picture.config(bg="#FFFFFF")
  219. def initialize_toolbar(self):
  220. toolbar = tk.Frame(self, bd=1, relief=tk.RAISED, bg='white')
  221. toolbar.pack(side=tk.TOP, fill=tk.X)
  222. self.btn_recording = tk.Button(toolbar, text="Recording", bg='white', command=lambda: self.show_frame("Recording"))
  223. self.btn_recording.pack(side=tk.LEFT, padx=2, pady=2)
  224. self.btn_processing = tk.Button(toolbar, text="Processing", bg='white', command=lambda: self.show_frame("Processing"))
  225. self.btn_processing.pack(side=tk.LEFT, padx=2, pady=2)
  226. self.btn_testcase = tk.Button(toolbar, text="Create Testcase", bg='white', command=lambda: self.show_frame("Create Testcase"))
  227. self.btn_testcase.pack(side=tk.LEFT, padx=3, pady=3)
  228. self.btn_testing = tk.Button(toolbar, text="Testing", bg='white', command=lambda: self.show_frame("Testing"))
  229. self.btn_testing.pack(side=tk.LEFT, padx=3, pady=3)
  230. def setup_recording_controls(self):
  231. self.recording_frame = tk.Frame(self)
  232. self.recording_frame.configure(bg='white')
  233. self.frames["Recording"] = self.recording_frame
  234. # mainlabel for recording
  235. self.recording_main_label = tk.Label(self.recording_frame, text="Recording", font=("Helvetica", 20))
  236. self.recording_main_label.place(x=25, y=10)
  237. self.recording_main_label.config(bg="#FFFFFF")
  238. self.video_name_entry_label = tk.Label(self.recording_frame, text="Videoname(Output)", font=("Helvetica", 10))
  239. self.video_name_entry_label.place(x=25, y=60)
  240. self.video_name_entry_label.config(bg="#FFFFFF")
  241. self.video_name_entry = tk.Entry(self.recording_frame)
  242. self.video_name_entry.place(x=25, y=85)
  243. self.video_name_entry.config(bg="#FFFFFF")
  244. self.aufnahme_entry_label = tk.Label(self.recording_frame, text="Auflösung,FPS", font=("Helvetica", 10))
  245. self.aufnahme_entry_label.place(x=25, y=110)
  246. self.aufnahme_entry_label.config(bg="#FFFFFF")
  247. self.aufnahme_aufloesung1_entry = tk.Entry(self.recording_frame)
  248. self.aufnahme_aufloesung1_entry.place(x=25, y=140)
  249. self.aufnahme_aufloesung1_entry.config(bg="#FFFFFF", width=5)
  250. self.aufnahme_aufloesung1_entry.insert(0, 2560)
  251. self.aufnahme_aufloesung_x_entry_label = tk.Label(self.recording_frame, text="x", font=("Helvetica", 8))
  252. self.aufnahme_aufloesung_x_entry_label.place(x=60, y=140)
  253. self.aufnahme_aufloesung_x_entry_label.config(bg="#FFFFFF")
  254. self.aufnahme_aufloesung2_entry = tk.Entry(self.recording_frame)
  255. self.aufnahme_aufloesung2_entry.place(x=72, y=140)
  256. self.aufnahme_aufloesung2_entry.config(bg="#FFFFFF", width=5)
  257. self.aufnahme_aufloesung2_entry.insert(0, 1440)
  258. self.aufnahme_aufloesung_komma_entry_label = tk.Label(self.recording_frame, text=",", font=("Helvetica", 8))
  259. self.aufnahme_aufloesung_komma_entry_label.place(x=105, y=140)
  260. self.aufnahme_aufloesung_komma_entry_label.config(bg="#FFFFFF")
  261. self.aufnahme_fps_entry = tk.Entry(self.recording_frame)
  262. self.aufnahme_fps_entry.place(x=115, y=140)
  263. self.aufnahme_fps_entry.config(bg="#FFFFFF", width=4)
  264. self.aufnahme_fps_entry.insert(0, 20)
  265. # Buttons
  266. self.start_button = tk.Button(self.recording_frame, text="Aufnahme starten", command=self.start_normal_recording_with_input)
  267. self.start_button.place(x=25, y=175)
  268. self.start_button.config(bg="#c82423", fg="#FFFFFF")
  269. self.stop_button = tk.Button(self.recording_frame, text="Aufnahme stoppen", command=stop_normal_recording)
  270. self.stop_button.place(x=25, y=210)
  271. self.stop_button.config(bg="#c82423", fg="#FFFFFF")
  272. def setup_video_processing_controls(self):
  273. self.processing_frame = tk.Frame(self)
  274. self.processing_frame.configure(bg='white')
  275. self.frames["Processing"] = self.processing_frame
  276. # mainlabel for processing
  277. self.processing_main_label = tk.Label(self.processing_frame, text="Processing", font=("Helvetica", 20))
  278. self.processing_main_label.place(x=10, y=10)
  279. self.processing_main_label.config(bg="#FFFFFF")
  280. self.videoprocessing_name_entry_label = tk.Label(self.processing_frame, text="Videoname(Loaded)", font=("Helvetica", 10))
  281. self.videoprocessing_name_entry_label.place(x=10, y=60)
  282. self.videoprocessing_name_entry_label.config(bg="#FFFFFF")
  283. self.videoprocessing_name_entry = tk.Entry(self.processing_frame)
  284. self.videoprocessing_name_entry.place(x=10, y=85)
  285. self.videoprocessing_name_entry.config(bg="#FFFFFF")
  286. # Button to select video for processing
  287. self.select_video_button = tk.Button(self.processing_frame, text="Video auswählen", command=self.select_video)
  288. self.select_video_button.place(x=10, y=120)
  289. self.select_video_button.config(bg="#c82423", fg="#FFFFFF")
  290. # Button to start processing
  291. self.processing_button = tk.Button(self.processing_frame, text="Verarbeiten", command=self.process_selected_video)
  292. self.processing_button.place(x=10, y=160)
  293. self.processing_button.config(bg="#c82423", fg="#FFFFFF")
  294. def setup_testcase_controls(self):
  295. self.testcase_frame = tk.Frame(self, bg='white')
  296. self.frames["Create Testcase"] = self.testcase_frame
  297. # mainlabel for Recording(Testcase)
  298. self.recording_testcase_label = tk.Label(self.testcase_frame, text="Record Testcase", font=("Helvetica", 20))
  299. self.recording_testcase_label.place(x=10, y=10)
  300. self.recording_testcase_label.config(bg="#FFFFFF")
  301. #kommentar
  302. self.testcase_kommentar_entry_label = tk.Label(self.testcase_frame, text="Kommentar", font=("Helvetica", 10))
  303. self.testcase_kommentar_entry_label.place(x=320, y=60)
  304. self.testcase_kommentar_entry_label.config(bg="#FFFFFF")
  305. self.testcase_kommentar_entry = tk.Text(self.testcase_frame, height=4.5, width=20)
  306. self.testcase_kommentar_entry.place(x=320, y=85)
  307. self.testcase_kommentar_entry.config(bg="#FFFFFF")
  308. #code version
  309. self.testcase_version_entry_label = tk.Label(self.testcase_frame, text="Version: "+code_version, font=("Helvetica", 10))
  310. self.testcase_version_entry_label.place(x=240, y=20)
  311. self.testcase_version_entry_label.config(bg="#FFFFFF")
  312. #licht
  313. self.testcase_licht_entry_label = tk.Label(self.testcase_frame, text="Licht", font=("Helvetica", 10))
  314. self.testcase_licht_entry_label.place(x=10, y=180)
  315. self.testcase_licht_entry_label.config(bg="#FFFFFF")
  316. self.testcase_licht_entry = tk.Entry(self.testcase_frame)
  317. self.testcase_licht_entry.place(x=10, y=205)
  318. self.testcase_licht_entry.config(bg="#FFFFFF")
  319. #kamera
  320. self.testcase_kamera_entry_label = tk.Label(self.testcase_frame, text="Webcam(Name)", font=("Helvetica", 10))
  321. self.testcase_kamera_entry_label.place(x=10, y=240)
  322. self.testcase_kamera_entry_label.config(bg="#FFFFFF")
  323. self.testcase_kamera_entry = tk.Entry(self.testcase_frame)
  324. self.testcase_kamera_entry.place(x=10, y=265)
  325. self.testcase_kamera_entry.config(bg="#FFFFFF")
  326. #testperson
  327. self.testcase_testperson_entry_label = tk.Label(self.testcase_frame, text="Testperson(Name)", font=("Helvetica", 10))
  328. self.testcase_testperson_entry_label.place(x=160, y=60)
  329. self.testcase_testperson_entry_label.config(bg="#FFFFFF")
  330. self.testcase_testperson_entry = tk.Entry(self.testcase_frame)
  331. self.testcase_testperson_entry.place(x=160, y=85)
  332. self.testcase_testperson_entry.config(bg="#FFFFFF")
  333. #abstand
  334. self.testcase_abstand_entry_label = tk.Label(self.testcase_frame, text="Abstand zur Kamera", font=("Helvetica", 10))
  335. self.testcase_abstand_entry_label.place(x=160, y=120)
  336. self.testcase_abstand_entry_label.config(bg="#FFFFFF")
  337. self.testcase_abstand_entry = tk.Entry(self.testcase_frame)
  338. self.testcase_abstand_entry.place(x=160, y=145)
  339. self.testcase_abstand_entry.config(bg="#FFFFFF")
  340. #Winkel
  341. self.testcase_winkel_entry_label = tk.Label(self.testcase_frame, text="Kamerawinkel", font=("Helvetica", 10))
  342. self.testcase_winkel_entry_label.place(x=160, y=180)
  343. self.testcase_winkel_entry_label.config(bg="#FFFFFF")
  344. self.testcase_winkel_entry = tk.Entry(self.testcase_frame)
  345. self.testcase_winkel_entry.place(x=160, y=205)
  346. self.testcase_winkel_entry.config(bg="#FFFFFF")
  347. #Hintergrund
  348. self.testcase_hintergrund_entry_label = tk.Label(self.testcase_frame, text="Hintergrund", font=("Helvetica", 10))
  349. self.testcase_hintergrund_entry_label.place(x=160, y=240)
  350. self.testcase_hintergrund_entry_label.config(bg="#FFFFFF")
  351. self.testcase_hintergrund_entry = tk.Entry(self.testcase_frame)
  352. self.testcase_hintergrund_entry.place(x=160, y=265)
  353. self.testcase_hintergrund_entry.config(bg="#FFFFFF")
  354. #videoname
  355. self.testcase_name_entry_label = tk.Label(self.testcase_frame, text="Videoname(Output)", font=("Helvetica", 10))
  356. self.testcase_name_entry_label.place(x=10, y=60)
  357. self.testcase_name_entry_label.config(bg="#FFFFFF")
  358. self.testcase_name_entry = tk.Entry(self.testcase_frame)
  359. self.testcase_name_entry.place(x=10, y=85)
  360. self.testcase_name_entry.config(bg="#FFFFFF")
  361. #videolänge
  362. self.video_length_entry_label = tk.Label(self.testcase_frame, text="Videolänge (Sek.)", font=("Helvetica", 10))
  363. self.video_length_entry_label.place(x=10, y=120)
  364. self.video_length_entry_label.config(bg="#FFFFFF")
  365. self.video_length_entry = tk.Entry(self.testcase_frame)
  366. self.video_length_entry.place(x=10, y=145)
  367. self.video_length_entry.config(bg="#FFFFFF")
  368. #auflösung und fps
  369. self.testcase_resolution_label = tk.Label(self.testcase_frame, text="Auflösung,FPS", font=("Helvetica", 10))
  370. self.testcase_resolution_label.place(x=320, y=180)
  371. self.testcase_resolution_label.config(bg="#FFFFFF")
  372. self.testcase_resolution1_entry = tk.Entry(self.testcase_frame)
  373. self.testcase_resolution1_entry.place(x=320, y=205)
  374. self.testcase_resolution1_entry.config(bg="#FFFFFF", width=5)
  375. self.testcase_resolution1_entry.insert(0, 2560)
  376. self.resolution_x_label = tk.Label(self.testcase_frame, text="x", font=("Helvetica", 8))
  377. self.resolution_x_label.place(x=365, y=205)
  378. self.resolution_x_label.config(bg="#FFFFFF")
  379. self.testcase_resolution2_entry = tk.Entry(self.testcase_frame)
  380. self.testcase_resolution2_entry.place(x=377, y=205)
  381. self.testcase_resolution2_entry.config(bg="#FFFFFF", width=5)
  382. self.testcase_resolution2_entry.insert(0, 1440)
  383. self.resolution_comma_label = tk.Label(self.testcase_frame, text=",", font=("Helvetica", 8))
  384. self.resolution_comma_label.place(x=410, y=205)
  385. self.resolution_comma_label.config(bg="#FFFFFF")
  386. self.testcase_fps_entry = tk.Entry(self.testcase_frame)
  387. self.testcase_fps_entry.place(x=420, y=205)
  388. self.testcase_fps_entry.config(bg="#FFFFFF", width=4)
  389. self.testcase_fps_entry.insert(0, 20)
  390. # Button to start testcase recording
  391. self.create_testcase_button = tk.Button(self.testcase_frame, text="Testcase aufnehmen", command=self.start_recording_with_input)
  392. self.create_testcase_button.place(x=320, y=240)
  393. self.create_testcase_button.config(bg="#c82423", fg="#FFFFFF")
  394. def setup_testing_controls(self):
  395. self.testing_frame = tk.Frame(self, bg='white')
  396. self.frames["Testing"] = self.testing_frame
  397. #kommentar
  398. self.testrun_kommentar_entry_label = tk.Label(self.testing_frame, text="Kommentar", font=("Helvetica", 10))
  399. self.testrun_kommentar_entry_label.place(x=10, y=60)
  400. self.testrun_kommentar_entry_label.config(bg="#FFFFFF")
  401. self.testrun_kommentar_entry = tk.Text(self.testing_frame, height=4.5, width=20)
  402. self.testrun_kommentar_entry.place(x=10, y=85)
  403. self.testrun_kommentar_entry.config(bg="#FFFFFF")
  404. # mainlabel for testing
  405. self.testing_main_label = tk.Label(self.testing_frame, text="Testing", font=("Helvetica", 20))
  406. self.testing_main_label.place(x=10, y=10)
  407. self.testing_main_label.config(bg="#FFFFFF")
  408. # Button to start test
  409. self.test_button = tk.Button(self.testing_frame, text="Test durchführen", command=self.test_data_set)
  410. self.test_button.place(x=350, y=60)
  411. self.test_button.config(bg="#c82423", fg="#FFFFFF")
  412. # Button open testcase excel
  413. self.open_testcase_button = tk.Button(self.testing_frame, text="Open Testcase Excel", command=self.open_testcase_excel_file)
  414. self.open_testcase_button.place(x=10, y=200)
  415. self.open_testcase_button.config(bg="#c82423", fg="#FFFFFF")
  416. # Button open testrun excel
  417. self.open_testrun_button = tk.Button(self.testing_frame, text="Open Testrun Excel", command=self.open_testrun_excel_file)
  418. self.open_testrun_button.place(x=10, y=235)
  419. self.open_testrun_button.config(bg="#c82423", fg="#FFFFFF")
  420. def initialize_icon(self):
  421. # Icon ändern
  422. self.iconbitmap('code\Interface\ohm.ico')
  423. # Ändert die Hintergrundfarbe
  424. self.configure(bg="#FFFFFF")
  425. def main():
  426. app = VideoProcessingApp()
  427. app.mainloop()
  428. if __name__ == "__main__":
  429. main()