Package: gnuradio / 3.7.13.4-4

qt5-maint-0010-gr-qtgui-Fix-range.py-to-work-with-both-Qt4-and-Qt5.patch Patch series | 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 7df8c4ea6559ba211222e7d7cfb152f71dbc815b Mon Sep 17 00:00:00 2001
From: Paul Cercueil <paul.cercueil@analog.com>
Date: Tue, 21 Jun 2016 18:16:06 +0200
Subject: [PATCH 10/22] gr-qtgui: Fix range.py to work with both Qt4 and Qt5

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
---
 gr-qtgui/python/qtgui/CMakeLists.txt                 | 10 +++++++++-
 gr-qtgui/python/qtgui/{range.py => range.py.cmakein} |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)
 rename gr-qtgui/python/qtgui/{range.py => range.py.cmakein} (99%)

diff --git a/gr-qtgui/python/qtgui/CMakeLists.txt b/gr-qtgui/python/qtgui/CMakeLists.txt
index 1c20033db2..7e2d0321c4 100644
--- a/gr-qtgui/python/qtgui/CMakeLists.txt
+++ b/gr-qtgui/python/qtgui/CMakeLists.txt
@@ -20,9 +20,17 @@
 ########################################################################
 include(GrPython)
 
+if (DESIRED_QT_VERSION MATCHES 4)
+	set(PY_QT_IMPORT "from PyQt4 import Qt, QtCore, QtGui as QtWidgets")
+else()
+	set(PY_QT_IMPORT "from PyQt5 import Qt, QtCore, QtWidgets")
+endif()
+
+configure_file(range.py.cmakein "${CMAKE_CURRENT_BINARY_DIR}/range.py" @ONLY)
+
 GR_PYTHON_INSTALL(
     FILES __init__.py
-          range.py
+          "${CMAKE_CURRENT_BINARY_DIR}/range.py"
           util.py
     DESTINATION ${GR_PYTHON_DIR}/gnuradio/qtgui
     COMPONENT "qtgui_python"
diff --git a/gr-qtgui/python/qtgui/range.py b/gr-qtgui/python/qtgui/range.py.cmakein
similarity index 99%
rename from gr-qtgui/python/qtgui/range.py
rename to gr-qtgui/python/qtgui/range.py.cmakein
index f972844114..9ed7706195 100755
--- a/gr-qtgui/python/qtgui/range.py
+++ b/gr-qtgui/python/qtgui/range.py.cmakein
@@ -21,7 +21,7 @@
 # Boston, MA 02110-1301, USA.
 #
 
-from PyQt5 import Qt, QtCore, QtWidgets
+@PY_QT_IMPORT@
 import util
 
 class Range(object):
-- 
2.11.0