From 7df8c4ea6559ba211222e7d7cfb152f71dbc815b Mon Sep 17 00:00:00 2001 From: Paul Cercueil 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 --- 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