From 2feb4c28675872f6def7d1f9bc4b713f47d3c102 Mon Sep 17 00:00:00 2001 From: valadaptive Date: Sat, 19 Aug 2023 12:38:44 -0400 Subject: [PATCH] Filter by supported files in file picker --- app/NtscApp.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/NtscApp.py b/app/NtscApp.py index 8475d58..1139448 100644 --- a/app/NtscApp.py +++ b/app/NtscApp.py @@ -595,7 +595,13 @@ def open_image_by_url(self): return None def open_file(self): - file = QtWidgets.QFileDialog.getOpenFileName(self, "Select File") + image_filters, video_filters = ( + " ".join(f"*{extension}" for extension in extension_list) + for extension_list + in (self.supported_image_type, self.supported_video_type) + ) + filters = f"All supported files ({image_filters} {video_filters});;Images ({image_filters});;Videos ({video_filters});;All files (*)" + file = QtWidgets.QFileDialog.getOpenFileName(self, "Select File", filter=filters) if file: path = Path(file[0]) else: