From bad064248ee0c5e809374e7089e9b655f4e7e7ba Mon Sep 17 00:00:00 2001 From: Akshay Arora Date: Wed, 8 Jan 2025 14:15:00 +0530 Subject: [PATCH] Make Kde File Chooser process filters in a better way. This algo better process the filters for display/usage under the latest KDE, this also works around a bug that was under plasma 5x. --- plyer/platforms/linux/filechooser.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plyer/platforms/linux/filechooser.py b/plyer/platforms/linux/filechooser.py index aebfbd21..84224f61 100644 --- a/plyer/platforms/linux/filechooser.py +++ b/plyer/platforms/linux/filechooser.py @@ -147,12 +147,18 @@ def _gen_cmdline(self): cmdline = [which(self.executable)] filt = [] - for f in self.filters: - if isinstance(f, str): + if type(f) == str: filt += [f] else: - filt += list(f[1:]) + filters = '' + for ext in self.filters: + exts = '' + for y in ext[1:]: + exts += f' {y};' + x = f'{ext[0]} ({exts})|' + filters += x + filt = [filters[:-1]] if self.mode == "dir": cmdline += [