draw box proper

This commit is contained in:
2025-07-02 19:22:59 -06:00
parent 3926db3f6d
commit e9fc912c23
+68 -22
View File
@@ -34,9 +34,9 @@ class VodKeeper:
# Configuration
self.config = {
'input_path': 'R:\\mux\\input',
'output_path': 'R:\\mux\\output',
'logs_path': 'R:\\mux\\logs',
'input_path': 'R:\\Videos\\mux\\input',
'output_path': 'R:\\Videos\\mux\\output',
'logs_path': 'R:\\Videos\\mux\\logs',
'codec': 'h265_nvenc',
'preset': 'p7',
'cq': 0,
@@ -51,6 +51,7 @@ class VodKeeper:
self.setup_ui()
self.load_config()
self.refresh_files() # Populate file list on startup
def setup_dark_theme(self):
# Configure root window
@@ -131,27 +132,50 @@ class VodKeeper:
input_frame = ttk.Frame(self.notebook)
self.notebook.add(input_frame, text="Input")
# File selection
file_frame = ttk.LabelFrame(input_frame, text="File Selection", padding=10)
file_frame.pack(fill='x', padx=10, pady=5)
# Create main horizontal layout
main_frame = ttk.Frame(input_frame)
main_frame.pack(fill='both', expand=True, padx=10, pady=5)
main_frame.columnconfigure(0, weight=3) # File selection gets more space
main_frame.columnconfigure(1, weight=2) # File info gets proportional space
main_frame.rowconfigure(0, weight=1) # Allow vertical expansion
# File selection (left side)
file_frame = ttk.LabelFrame(main_frame, text="File Selection", padding=10)
file_frame.grid(row=0, column=0, sticky='nsew', padx=(0,5))
file_frame.columnconfigure(0, weight=1)
file_frame.columnconfigure(1, weight=1)
file_frame.columnconfigure(2, weight=0)
file_frame.rowconfigure(2, weight=1) # Make file list expand vertically
ttk.Label(file_frame, text="Input Directory:").grid(row=0, column=0, sticky='w', pady=2)
self.input_path_var = tk.StringVar(value=self.config['input_path'])
ttk.Entry(file_frame, textvariable=self.input_path_var, width=50).grid(row=0, column=1, padx=5, pady=2)
ttk.Button(file_frame, text="Browse", command=self.browse_input).grid(row=0, column=2, padx=5, pady=2)
# File list
# File list spanning full width
ttk.Label(file_frame, text="Available Files:").grid(row=1, column=0, sticky='w', pady=(10,2))
self.file_listbox = tk.Listbox(file_frame, height=8, width=70,
self.file_listbox = tk.Listbox(file_frame,
bg=self.colors['entry_bg'], fg=self.colors['entry_fg'],
selectbackground=self.colors['select_bg'],
selectforeground=self.colors['select_fg'])
self.file_listbox.grid(row=2, column=0, columnspan=3, sticky='ew', pady=2)
self.file_listbox.grid(row=2, column=0, columnspan=3, sticky='nsew', pady=2)
self.file_listbox.bind('<<ListboxSelect>>', self.on_file_select)
# Refresh button
ttk.Button(file_frame, text="Refresh Files", command=self.refresh_files).grid(row=3, column=0, pady=5)
# File information (right side)
info_frame = ttk.LabelFrame(main_frame, text="File Information", padding=10)
info_frame.grid(row=0, column=1, sticky='nsew', padx=(5,0))
info_frame.rowconfigure(0, weight=1)
info_frame.columnconfigure(0, weight=1)
self.file_info_text = scrolledtext.ScrolledText(info_frame,
bg=self.colors['text_bg'], fg=self.colors['text_fg'],
insertbackground=self.colors['text_fg'])
self.file_info_text.grid(row=0, column=0, sticky='nsew')
# Encoding settings
settings_frame = ttk.LabelFrame(input_frame, text="Encoding Settings", padding=10)
settings_frame.pack(fill='x', padx=10, pady=5)
@@ -189,14 +213,7 @@ class VodKeeper:
manual_bitrate_entry = ttk.Entry(bitrate_frame, textvariable=self.manual_bitrate_var, width=10)
manual_bitrate_entry.grid(row=1, column=1, padx=5, pady=2)
# File info
info_frame = ttk.LabelFrame(input_frame, text="File Information", padding=10)
info_frame.pack(fill='x', padx=10, pady=5)
self.file_info_text = scrolledtext.ScrolledText(info_frame, height=6, width=80,
bg=self.colors['text_bg'], fg=self.colors['text_fg'],
insertbackground=self.colors['text_fg'])
self.file_info_text.pack(fill='both', expand=True)
# Action buttons
button_frame = ttk.Frame(input_frame)
@@ -312,24 +329,53 @@ class VodKeeper:
self.qc_results_text.pack(fill='both', expand=True)
def browse_input(self):
path = filedialog.askdirectory(initialdir=self.config['input_path'])
# Use current path if it exists, otherwise use a reasonable default
initial_dir = self.input_path_var.get() if os.path.exists(self.input_path_var.get()) else os.path.expanduser("~")
path = filedialog.askdirectory(initialdir=initial_dir, title="Select Input Directory")
if path:
self.input_path_var.set(path)
self.config['input_path'] = path # Update config
self.refresh_files()
def refresh_files(self):
self.file_listbox.delete(0, tk.END)
input_path = self.input_path_var.get()
if os.path.exists(input_path):
for file in os.listdir(input_path):
if file.lower().endswith(('.mp4', '.avi', '.mkv', '.mov', '.wmv')):
if not input_path:
self.file_listbox.insert(tk.END, "No input directory selected")
return
if not os.path.exists(input_path):
self.file_listbox.insert(tk.END, f"Directory not found: {input_path}")
return
try:
files = os.listdir(input_path)
video_files = [f for f in files if f.lower().endswith(('.mp4', '.avi', '.mkv', '.mov', '.wmv', '.m4v', '.flv', '.webm'))]
if not video_files:
self.file_listbox.insert(tk.END, "No video files found in directory")
else:
for file in sorted(video_files):
self.file_listbox.insert(tk.END, file)
except PermissionError:
self.file_listbox.insert(tk.END, "Permission denied accessing directory")
except Exception as e:
self.file_listbox.insert(tk.END, f"Error reading directory: {str(e)}")
def on_file_select(self, event):
selection = self.file_listbox.curselection()
if selection:
filename = self.file_listbox.get(selection[0])
self.update_file_info(filename)
# Check if it's an actual file or an error/status message
if filename and not filename.startswith(("No ", "Directory not found", "Permission denied", "Error reading")):
self.update_file_info(filename)
else:
# Clear file info if it's not a real file
self.file_info_text.delete(1.0, tk.END)
self.file_info_text.insert(1.0, "Select a valid video file to see information")
def update_file_info(self, filename):
filepath = os.path.join(self.input_path_var.get(), filename)