Skip to content

Commit

Permalink
Filter by supported files in file picker
Browse files Browse the repository at this point in the history
  • Loading branch information
valadaptive committed Aug 19, 2023
1 parent 8949c74 commit 2feb4c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/NtscApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2feb4c2

Please sign in to comment.