summaryrefslogtreecommitdiff
path: root/gr-qtgui/python
diff options
context:
space:
mode:
authorPaul Cercueil <paul.cercueil@analog.com>2016-06-21 18:16:06 +0200
committerPaul Cercueil <paul.cercueil@analog.com>2016-06-21 18:33:05 +0200
commitfef76c211cbe6a6c7c0645c181d27635971d841b (patch)
treefc5448f5ebc5afd4945597f0711296d50b312c10 /gr-qtgui/python
parentc76a7e0bb0765bcd1434ccda1f6626eb93904552 (diff)
gr-qtgui: Fix range.py to work with both Qt4 and Qt5
Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Diffstat (limited to 'gr-qtgui/python')
-rw-r--r--gr-qtgui/python/qtgui/CMakeLists.txt10
-rwxr-xr-xgr-qtgui/python/qtgui/range.py.cmakein (renamed from gr-qtgui/python/qtgui/range.py)3
2 files changed, 10 insertions, 3 deletions
diff --git a/gr-qtgui/python/qtgui/CMakeLists.txt b/gr-qtgui/python/qtgui/CMakeLists.txt
index 4fa4d0f484..e1a07fddd6 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"
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
index c04ef75422..45aa762ae3 100755
--- a/gr-qtgui/python/qtgui/range.py
+++ b/gr-qtgui/python/qtgui/range.py.cmakein
@@ -21,8 +21,7 @@
# Boston, MA 02110-1301, USA.
#
-from PyQt5 import Qt, QtCore, QtWidgets
-
+@PY_QT_IMPORT@
class Range(object):
def __init__(self, minv, maxv, step, default, min_length):