From 51b144f60cb55a3294b19812a3c55c20b9a109bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Wed, 13 May 2026 12:49:46 +0200 Subject: [PATCH] Flatpak: bypass XDG portal for .tum open dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Native file dialog routes through the XDG document portal, which exposes only the selected file at /run/user/UID/doc/... — siblings (param.yaml, .py) are unreachable. Force Qt's non-native dialog in Flatpak so it walks the real filesystem via --filesystem=home and returns a usable path. --- src/testium/main_win/test_file_manager.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/testium/main_win/test_file_manager.py b/src/testium/main_win/test_file_manager.py index 4b58aaa..a05f567 100644 --- a/src/testium/main_win/test_file_manager.py +++ b/src/testium/main_win/test_file_manager.py @@ -212,8 +212,17 @@ class TestFileManager: d = "" if w.testFile is not None: d = os.path.dirname(w.testFile) + # In Flatpak the native dialog goes through the XDG document portal, + # which returns /run/user/UID/doc/.../test.tum and only exposes the + # selected file — sibling files (param.yaml, .py, etc.) are unreachable. + # Force Qt's own dialog, which walks the real filesystem mounted via + # --filesystem=home and returns a regular path with sibling access. + options = QFileDialog.Options() + if os.path.isfile("/.flatpak-info"): + options |= QFileDialog.Option.DontUseNativeDialog file_name, _ = QFileDialog.getOpenFileName( - w, "Open the test file", d, "testium file (*.tum);;All Files (*)" + w, "Open the test file", d, + "testium file (*.tum);;All Files (*)", options=options ) if file_name: self.reload(file_name)