From 47dffeb30750cd030d5b0a4525dc916c34e8fc26 Mon Sep 17 00:00:00 2001 From: Tym Rabchuk Date: Tue, 23 Jun 2026 19:30:07 -0400 Subject: [PATCH] fix(webp): finish extension centralization from pre-submission review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - build the video save-dialog filter from VIDEO_EXTENSIONS (_VIDEO_FILE_FILTER) instead of a hardcoded "Videos (*.mp4 *.mkv)" — the last filter that still drifted from the canonical set - remove the now-dead file_types list (unused in both the fork and upstream; the PySide6 dialogs use the QFileDialog filter strings) and drop it from the centralization comment --- modules/globals.py | 7 +------ modules/ui.py | 5 ++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/globals.py b/modules/globals.py index 0177f8e..2fbec38 100644 --- a/modules/globals.py +++ b/modules/globals.py @@ -6,7 +6,7 @@ from typing import List, Dict, Any ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) WORKFLOW_DIR = os.path.join(ROOT_DIR, "workflow") -# Canonical media extensions, defined once so file dialogs, file_types and +# Canonical media extensions, defined once so the file dialogs and # has_image_extension never drift. GIF is intentionally excluded: OpenCV's # cv2.imread/imwrite (the only image I/O this app uses) cannot decode or # encode GIF on 4.10 or 4.11, so offering it would silently fail. WEBP works @@ -14,11 +14,6 @@ WORKFLOW_DIR = os.path.join(ROOT_DIR, "workflow") IMAGE_EXTENSIONS = (".png", ".jpg", ".jpeg", ".bmp", ".webp") VIDEO_EXTENSIONS = (".mp4", ".mkv") -file_types = [ - ("Image", tuple(f"*{ext}" for ext in IMAGE_EXTENSIONS)), - ("Video", tuple(f"*{ext}" for ext in VIDEO_EXTENSIONS)), -] - # Face Mapping Data source_target_map: List[Dict[str, Any]] = [] # Stores detailed map for image/video processing simple_map: Dict[str, Any] = {} # Stores simplified map (embeddings/faces) for live/simple mode diff --git a/modules/ui.py b/modules/ui.py index 0cf37ad..d19993e 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -244,6 +244,9 @@ _IMAGE_FILE_FILTER = "Images (" + " ".join( _MEDIA_FILE_FILTER = "Media (" + " ".join( f"*{ext}" for ext in (*modules.globals.IMAGE_EXTENSIONS, *modules.globals.VIDEO_EXTENSIONS) ) + ")" +_VIDEO_FILE_FILTER = "Videos (" + " ".join( + f"*{ext}" for ext in modules.globals.VIDEO_EXTENSIONS +) + ")" # ─── image utilities ───────────────────────────────────────────────────── @@ -900,7 +903,7 @@ class MainWindow(QMainWindow): path, _f = QFileDialog.getSaveFileName( self, _("save video output file"), os.path.join(_RECENT_OUTPUT_DIR or "", "output.mp4"), - "Videos (*.mp4 *.mkv)", + _VIDEO_FILE_FILTER, ) else: return