From f7fac054cd62bf4e2f67079982f0bee330f5c5db Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Fri, 11 Dec 2020 15:11:45 +0100 Subject: [PATCH] PICARD-2058: Set upper case extensions in file dialog filter On systems other than macOS and Windows (which typically support case insensitive file names) extend the add files dialog filter to also include upper case extensions. --- picard/ui/mainwindow.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/picard/ui/mainwindow.py b/picard/ui/mainwindow.py index 50be1de20..ecade95f1 100644 --- a/picard/ui/mainwindow.py +++ b/picard/ui/mainwindow.py @@ -66,7 +66,10 @@ from picard.cluster import ( FileList, ) from picard.const import PROGRAM_UPDATE_LEVELS -from picard.const.sys import IS_MACOS +from picard.const.sys import ( + IS_MACOS, + IS_WIN, +) from picard.file import File from picard.formats import supported_formats from picard.plugin import ExtensionPoint @@ -948,7 +951,16 @@ class MainWindow(QtWidgets.QMainWindow, PreserveGeometry): formats = [] extensions = [] for exts, name in supported_formats(): - exts = ["*" + e for e in exts] + exts = ["*" + e.lower() for e in exts] + if not exts: + continue + if not IS_MACOS and not IS_WIN: + # Also consider upper case extensions + # macOS and Windows usually support case sensitive file names. Furthermore on both systems + # the file dialog filters list all extensions we provide, which becomes a bit long when we give the + # full list twice. Hence only do this trick on other operating systems. + exts.extend([e.upper() for e in exts]) + exts.sort() formats.append("%s (%s)" % (name, " ".join(exts))) extensions.extend(exts) formats.sort()