[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 07/09: grc: Fix generation of Python code f
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 07/09: grc: Fix generation of Python code for Qt4 and Qt5 |
Date: |
Wed, 22 Jun 2016 21:19:31 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch next-qt5
in repository gnuradio.
commit 0bf66e00e28292799b84223c5523f6676cf7c848
Author: Paul Cercueil <address@hidden>
Date: Tue Jun 21 19:27:19 2016 +0200
grc: Fix generation of Python code for Qt4 and Qt5
Signed-off-by: Paul Cercueil <address@hidden>
---
CMakeLists.txt | 2 +-
grc/blocks/CMakeLists.txt | 4 +++-
grc/blocks/{options.xml => options.xml.cmakein} | 2 +-
grc/core/generator/flow_graph.tmpl | 13 ++++++++++++-
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 739478c..33f6182 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -435,7 +435,6 @@ list(APPEND GR_TEST_PYTHON_DIRS
add_subdirectory(docs)
add_subdirectory(gnuradio-runtime)
add_subdirectory(gr-blocks)
-add_subdirectory(grc)
add_subdirectory(gr-fec)
add_subdirectory(gr-fft)
add_subdirectory(gr-filter)
@@ -454,6 +453,7 @@ add_subdirectory(gr-vocoder)
add_subdirectory(gr-wavelet)
add_subdirectory(gr-wxgui)
add_subdirectory(gr-zeromq)
+add_subdirectory(grc)
# Defining GR_CTRLPORT for gnuradio/config.h
if(ENABLE_GR_CTRLPORT)
diff --git a/grc/blocks/CMakeLists.txt b/grc/blocks/CMakeLists.txt
index 0c2a1f7..a2207fa 100644
--- a/grc/blocks/CMakeLists.txt
+++ b/grc/blocks/CMakeLists.txt
@@ -22,6 +22,8 @@ include(GrPython)
file(GLOB xml_files "*.xml")
+configure_file(options.xml.cmakein "${CMAKE_CURRENT_BINARY_DIR}/options.xml"
@ONLY)
+
macro(GEN_BLOCK_XML _generator _xml_block)
set(generator ${CMAKE_CURRENT_SOURCE_DIR}/${_generator})
set(xml_block ${CMAKE_CURRENT_BINARY_DIR}/${_xml_block})
@@ -37,7 +39,7 @@ GEN_BLOCK_XML(variable_struct.xml.py variable_struct.xml)
add_custom_target(grc_generated_xml ALL DEPENDS ${generated_xml_files})
install(
- FILES ${xml_files} ${generated_xml_files}
+ FILES ${xml_files} "${CMAKE_CURRENT_BINARY_DIR}/options.xml"
${generated_xml_files}
DESTINATION ${GRC_BLOCKS_DIR}
COMPONENT "grc"
)
diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml.cmakein
similarity index 99%
rename from grc/blocks/options.xml
rename to grc/blocks/options.xml.cmakein
index e032692..985662f 100644
--- a/grc/blocks/options.xml
+++ b/grc/blocks/options.xml.cmakein
@@ -16,7 +16,7 @@ from grc_gnuradio import wxgui as grc_wxgui
import wx
#end if
#if $generate_options() == 'qt_gui'
-from PyQt5 import Qt
+from address@hidden@ import Qt
import sys
#end if
#if not $generate_options().startswith('hb')
diff --git a/grc/core/generator/flow_graph.tmpl
b/grc/core/generator/flow_graph.tmpl
index 3dd98a3..d296783 100644
--- a/grc/core/generator/flow_graph.tmpl
+++ b/grc/core/generator/flow_graph.tmpl
@@ -36,6 +36,10 @@ $DIVIDER
import threading
#end if
+#if $generate_options == 'qt_gui'
+from distutils.version import StrictVersion
+#end if
+
## Call XInitThreads as the _very_ first thing.
## After some Qt import, it's too late
#if $generate_options in ('wx_gui', 'qt_gui')
@@ -116,7 +120,11 @@ class $(class_name)(gr.top_block, Qt.QWidget):
self.top_layout.addLayout(self.top_grid_layout)
self.settings = Qt.QSettings("GNU Radio", "$class_name")
- self.restoreGeometry(self.settings.value("geometry"))
+
+ if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
+ self.restoreGeometry(self.settings.value("geometry").toByteArray())
+ else:
+ self.restoreGeometry(self.settings.value("geometry"))
#elif $generate_options == 'no_gui'
@@ -380,6 +388,9 @@ def main(top_block_cls=$(class_name), options=None):
tb.Wait()
#end if
#elif $generate_options == 'qt_gui'
+ if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) <
StrictVersion("5.0.0"):
+ style = gr.prefs().get_string('qtgui', 'style', 'raster')
+ Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls($(', '.join($params_eq_list)))
- [Commit-gnuradio] [gnuradio] branch next-qt5 updated (3c14957 -> cc57ff6), git, 2016/06/22
- [Commit-gnuradio] [gnuradio] 03/09: cmake: FindQwt: Find the Qwt library that matches the Qt version, git, 2016/06/22
- [Commit-gnuradio] [gnuradio] 05/09: gr-qtgui: Fix range.py to work with both Qt4 and Qt5, git, 2016/06/22
- [Commit-gnuradio] [gnuradio] 09/09: Merge branch 'adi-qt5' into next-qt5, git, 2016/06/22
- [Commit-gnuradio] [gnuradio] 06/09: gr-qtgui: Re-introduce some Qt4-specific code, git, 2016/06/22
- [Commit-gnuradio] [gnuradio] 07/09: grc: Fix generation of Python code for Qt4 and Qt5,
git <=
- [Commit-gnuradio] [gnuradio] 01/09: Revert "CMake: Remove obsolete GrSetupQt4 module", git, 2016/06/22
- [Commit-gnuradio] [gnuradio] 04/09: gr-qtgui: Fix PyQt[4, 5] include in XMLs for GRC, git, 2016/06/22
- [Commit-gnuradio] [gnuradio] 08/09: qtgui: tolerate return of NoneType when setting not found, git, 2016/06/22
- [Commit-gnuradio] [gnuradio] 02/09: gr-qtgui: Allow build with Qt4 or Qt5 (default), git, 2016/06/22