Merge pull request '[BUG] #002 added Error Message to Converter' (#18) from bugfixes into main

Reviewed-on: Fabelous/MPENN#18
This commit is contained in:
Falko Victor Habel 2024-03-28 20:05:30 +00:00
commit 20b6c34396
1 changed files with 14 additions and 4 deletions

View File

@ -2,7 +2,9 @@ import customtkinter as Ctk
from tkinter import filedialog from tkinter import filedialog
import scripts.get_sys_info as system_code import scripts.get_sys_info as system_code
import cv2 import cv2
import os
import threading import threading
from pathlib import Path
EPSILON = 1e-9 # choose an appropriate epsilon value EPSILON = 1e-9 # choose an appropriate epsilon value
@ -60,8 +62,6 @@ class WorkerThread(threading.Thread):
video.release() video.release()
class Converter(Ctk.CTkFrame): class Converter(Ctk.CTkFrame):
def __init__(self,master, **kwargs): def __init__(self,master, **kwargs):
super().__init__(master, **kwargs) super().__init__(master, **kwargs)
@ -203,11 +203,21 @@ class Converter(Ctk.CTkFrame):
self.output_entry.insert(0, file_path) # Insert the new text self.output_entry.insert(0, file_path) # Insert the new text
def start_threads(self): def start_threads(self):
self.input_path = self.input_entry.get()
self.output_path = self.output_entry.get()
input_extension = Path(self.input_path).suffix.lower()
if input_extension not in ['.mp4', '.avi', '.mkv', '.mov']:
self.progress_info.configure(text="Source Video could not be found")
return
if not os.path.exists(self.output_path):
self.progress_info.configure(text="Output Folder could not be found!")
return
self.input_btn.configure(state="disabled") self.input_btn.configure(state="disabled")
self.output_btn.configure(state="disabled") self.output_btn.configure(state="disabled")
self.start_btn.configure(state="disabled") self.start_btn.configure(state="disabled")
self.input_path = self.input_entry.get()
self.output_path = self.output_entry.get()
self.img_name = self.img_naming.get() self.img_name = self.img_naming.get()
self.total_frames = self.get_frame_rate_and_last_frame(self.input_path) self.total_frames = self.get_frame_rate_and_last_frame(self.input_path)
self.step_size = 1 / self.total_frames * 100 /2 self.step_size = 1 / self.total_frames * 100 /2