File: 0038-grc-Fix-GRC-Qt-file-open-dialog-on-PyQt5.patch

package info (click to toggle)
gnuradio 3.10.12.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 41,196 kB
  • sloc: cpp: 191,540; python: 91,856; ansic: 2,292; xml: 999; fortran: 927; sh: 477; makefile: 50
file content (39 lines) | stat: -rw-r--r-- 1,484 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From 056d38bf834181c1ded84fb7507eb3c0cc7684bf Mon Sep 17 00:00:00 2001
From: Martin Braun <martin.braun@ettus.com>
Date: Mon, 24 Mar 2025 11:19:42 +0100
Subject: [PATCH 38/41] grc: Fix GRC-Qt file open dialog on PyQt5

Despite using qtpy, the signature for opening files on PyQt5 and PySide2
is different. Luckily, the order of arguments is the same, so by not
using keyword arguments, we can make this call cross-compatible.

On PyQt5, the third argument is called 'directory', and on PySide2, it's
called 'dir'.

Signed-off-by: Martin Braun <martin.braun@ettus.com>
---
 grc/gui_qt/components/window.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/grc/gui_qt/components/window.py b/grc/gui_qt/components/window.py
index 713e68edcc..43ced2c86b 100644
--- a/grc/gui_qt/components/window.py
+++ b/grc/gui_qt/components/window.py
@@ -890,10 +890,11 @@ class MainWindow(QtWidgets.QMainWindow, base.Component):
         else:
             dirname = os.getcwd()
         Open = QtWidgets.QFileDialog.getOpenFileName
+        # Despite qtpy, PyQt5 and PySide2 have different signatures for getOpenFileName
         filename, filtr = Open(
-            self,
-            self.actions["open"].statusTip(),
-            dir=dirname,
+            self,  # parent
+            self.actions["open"].statusTip(),  # caption
+            dirname,  # dir
             filter="Flow Graph Files (*.grc);;All files (*.*)",
         )
         return filename
-- 
2.47.3