From b0f4ebcf6d656c829747dded592e182144098d42 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 29 Sep 2015 13:57:13 +0200 Subject: [PATCH 01/22] CMake: Update required minimum version to 2.8.12 This is required to use the Qt5-specific macros. Signed-off-by: Paul Cercueil --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59e3c886c4..ae6c1e1d49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ ######################################################################## # Make sure this version matches ${GR_CMAKE_MIN_VERSION} (a variable can't be # used here). -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8.12) project(gnuradio CXX C) enable_testing() -- 2.11.0 From 25dedc0a2a7f0790f280770a7d22e9650ae2adbf Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 29 Sep 2015 13:30:59 +0200 Subject: [PATCH 02/22] CMake: FindQwt: Find the Qt5 version of QWT instead of the Qt4 version Signed-off-by: Paul Cercueil --- cmake/Modules/FindQwt.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake index da8bbe9049..2cffbe66f4 100644 --- a/cmake/Modules/FindQwt.cmake +++ b/cmake/Modules/FindQwt.cmake @@ -11,10 +11,10 @@ find_path(QWT_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/qwt ${CMAKE_PREFIX_PATH}/include/qwt PATHS - /usr/local/include/qwt-qt4 + /usr/local/include/qwt-qt5 /usr/local/include/qwt /usr/include/qwt6 - /usr/include/qwt-qt4 + /usr/include/qwt-qt5 /usr/include/qwt /usr/include/qwt5 /opt/local/include/qwt @@ -23,7 +23,7 @@ find_path(QWT_INCLUDE_DIRS ) find_library (QWT_LIBRARIES - NAMES qwt6 qwt6-qt4 qwt qwt-qt4 qwt5 qwtd5 + NAMES qwt6 qwt6-qt5 qwt qwt-qt5 HINTS ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 -- 2.11.0 From 1f78d5f2176de31809dc34fb38945c181390cdef Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 29 Sep 2015 11:25:47 +0200 Subject: [PATCH 03/22] gr-qtgui: update for Qt5 This commit switch the gr-qtgui blocks from being usable with Qt4 to being usable with Qt5. Signed-off-by: Paul Cercueil --- gr-qtgui/CMakeLists.txt | 11 ++++------- gr-qtgui/grc/qtgui_ber_sink_b.xml | 2 +- gr-qtgui/grc/qtgui_check_box.xml | 2 +- gr-qtgui/grc/qtgui_chooser.xml | 4 ++-- gr-qtgui/grc/qtgui_const_sink_x.xml | 2 +- gr-qtgui/grc/qtgui_entry.xml | 2 +- gr-qtgui/grc/qtgui_freq_sink_x.xml | 2 +- gr-qtgui/grc/qtgui_histogram_sink_x.xml | 2 +- gr-qtgui/grc/qtgui_label.xml | 2 +- gr-qtgui/grc/qtgui_number_sink.xml | 2 +- gr-qtgui/grc/qtgui_push_button.xml | 2 +- gr-qtgui/grc/qtgui_sink_x.xml | 2 +- gr-qtgui/grc/qtgui_tab_widget.xml | 2 +- gr-qtgui/grc/qtgui_time_raster_x.xml | 2 +- gr-qtgui/grc/qtgui_time_sink_x.xml | 2 +- gr-qtgui/grc/qtgui_vector_sink_f.xml | 2 +- gr-qtgui/grc/qtgui_waterfall_sink_x.xml | 2 +- gr-qtgui/include/gnuradio/qtgui/form_menus.h | 1 + gr-qtgui/lib/CMakeLists.txt | 8 ++++---- gr-qtgui/lib/SpectrumGUIClass.cc | 1 - gr-qtgui/lib/const_sink_c_impl.cc | 4 ---- gr-qtgui/lib/freq_sink_c_impl.cc | 4 ---- gr-qtgui/lib/freq_sink_f_impl.cc | 4 ---- gr-qtgui/lib/histogram_sink_f_impl.cc | 4 ---- gr-qtgui/lib/sink_c_impl.cc | 4 ---- gr-qtgui/lib/sink_f_impl.cc | 4 ---- gr-qtgui/lib/time_raster_sink_b_impl.cc | 4 ---- gr-qtgui/lib/time_raster_sink_f_impl.cc | 4 ---- gr-qtgui/lib/time_sink_c_impl.cc | 4 ---- gr-qtgui/lib/time_sink_f_impl.cc | 4 ---- gr-qtgui/lib/vector_sink_f_impl.cc | 4 ---- gr-qtgui/lib/waterfall_sink_c_impl.cc | 4 ---- gr-qtgui/lib/waterfall_sink_f_impl.cc | 4 ---- gr-qtgui/python/qtgui/range.py | 26 +++++++++++++------------- 34 files changed, 39 insertions(+), 94 deletions(-) --- a/gr-qtgui/CMakeLists.txt +++ b/gr-qtgui/CMakeLists.txt @@ -22,14 +22,14 @@ ######################################################################## include(GrBoost) -find_package(Qt4 4.2.0 COMPONENTS QtCore QtGui) +find_package(Qt5Widgets) find_package(Qwt) find_package(PythonLibs 2) include(GrPython) -GR_PYTHON_CHECK_MODULE("PyQt4" PyQt4 True PYQT4_FOUND) +GR_PYTHON_CHECK_MODULE("PyQt5" PyQt5 True PYQT5_FOUND) ######################################################################## # Register component @@ -37,13 +37,13 @@ include(GrComponent) if(NOT CMAKE_CROSSCOMPILING) set(qt_gui_python_deps - PYQT4_FOUND + PYQT5_FOUND ) endif(NOT CMAKE_CROSSCOMPILING) GR_REGISTER_COMPONENT("gr-qtgui" ENABLE_GR_QTGUI Boost_FOUND - QT4_FOUND + Qt5Widgets_FOUND QWT_FOUND ENABLE_VOLK ENABLE_GNURADIO_RUNTIME @@ -66,9 +66,6 @@ ######################################################################## if(ENABLE_GR_QTGUI) -# populate the environment with QT variables -include(GrSetupQt4) - ######################################################################## # Setup CPack components ######################################################################## --- a/gr-qtgui/grc/qtgui_ber_sink_b.xml +++ b/gr-qtgui/grc/qtgui_ber_sink_b.xml @@ -7,7 +7,7 @@ QT GUI Bercurve Sink qtgui_bercurve_sink - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip import numpy --- a/gr-qtgui/grc/qtgui_check_box.xml +++ b/gr-qtgui/grc/qtgui_check_box.xml @@ -8,7 +8,7 @@ QT GUI Check Box variable_qtgui_check_box - from PyQt4 import Qt + from PyQt5 import Qt self.$(id) = $(id) = $value #set $win = '_%s_check_box'%$id #if not $label() --- a/gr-qtgui/grc/qtgui_chooser.xml +++ b/gr-qtgui/grc/qtgui_chooser.xml @@ -8,8 +8,8 @@ QT GUI Chooser variable_qtgui_chooser - from PyQt4 import Qt - from PyQt4.QtCore import QObject, pyqtSlot + from PyQt5 import Qt + from PyQt5.QtCore import QObject, pyqtSlot self.$(id) = $(id) = $value #slurp #set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())] --- a/gr-qtgui/grc/qtgui_const_sink_x.xml +++ b/gr-qtgui/grc/qtgui_const_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Constellation Sink qtgui_const_sink_x - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id --- a/gr-qtgui/grc/qtgui_entry.xml +++ b/gr-qtgui/grc/qtgui_entry.xml @@ -8,7 +8,7 @@ QT GUI Entry variable_qtgui_entry - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import eng_notation self.$(id) = $(id) = $value #set $win = 'self._%s_tool_bar'%$id --- a/gr-qtgui/grc/qtgui_freq_sink_x.xml +++ b/gr-qtgui/grc/qtgui_freq_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Frequency Sink qtgui_freq_sink_x - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip --- a/gr-qtgui/grc/qtgui_histogram_sink_x.xml +++ b/gr-qtgui/grc/qtgui_histogram_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Histogram Sink qtgui_histogram_sink_x - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id --- a/gr-qtgui/grc/qtgui_label.xml +++ b/gr-qtgui/grc/qtgui_label.xml @@ -9,7 +9,7 @@ QT GUI Label variable_qtgui_label - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import eng_notation self.$(id) = $(id) = $value #set $win = 'self._%s_tool_bar'%$id --- a/gr-qtgui/grc/qtgui_number_sink.xml +++ b/gr-qtgui/grc/qtgui_number_sink.xml @@ -7,7 +7,7 @@ QT GUI Number Sink qtgui_number_sink - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id --- a/gr-qtgui/grc/qtgui_push_button.xml +++ b/gr-qtgui/grc/qtgui_push_button.xml @@ -8,7 +8,7 @@ QT GUI Push Button variable_qtgui_push_button - from PyQt4 import Qt + from PyQt5 import Qt self.$(id) = $(id) = $value #set $win = '_%s_push_button'%$id #if not $label() --- a/gr-qtgui/grc/qtgui_sink_x.xml +++ b/gr-qtgui/grc/qtgui_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Sink qtgui_sink_x - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip --- a/gr-qtgui/grc/qtgui_tab_widget.xml +++ b/gr-qtgui/grc/qtgui_tab_widget.xml @@ -7,7 +7,7 @@ QT GUI Tab Widget qtgui_tab_widget - from PyQt4 import Qt + from PyQt5 import Qt #set $win = 'self.%s'%$id Qt.QTabWidget() #set $all_labels = [$label0, $label1, $label2, $label3, $label4, --- a/gr-qtgui/grc/qtgui_time_raster_x.xml +++ b/gr-qtgui/grc/qtgui_time_raster_x.xml @@ -7,7 +7,7 @@ QT GUI Time Raster Sink qtgui_time_raster_sink_x - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id --- a/gr-qtgui/grc/qtgui_time_sink_x.xml +++ b/gr-qtgui/grc/qtgui_time_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Time Sink qtgui_time_sink_x - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip --- a/gr-qtgui/grc/qtgui_vector_sink_f.xml +++ b/gr-qtgui/grc/qtgui_vector_sink_f.xml @@ -7,7 +7,7 @@ QT GUI Vector Sink qtgui_vector_sink_f - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id --- a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml +++ b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Waterfall Sink qtgui_waterfall_sink_x - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip --- a/gr-qtgui/include/gnuradio/qtgui/form_menus.h +++ b/gr-qtgui/include/gnuradio/qtgui/form_menus.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include --- a/gr-qtgui/lib/CMakeLists.txt +++ b/gr-qtgui/lib/CMakeLists.txt @@ -45,8 +45,8 @@ ${qtgui_mod_includedir}/VectorDisplayPlot.h edit_box_msg_impl.h ) -QT4_WRAP_CPP(qtgui_moc_sources ${qtgui_moc_hdrs}) -QT4_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui) +QT5_WRAP_CPP(qtgui_moc_sources ${qtgui_moc_hdrs}) +QT5_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui) #FIXME the sources expect .ui.h, but the macros generate ui_foo.h #avoid changing the sources by generating the header with the include @@ -127,7 +127,7 @@ ${GNURADIO_RUNTIME_INCLUDE_DIRS} ${VOLK_INCLUDE_DIRS} ${QWT_INCLUDE_DIRS} - ${QT_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} ${FFTW3F_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} @@ -154,7 +154,7 @@ gnuradio-filter ${VOLK_LIBRARIES} ${QWT_LIBRARIES} - ${QT_LIBRARIES} + ${Qt5Widgets_LIBRARIES} ${FFTW3F_LIBRARIES} ) if (WIN32) --- a/gr-qtgui/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -26,7 +26,6 @@ #include //Added by qt3to4: #include -#include #include const long SpectrumGUIClass::MAX_FFT_SIZE = 32768; --- a/gr-qtgui/lib/const_sink_c_impl.cc +++ b/gr-qtgui/lib/const_sink_c_impl.cc @@ -127,10 +127,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/freq_sink_c_impl.cc +++ b/gr-qtgui/lib/freq_sink_c_impl.cc @@ -156,10 +156,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/freq_sink_f_impl.cc +++ b/gr-qtgui/lib/freq_sink_f_impl.cc @@ -154,10 +154,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/histogram_sink_f_impl.cc +++ b/gr-qtgui/lib/histogram_sink_f_impl.cc @@ -115,10 +115,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/sink_c_impl.cc +++ b/gr-qtgui/lib/sink_c_impl.cc @@ -131,10 +131,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/sink_f_impl.cc +++ b/gr-qtgui/lib/sink_f_impl.cc @@ -131,10 +131,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/time_raster_sink_b_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_b_impl.cc @@ -130,10 +130,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/time_raster_sink_f_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_f_impl.cc @@ -128,10 +128,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/time_sink_c_impl.cc +++ b/gr-qtgui/lib/time_sink_c_impl.cc @@ -134,10 +134,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/time_sink_f_impl.cc +++ b/gr-qtgui/lib/time_sink_f_impl.cc @@ -129,10 +129,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/vector_sink_f_impl.cc +++ b/gr-qtgui/lib/vector_sink_f_impl.cc @@ -140,10 +140,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/waterfall_sink_c_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc @@ -159,10 +159,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/waterfall_sink_f_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc @@ -155,10 +155,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/python/qtgui/range.py +++ b/gr-qtgui/python/qtgui/range.py @@ -21,7 +21,7 @@ # Boston, MA 02110-1301, USA. # -from PyQt4 import Qt, QtCore, QtGui +from PyQt5 import Qt, QtCore, QtWidgets import util class Range(object): @@ -64,10 +64,10 @@ return (val*self.step+self.min) -class RangeWidget(QtGui.QWidget): +class RangeWidget(QtWidgets.QWidget): def __init__(self, ranges, slot, label, style, rangeType=float): """ Creates the QT Range widget """ - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self.range = ranges self.style = style @@ -98,10 +98,10 @@ layout.addWidget(self.d_widget) self.setLayout(layout) - class Dial(QtGui.QDial): + class Dial(QtWidgets.QDial): """ Creates the range using a dial """ def __init__(self, parent, ranges, slot, rangeType=float): - QtGui.QDial.__init__(self, parent) + QtWidgets.QDial.__init__(self, parent) self.rangeType = rangeType @@ -124,10 +124,10 @@ val = self.range.map_range(value) self.notifyChanged(self.rangeType(val)) - class Slider(QtGui.QSlider): + class Slider(QtWidgets.QSlider): """ Creates the range using a slider """ def __init__(self, parent, ranges, slot, rangeType=float): - QtGui.QSlider.__init__(self, QtCore.Qt.Horizontal, parent) + QtWidgets.QSlider.__init__(self, QtCore.Qt.Horizontal, parent) self.rangeType = rangeType @@ -166,18 +166,18 @@ event.accept() # Use repaint rather than calling the super mousePressEvent. # Calling super causes issue where slider jumps to wrong value. - QtGui.QSlider.repaint(self) + QtWidgets.QSlider.repaint(self) def mouseMoveEvent(self, event): new = self.minimum() + ((self.maximum()-self.minimum()) * event.x()) / self.width() self.setValue(new) event.accept() - QtGui.QSlider.repaint(self) + QtWidgets.QSlider.repaint(self) - class Counter(QtGui.QDoubleSpinBox): + class Counter(QtWidgets.QDoubleSpinBox): """ Creates the range using a counter """ def __init__(self, parent, ranges, slot, rangeType=float): - QtGui.QDoubleSpinBox.__init__(self, parent) + QtWidgets.QDoubleSpinBox.__init__(self, parent) self.rangeType = rangeType @@ -196,10 +196,10 @@ """ Handle the valueChanged signal by converting to the right type """ self.notifyChanged(self.rangeType(value)) - class CounterSlider(QtGui.QWidget): + class CounterSlider(QtWidgets.QWidget): """ Creates the range using a counter and slider """ def __init__(self, parent, ranges, slot, rangeType=float): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.rangeType = rangeType From e58eb487c4119866f8c820658c8cda173bc96370 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 29 Sep 2015 13:22:46 +0200 Subject: [PATCH 04/22] grc: Generate Python scripts that use PyQt5 Signed-off-by: Paul Cercueil --- grc/blocks/options.xml | 2 +- grc/core/generator/flow_graph.tmpl | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) --- a/grc/blocks/options.xml +++ b/grc/blocks/options.xml @@ -16,7 +16,7 @@ import wx #end if #if $generate_options() == 'qt_gui' -from PyQt4 import Qt +from PyQt5 import Qt import sys #end if #if $generate_options() == 'bokeh_gui' --- a/grc/core/generator/flow_graph.tmpl +++ b/grc/core/generator/flow_graph.tmpl @@ -118,7 +118,7 @@ self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "$class_name") - self.restoreGeometry(self.settings.value("geometry").toByteArray()) + self.restoreGeometry(self.settings.value("geometry")) #elif $generate_options == 'bokeh_gui' @@ -435,10 +435,6 @@ serverProc.terminate() serverProc.kill() #elif $generate_options == 'qt_gui' - from distutils.version import StrictVersion - if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.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))) @@ -457,7 +453,7 @@ def quitting(): tb.stop() tb.wait() - qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) + qapp.aboutToQuit.connect(quitting) #for $m in $monitors if $m.has_param('en'): if $m.get_param('en').get_value(): From 45c65ebeefcb20c2d2480b11b299d49f288c3b73 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 12 Oct 2015 12:19:42 +0200 Subject: [PATCH 05/22] gr-qtgui: Add a workaround for an upstream bug of 'uic' The Qt5 version of the 'uic' compiler generates incorrect code right now. The bug has been reported (https://bugreports.qt.io/browse/QTBUG-48492) and is pending review. Signed-off-by: Paul Cercueil --- gr-qtgui/include/QtWidgets/QRegExpValidator | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gr-qtgui/include/QtWidgets/QRegExpValidator diff --git a/gr-qtgui/include/QtWidgets/QRegExpValidator b/gr-qtgui/include/QtWidgets/QRegExpValidator new file mode 100644 index 0000000000..17f6ce8333 --- /dev/null +++ b/gr-qtgui/include/QtWidgets/QRegExpValidator @@ -0,0 +1,9 @@ +/* + * The Qt5 version of the 'uic' compiler generates incorrect code right now. + * The bug has been reported (https://bugreports.qt.io/browse/QTBUG-48492) and + * is pending review. + * + * This file will make sure that the build of gr-qtgui will succeed with the + * broken version of 'uic'. + */ +#include -- 2.11.0 From 8abc28b44c65bf710235be7d1528c5ad92f53e53 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 13 Oct 2015 18:47:32 -0400 Subject: [PATCH 06/22] qtgui: fixed examples for Qt5 compatibility. --- gr-qtgui/examples/pyqt_const_c.py | 62 +- gr-qtgui/examples/pyqt_example_c.py | 59 +- gr-qtgui/examples/pyqt_example_f.py | 59 +- gr-qtgui/examples/pyqt_freq_c.py | 59 +- gr-qtgui/examples/pyqt_freq_f.py | 60 +- gr-qtgui/examples/pyqt_histogram_f.py | 73 +- gr-qtgui/examples/pyqt_time_c.py | 66 +- gr-qtgui/examples/pyqt_time_f.py | 67 +- gr-qtgui/examples/pyqt_time_raster_b.py | 19 +- gr-qtgui/examples/pyqt_time_raster_f.py | 19 +- gr-qtgui/examples/pyqt_waterfall_c.py | 59 +- gr-qtgui/examples/pyqt_waterfall_f.py | 62 +- gr-qtgui/examples/qtgui_tags_viewing.grc | 2399 +++++++++++++++++++++++------- 13 files changed, 2164 insertions(+), 899 deletions(-) diff --git a/gr-qtgui/examples/pyqt_const_c.py b/gr-qtgui/examples/pyqt_const_c.py index 3a43bf9a92..0bb6c20d59 100755 --- a/gr-qtgui/examples/pyqt_const_c.py +++ b/gr-qtgui/examples/pyqt_const_c.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011,2012,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,10 +26,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -44,71 +44,65 @@ except ImportError: sys.stderr.write("Error: Program requires gr-channels.\n") sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit = QtWidgets.QLineEdit(self) self.freq2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) - self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), - self.freq2EditText) + self.freq2Edit.editingFinished.connect(self.freq2EditText) - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) + self.quit.clicked.connect(QtWidgets.qApp.quit) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) - def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText("{0}".format(self.signal1.frequency())) + self.amp1Edit.setText("{0}".format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.freq2Edit.setText("{0}".format(self.signal2.frequency())) + self.amp2Edit.setText("{0}".format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -150,7 +144,7 @@ class my_top_block(gr.top_block): npts = 2048 - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) src1 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f1, 0.5, 0) src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.5, 0) @@ -158,6 +152,7 @@ class my_top_block(gr.top_block): channel = channels.channel_model(0.001) thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts) self.snk1 = qtgui.const_sink_c(npts, "Constellation Example", 1) + self.snk1.disable_legend() self.connect(src1, (src,0)) self.connect(src2, (src,1)) @@ -171,8 +166,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) self.main_box = dialog_box(pyWin, self.ctrl_win) self.main_box.show() @@ -182,4 +177,3 @@ if __name__ == "__main__": tb.start() tb.qapp.exec_() tb.stop() - diff --git a/gr-qtgui/examples/pyqt_example_c.py b/gr-qtgui/examples/pyqt_example_c.py index 1bf61d949d..89ca7b2820 100755 --- a/gr-qtgui/examples/pyqt_example_c.py +++ b/gr-qtgui/examples/pyqt_example_c.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011,2012,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,10 +26,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -44,71 +44,66 @@ except ImportError: sys.stderr.write("Error: Program requires gr-channels.\n") sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit = QtWidgets.QLineEdit(self) self.freq2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) - self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), - self.freq2EditText) + self.freq2Edit.editingFinished.connect(self.freq2EditText) - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + self.quit.clicked.connect(QtWidgets.qApp.quit) def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText(("{0}").format(self.signal1.frequency())) + self.amp1Edit.setText(("{0}").format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.freq2Edit.setText(("{0}").format(self.signal2.frequency())) + self.amp2Edit.setText(("{0}").format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -150,7 +145,7 @@ class my_top_block(gr.top_block): fftsize = 2048 - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) ss = open(gr.prefix() + '/share/gnuradio/themes/dark.qss') sstext = ss.read() ss.close() @@ -178,8 +173,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) self.main_box = dialog_box(pyWin, self.ctrl_win) diff --git a/gr-qtgui/examples/pyqt_example_f.py b/gr-qtgui/examples/pyqt_example_f.py index 5bd582d1e1..77a7478aa2 100755 --- a/gr-qtgui/examples/pyqt_example_f.py +++ b/gr-qtgui/examples/pyqt_example_f.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011,2012,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,10 +26,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -38,71 +38,66 @@ except ImportError: sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit = QtWidgets.QLineEdit(self) self.freq2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) - self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), - self.freq2EditText) + self.freq2Edit.editingFinished.connect(self.freq2EditText) - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + self.quit.clicked.connect(QtWidgets.qApp.quit) def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText(("{0}").format(self.signal1.frequency())) + self.amp1Edit.setText(("{0}").format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.freq2Edit.setText(("{0}").format(self.signal2.frequency())) + self.amp2Edit.setText(("{0}").format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -144,7 +139,7 @@ class my_top_block(gr.top_block): fftsize = 2048 - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) @@ -171,8 +166,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) self.main_box = dialog_box(pyWin, self.ctrl_win) diff --git a/gr-qtgui/examples/pyqt_freq_c.py b/gr-qtgui/examples/pyqt_freq_c.py index c53feb93d4..954a078df8 100755 --- a/gr-qtgui/examples/pyqt_freq_c.py +++ b/gr-qtgui/examples/pyqt_freq_c.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,10 +26,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -44,71 +44,66 @@ except ImportError: sys.stderr.write("Error: Program requires gr-channels.\n") sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit = QtWidgets.QLineEdit(self) self.freq2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) - self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), - self.freq2EditText) + self.freq2Edit.editingFinished.connect(self.freq2EditText) - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + self.quit.clicked.connect(QtWidgets.qApp.quit) def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText(("{0}").format(self.signal1.frequency())) + self.amp1Edit.setText(("{0}").format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.freq2Edit.setText(("{0}").format(self.signal2.frequency())) + self.amp2Edit.setText(("{0}").format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -150,7 +145,7 @@ class my_top_block(gr.top_block): npts = 2048 - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) ss = open(gr.prefix() + '/share/gnuradio/themes/dark.qss') sstext = ss.read() ss.close() @@ -179,8 +174,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) #pyWin.show() self.main_box = dialog_box(pyWin, self.ctrl_win) diff --git a/gr-qtgui/examples/pyqt_freq_f.py b/gr-qtgui/examples/pyqt_freq_f.py index 668b54d249..d7d389b736 100755 --- a/gr-qtgui/examples/pyqt_freq_f.py +++ b/gr-qtgui/examples/pyqt_freq_f.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,10 +26,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -39,71 +39,66 @@ except ImportError: sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit = QtWidgets.QLineEdit(self) self.freq2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) - self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), - self.freq2EditText) + self.freq2Edit.editingFinished.connect(self.freq2EditText) - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + self.quit.clicked.connect(QtWidgets.qApp.quit) def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText(("{0}").format(self.signal1.frequency())) + self.amp1Edit.setText(("{0}").format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.freq2Edit.setText(("{0}").format(self.signal2.frequency())) + self.amp2Edit.setText(("{0}").format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -145,7 +140,7 @@ class my_top_block(gr.top_block): npts = 2048 - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) @@ -169,8 +164,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) #pyWin.show() self.main_box = dialog_box(pyWin, self.ctrl_win) @@ -181,4 +176,3 @@ if __name__ == "__main__": tb.start() tb.qapp.exec_() tb.stop() - diff --git a/gr-qtgui/examples/pyqt_histogram_f.py b/gr-qtgui/examples/pyqt_histogram_f.py index a960275f41..81f7b9d40b 100755 --- a/gr-qtgui/examples/pyqt_histogram_f.py +++ b/gr-qtgui/examples/pyqt_histogram_f.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,10 +26,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -38,87 +38,80 @@ except ImportError: sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, snk, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.snk = snk self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Sine Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Sine Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Noise Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) # Control the histogram - self.hist_npts = QtGui.QLineEdit(self) + self.hist_npts = QtWidgets.QLineEdit(self) self.hist_npts.setMinimumWidth(100) - self.hist_npts.setValidator(QtGui.QIntValidator(0, 8191)) + self.hist_npts.setValidator(Qt.QIntValidator(0, 8191)) self.hist_npts.setText("{0}".format(self.snk.nsamps())) self.layout.addRow("Number of Points:", self.hist_npts) - self.connect(self.hist_npts, QtCore.SIGNAL("editingFinished()"), - self.set_nsamps) + self.hist_npts.editingFinished.connect(self.set_nsamps) - self.hist_bins = QtGui.QLineEdit(self) + self.hist_bins = QtWidgets.QLineEdit(self) self.hist_bins.setMinimumWidth(100) - self.hist_bins.setValidator(QtGui.QIntValidator(0, 1000)) + self.hist_bins.setValidator(Qt.QIntValidator(0, 1000)) self.hist_bins.setText("{0}".format(self.snk.bins())) self.layout.addRow("Number of Bins:", self.hist_bins) - self.connect(self.hist_bins, QtCore.SIGNAL("editingFinished()"), - self.set_bins) + self.hist_bins.editingFinished.connect(self.set_bins) - self.hist_auto = QtGui.QPushButton("scale", self) + self.hist_auto = QtWidgets.QPushButton("scale", self) self.layout.addRow("Autoscale X:", self.hist_auto) - self.connect(self.hist_auto, QtCore.SIGNAL("pressed()"), - self.autoscalex) + self.hist_auto.pressed.connect(self.autoscalex) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + self.quit.clicked.connect(QtWidgets.qApp.quit) def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText(("{0}").format(self.signal1.frequency())) + self.amp1Edit.setText(("{0}").format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.amp2Edit.setText(("{0}").format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -164,7 +157,7 @@ class my_top_block(gr.top_block): npts = 2048 - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0, 0) src2 = analog.noise_source_f(analog.GR_GAUSSIAN, 1) @@ -172,6 +165,7 @@ class my_top_block(gr.top_block): thr = blocks.throttle(gr.sizeof_float, 100*npts) self.snk1 = qtgui.histogram_sink_f(npts, 200, -5, 5, "Histogram") + self.snk1.disable_legend() self.connect(src1, (src,0)) self.connect(src2, (src,1)) @@ -185,8 +179,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) #pyWin.show() self.main_box = dialog_box(pyWin, self.ctrl_win) @@ -197,4 +191,3 @@ if __name__ == "__main__": tb.start() tb.qapp.exec_() tb.stop() - diff --git a/gr-qtgui/examples/pyqt_time_c.py b/gr-qtgui/examples/pyqt_time_c.py index 0162bb6ffc..b595c8ff85 100755 --- a/gr-qtgui/examples/pyqt_time_c.py +++ b/gr-qtgui/examples/pyqt_time_c.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011,2012,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,10 +26,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -44,71 +44,66 @@ except ImportError: sys.stderr.write("Error: Program requires gr-channels.\n") sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit = QtWidgets.QLineEdit(self) self.freq2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) - self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), - self.freq2EditText) + self.freq2Edit.editingFinished.connect(self.freq2EditText) - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + self.quit.clicked.connect(QtWidgets.qApp.quit) def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText(("{0}").format(self.signal1.frequency())) + self.amp1Edit.setText(("{0}").format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.freq2Edit.setText(("{0}").format(self.signal2.frequency())) + self.amp2Edit.setText(("{0}").format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -150,7 +145,7 @@ class my_top_block(gr.top_block): npts = 2048 - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) ss = open(gr.prefix() + '/share/gnuradio/themes/dark.qss') sstext = ss.read() ss.close() @@ -178,13 +173,14 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) # Example of using signal/slot to set the title of a curve - pyWin.connect(pyWin, QtCore.SIGNAL("setLineLabel(int, QString)"), - pyWin, QtCore.SLOT("setLineLabel(int, QString)")) - pyWin.emit(QtCore.SIGNAL("setLineLabel(int, QString)"), 0, "Re{sum}") + # FIXME: update for Qt5 + #pyWin.setLineLabel.connect(pyWin.setLineLabel) + #pyWin.emit(QtCore.SIGNAL("setLineLabel(int, QString)"), 0, "Re{sum}") + self.snk1.set_line_label(0, "Re{Sum}") self.snk1.set_line_label(1, "Im{Sum}") #self.snk1.set_line_label(2, "Re{src1}") #self.snk1.set_line_label(3, "Im{src1}") diff --git a/gr-qtgui/examples/pyqt_time_f.py b/gr-qtgui/examples/pyqt_time_f.py index b733a5a809..3689ebff54 100755 --- a/gr-qtgui/examples/pyqt_time_f.py +++ b/gr-qtgui/examples/pyqt_time_f.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011,2012 Free Software Foundation, Inc. +# Copyright 2011,2012,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,10 +26,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -38,71 +38,66 @@ except ImportError: sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit = QtWidgets.QLineEdit(self) self.freq2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) - self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), - self.freq2EditText) + self.freq2Edit.editingFinished.connect(self.freq2EditText) - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + self.quit.clicked.connect(QtWidgets.qApp.quit) def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText(("{0}").format(self.signal1.frequency())) + self.amp1Edit.setText(("{0}").format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.freq2Edit.setText(("{0}").format(self.signal2.frequency())) + self.amp2Edit.setText(("{0}").format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -144,7 +139,7 @@ class my_top_block(gr.top_block): npts = 2048 - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) @@ -171,13 +166,14 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) # Example of using signal/slot to set the title of a curve - pyWin.connect(pyWin, QtCore.SIGNAL("setLineLabel(int, QString)"), - pyWin, QtCore.SLOT("setLineLabel(int, QString)")) - pyWin.emit(QtCore.SIGNAL("setLineLabel(int, QString)"), 0, "sum") + # FIXME: update for Qt5 + #pyWin.setLineLabel.connect(pyWin.setLineLabel) + #pyWin.emit(QtCore.SIGNAL("setLineLabel(int, QString)"), 0, "Re{sum}") + self.snk1.set_line_label(0, "Re{sum}") self.snk1.set_line_label(1, "src1") self.snk1.set_line_label(2, "src2") @@ -193,4 +189,3 @@ if __name__ == "__main__": tb.start() tb.qapp.exec_() tb.stop() - diff --git a/gr-qtgui/examples/pyqt_time_raster_b.py b/gr-qtgui/examples/pyqt_time_raster_b.py index 4cad9de601..7a94400283 100755 --- a/gr-qtgui/examples/pyqt_time_raster_b.py +++ b/gr-qtgui/examples/pyqt_time_raster_b.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -27,18 +27,18 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + print "Error: Program requires PyQt5 and gr-qtgui." sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.resize(800, 500) @@ -47,7 +47,7 @@ class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self) - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) data0 = 10*[0,] + 40*[1,0] + 10*[0,] data0 += 10*[0,] + 40*[0,1] + 10*[0,] @@ -73,8 +73,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) self.main_box = dialog_box(pyWin) self.main_box.show() @@ -84,4 +84,3 @@ if __name__ == "__main__": tb.start() tb.qapp.exec_() tb.stop() - diff --git a/gr-qtgui/examples/pyqt_time_raster_f.py b/gr-qtgui/examples/pyqt_time_raster_f.py index c5261520db..0f9de94bcb 100755 --- a/gr-qtgui/examples/pyqt_time_raster_f.py +++ b/gr-qtgui/examples/pyqt_time_raster_f.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,18 +26,18 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + print "Error: Program requires PyQt5 and gr-qtgui." sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.resize(800, 500) @@ -46,7 +46,7 @@ class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self) - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) data0 = 10*[0,] + 40*[1,0] + 10*[0,] data0 += 10*[0,] + 40*[0,1] + 10*[0,] @@ -72,8 +72,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) self.main_box = dialog_box(pyWin) self.main_box.show() @@ -83,4 +83,3 @@ if __name__ == "__main__": tb.start() tb.qapp.exec_() tb.stop() - diff --git a/gr-qtgui/examples/pyqt_waterfall_c.py b/gr-qtgui/examples/pyqt_waterfall_c.py index 8ec62fc1e2..3f7119f97f 100755 --- a/gr-qtgui/examples/pyqt_waterfall_c.py +++ b/gr-qtgui/examples/pyqt_waterfall_c.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,7 +26,7 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") @@ -44,71 +44,66 @@ except ImportError: sys.stderr.write("Error: Program requires gr-channels.\n") sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit = QtWidgets.QLineEdit(self) self.freq2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) - self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), - self.freq2EditText) + self.freq2Edit.editingFinished.connect(self.freq2EditText) - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + self.quit.clicked.connect(QtWidgets.qApp.quit) def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText(("{0}").format(self.signal1.frequency())) + self.amp1Edit.setText(("{0}").format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.freq2Edit.setText(("{0}").format(self.signal2.frequency())) + self.amp2Edit.setText(("{0}").format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -152,7 +147,7 @@ class my_top_block(gr.top_block): taps = filter.firdes.complex_band_pass_2(1, Rs, 1500, 2500, 100, 60) - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) ss = open(gr.prefix() + '/share/gnuradio/themes/dark.qss') sstext = ss.read() ss.close() @@ -167,6 +162,8 @@ class my_top_block(gr.top_block): self.snk1 = qtgui.waterfall_sink_c(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Waterfall Example", 2) + self.snk1.set_color_map(0, qtgui.INTENSITY_COLOR_MAP_TYPE_COOL) + self.snk1.set_color_map(1, qtgui.INTENSITY_COLOR_MAP_TYPE_COOL) self.connect(src1, (src,0)) self.connect(src2, (src,1)) @@ -181,8 +178,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) #pyWin.show() self.main_box = dialog_box(pyWin, self.ctrl_win) diff --git a/gr-qtgui/examples/pyqt_waterfall_f.py b/gr-qtgui/examples/pyqt_waterfall_f.py index f9680c28cf..71c72afad6 100755 --- a/gr-qtgui/examples/pyqt_waterfall_f.py +++ b/gr-qtgui/examples/pyqt_waterfall_f.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2015 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,10 +26,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -38,71 +38,66 @@ except ImportError: sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) -class dialog_box(QtGui.QWidget): +class dialog_box(QtWidgets.QWidget): def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self.setWindowTitle('PyQt Test GUI') - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self) self.boxlayout.addWidget(display, 1) self.boxlayout.addWidget(control) self.resize(800, 500) -class control_box(QtGui.QWidget): +class control_box(QtWidgets.QWidget): def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.setWindowTitle('Control Panel') self.setToolTip('Control the signals') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + QtWidgets.QToolTip.setFont(Qt.QFont('OldEnglish', 10)) - self.layout = QtGui.QFormLayout(self) + self.layout = QtWidgets.QFormLayout(self) # Control the first signal - self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit = QtWidgets.QLineEdit(self) self.freq1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) - self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), - self.freq1EditText) + self.freq1Edit.editingFinished.connect(self.freq1EditText) - self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit = QtWidgets.QLineEdit(self) self.amp1Edit.setMinimumWidth(100) self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) - self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), - self.amp1EditText) + self.amp1Edit.editingFinished.connect(self.amp1EditText) # Control the second signal - self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit = QtWidgets.QLineEdit(self) self.freq2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) - self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), - self.freq2EditText) + self.freq2Edit.editingFinished.connect(self.freq2EditText) - self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit = QtWidgets.QLineEdit(self) self.amp2Edit.setMinimumWidth(100) self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) - self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), - self.amp2EditText) + self.amp2Edit.editingFinished.connect(self.amp2EditText) - self.quit = QtGui.QPushButton('Close', self) + self.quit = QtWidgets.QPushButton('Close', self) self.quit.setMinimumWidth(100) self.layout.addWidget(self.quit) - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + self.quit.clicked.connect(QtWidgets.qApp.quit) def attach_signal1(self, signal): self.signal1 = signal - self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) - self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + self.freq1Edit.setText(("{0}").format(self.signal1.frequency())) + self.amp1Edit.setText(("{0}").format(self.signal1.amplitude())) def attach_signal2(self, signal): self.signal2 = signal - self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) - self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + self.freq2Edit.setText(("{0}").format(self.signal2.frequency())) + self.amp2Edit.setText(("{0}").format(self.signal2.amplitude())) def freq1EditText(self): try: @@ -144,7 +139,7 @@ class my_top_block(gr.top_block): npts = 2048 - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) @@ -153,6 +148,8 @@ class my_top_block(gr.top_block): self.snk1 = qtgui.waterfall_sink_f(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Real Waterfall Example", 2) + self.snk1.set_color_map(0, qtgui.INTENSITY_COLOR_MAP_TYPE_COOL) + self.snk1.set_color_map(1, qtgui.INTENSITY_COLOR_MAP_TYPE_COOL) self.connect(src1, (src,0)) self.connect(src2, (src,1)) @@ -167,8 +164,8 @@ class my_top_block(gr.top_block): pyQt = self.snk1.pyqwidget() # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) #pyWin.show() self.main_box = dialog_box(pyWin, self.ctrl_win) @@ -179,4 +176,3 @@ if __name__ == "__main__": tb.start() tb.qapp.exec_() tb.stop() - diff --git a/gr-qtgui/examples/qtgui_tags_viewing.grc b/gr-qtgui/examples/qtgui_tags_viewing.grc index 4c6454537a..635b1e43fa 100644 --- a/gr-qtgui/examples/qtgui_tags_viewing.grc +++ b/gr-qtgui/examples/qtgui_tags_viewing.grc @@ -1,22 +1,23 @@ - + + Wed Nov 6 11:52:40 2013 options - id - qtgui_tags_viewing + author + - _enabled - True + window_size + 1280, 1024 - title - + category + Custom - author + comment @@ -24,241 +25,260 @@ - window_size - 1280, 1024 + _enabled + True - generate_options - qt_gui + _coordinate + (10, 10) - category - Custom + _rotation + 0 - run_options - run + generate_options + qt_gui - run - True + id + qtgui_tags_viewing max_nouts 0 - realtime_scheduling + qt_qss_theme - _coordinate - (10, 10) + realtime_scheduling + - _rotation - 0 + run_command + {python} -u {filename} - - - variable - id - samp_rate + run_options + run - _enabled + run True - value - 32000 - - - _coordinate - (172, 10) + thread_safe_setters + - _rotation - 0 + title + - import + variable_qtgui_range - id - import_1 + comment + + + + value + 300 _enabled True - import - from gnuradio.digital.utils import tagged_streams + _coordinate + (814, 390) - _coordinate - (99, 72) + gui_hint + _rotation 0 - - - import id - import_0 + delay - _enabled - True + label + Delay - import - import scipy + min_len + 200 - _coordinate - (9, 71) + orient + Qt.Horizontal - _rotation + start 0 + + step + 1 + + + stop + 1000 + + + rangeType + float + + + widget + counter_slider + - import + variable_qtgui_range - id - import_2 + comment + + + + value + 30 _enabled True - import - import time + _coordinate + (936, 392) - _coordinate - (253, 71) + gui_hint + _rotation 0 - - - blocks_delay id - blocks_delay_0 + ntaps - _enabled - True + label + Num Taps - type - complex + min_len + 200 - delay - 1000 + orient + Qt.Horizontal - num_ports + start 1 - vlen + step 1 - affinity - - - - minoutbuf - 0 + stop + 100 - _coordinate - (300, 240) + rangeType + float - _rotation - 0 + widget + counter_slider - blocks_tags_strobe + variable - id - blocks_tags_strobe_0 + comment + _enabled True - type - complex + _coordinate + (172, 10) + + + _rotation + 0 + + + id + samp_rate value - pmt.intern("TEST") + 32000 + + + analog_fastnoise_source_x - nsamps - 10000 + amp + 0.004 - vlen - 1 + alias + + + + comment + affinity - minoutbuf - 0 + _enabled + True _coordinate - (16, 232) + (350, 39) _rotation 0 - - - analog_fastnoise_source_x id analog_fastnoise_source_x_0 - _enabled - True + maxoutbuf + 0 - type - complex + minoutbuf + 0 noise_type analog.GR_GAUSSIAN - amp - 0.004 + type + complex seed @@ -268,85 +288,101 @@ samples 8192 + + + blocks_add_xx + + alias + + + + comment + + affinity - minoutbuf - 0 + _enabled + True _coordinate - (350, 39) + (482, 193) _rotation 0 - - - blocks_vector_source_x id - blocks_vector_source_x_0 - - - _enabled - True + blocks_add_xx_0 type complex - vector - [0.85+0.5j, 0.85, 0.85, 0.85+0.5j] + (10000-4)*[0,] + maxoutbuf + 0 - tags - tagged_streams.make_lengthtags((1024,), (0,), "testing tags 0") + minoutbuf + 0 - repeat - True + num_inputs + 2 vlen 1 + + + blocks_add_xx - affinity + alias - minoutbuf - 0 + comment + + + + affinity + + + + _enabled + True _coordinate - (13, 132) + (707, 176) _rotation 0 - - - blocks_add_xx id - blocks_add_xx_0 - - - _enabled - True + blocks_add_xx_1 type complex + maxoutbuf + 0 + + + minoutbuf + 0 + + num_inputs 2 @@ -354,439 +390,1691 @@ vlen 1 + + + blocks_delay + + alias + + + + comment + + affinity - minoutbuf - 0 + delay + 1000 + + + _enabled + True _coordinate - (482, 193) + (300, 240) _rotation 0 - - - blocks_add_xx id - blocks_add_xx_1 + blocks_delay_0 - _enabled - True + maxoutbuf + 0 - type - complex + minoutbuf + 0 - num_inputs - 2 + num_ports + 1 + + + type + complex vlen 1 + + + blocks_delay + + alias + + + + comment + + affinity - minoutbuf - 0 + delay + int(delay) + + + _enabled + True _coordinate - (707, 176) + (890, 44) _rotation 0 - - - blocks_throttle id - blocks_throttle_0 + blocks_delay_0_0 - _enabled - True + maxoutbuf + 0 - type - complex + minoutbuf + 0 - samples_per_second - 50e3 + num_ports + 1 + + + type + complex vlen 1 + + + blocks_tags_strobe + + alias + + + + comment + + affinity - minoutbuf - 0 + _enabled + True _coordinate - (266, 149) + (16, 232) _rotation 0 - - - variable_qtgui_range id - ntaps + blocks_tags_strobe_0 - _enabled - True + key + pmt.intern("strobe") - label - Num Taps + maxoutbuf + 0 - value - 30 + minoutbuf + 0 - start - 1 + nsamps + 10000 - stop - 100 + type + complex - step - 1 + value + pmt.intern("TEST") - widget - counter_slider + vlen + 1 + + + blocks_throttle - orient - Qt.Horizontal + alias + - min_len - 200 + comment + - gui_hint + affinity + _enabled + True + + _coordinate - (936, 392) + (266, 149) _rotation 0 - - - qtgui_time_sink_x id - qtgui_time_sink_x_0_1_0 + blocks_throttle_0 - _enabled + ignoretag True + maxoutbuf + 0 + + + minoutbuf + 0 + + + samples_per_second + 50e3 + + type complex - name + vlen + 1 + + + + blocks_throttle + + alias - size - 5100 + comment + - srate - samp_rate + affinity + - ymin - -0.1 + _enabled + False - ymax - 1.5 + _coordinate + (267, 414) - nconnections - 1 + _rotation + 0 - update_time - 0.001 + id + blocks_throttle_0_0 - tr_mode - qtgui.TRIG_MODE_TAG + ignoretag + True - tr_slope - qtgui.TRIG_SLOPE_POS + maxoutbuf + 0 - tr_level - .5 + minoutbuf + 0 - tr_delay - 0.06 + samples_per_second + samp_rate - tr_chan - 0 + type + float - tr_tag - strobe + vlen + 1 + + + blocks_vector_source_x - entags - True + alias + - gui_hint - 1,1,1,1 + comment + affinity + _enabled + True + + _coordinate - (857, 173) + (13, 132) + + + _rotation + 0 + + + id + blocks_vector_source_x_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + type + complex + + + repeat + True + + + tags + tagged_streams.make_lengthtags((1024,), (0,), "testing tags 0") + + + vlen + 1 + + + vector + [0.85+0.5j, 0.85, 0.85, 0.85+0.5j] + (10000-4)*[0,] + + + + blocks_vector_source_x + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (15, 315) + + + _rotation + 0 + + + id + blocks_vector_source_x_0_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + type + complex + + + repeat + True + + + tags + tagged_streams.make_lengthtags((128,), (1500,), "second stream") + + + vlen + 1 + + + vector + 1500*[0,] + [0.25+0j,] + (10000-1500-1)*[0,] + + + + blocks_vector_source_x + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (15, 489) + + + _rotation + 0 + + + id + blocks_vector_source_x_0_0_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + type + float + + + repeat + True + + + tags + tagged_streams.make_lengthtags((128,), (110,), "second stream") + + + vlen + 1 + + + vector + 10*[0,] + [0.5,] + (100-10-1)*[0,] + + + + blocks_vector_source_x + + alias + + + + comment + + + + affinity + + + + _enabled + False + + + _coordinate + (15, 398) + + + _rotation + 0 + + + id + blocks_vector_source_x_0_1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + type + float + + + repeat + True + + + tags + tagged_streams.make_lengthtags((1024,), (0,), "testing tags") + + + vlen + 1 + + + vector + [-0.85,] + (100-1)*[0,] + + + + fir_filter_xxx + + alias + + + + comment + + + + affinity + + + + decim + 1 + + + _enabled + True + + + _coordinate + (660, 76) + + + _rotation + 0 + + + id + fir_filter_xxx_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + samp_delay + int(ntaps) + + + taps + int(ntaps)*[1,]+[1,] + + + type + ccc + + + + import + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (9, 71) + + + _rotation + 0 + + + id + import_0 + + + import + import scipy + + + + import + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (99, 72) + + + _rotation + 0 + + + id + import_1 + + + import + from gnuradio.digital.utils import tagged_streams + + + + import + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (253, 71) + + + _rotation + 0 + + + id + import_2 + + + import + import time + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + True + + + _coordinate + (860, 298) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + + + + nconnections + 2 + + + size + 18000 + + + srate + samp_rate + + + tr_chan + 0 + + + tr_delay + 0 + + + tr_level + 0.1 + + + tr_mode + qtgui.TRIG_MODE_NORM + + + tr_slope + qtgui.TRIG_SLOPE_POS + + + tr_tag + "" + + + type + complex + + + update_time + 0.10 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1.5 + + + ymin + -0.1 + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + False + + + _coordinate + (475, 444) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_0_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + + + + nconnections + 2 + + + size + 1024 + + + srate + samp_rate + + + tr_chan + 1 + + + tr_delay + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_TAG + + + tr_slope + qtgui.TRIG_SLOPE_POS + + + tr_tag + second stream + + + type + float + + + update_time + 0.10 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1 + + + ymin + -1 + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + True + + + _coordinate + (1072, 77) + + + gui_hint + 1,0,1,1 + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_0_1 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 - _rotation - 0 + width10 + 1 - - - blocks_vector_source_x - id - blocks_vector_source_x_0_0 + alpha2 + 1.0 - _enabled - True + color2 + "red" - type - complex + label2 + - vector - 1500*[0,] + [0.25+0j,] + (10000-1500-1)*[0,] + marker2 + -1 - tags - tagged_streams.make_lengthtags((128,), (1500,), "second stream") + style2 + 1 - repeat - True + width2 + 1 - vlen - 1 + alpha3 + 1.0 - affinity - + color3 + "green" - minoutbuf - 0 + label3 + - _coordinate - (15, 315) + marker3 + -1 - _rotation - 0 + style3 + 1 - - - qtgui_time_sink_x - id - qtgui_time_sink_x_0 + width3 + 1 - _enabled - True + alpha4 + 1.0 - type - complex + color4 + "black" - name + label4 - size - 18000 + marker4 + -1 - srate - samp_rate + style4 + 1 - ymin - -0.1 + width4 + 1 - ymax - 1.5 + alpha5 + 1.0 - nconnections - 2 + color5 + "cyan" - update_time - 0.10 + label5 + - tr_mode - qtgui.TRIG_MODE_NORM + marker5 + -1 - tr_slope - qtgui.TRIG_SLOPE_POS + style5 + 1 - tr_level - 0.1 + width5 + 1 - tr_delay - 0 + alpha6 + 1.0 - tr_chan - 0 + color6 + "magenta" - tr_tag - "" + label6 + - entags - True + marker6 + -1 - gui_hint - + style6 + 1 - affinity - + width6 + 1 - _coordinate - (860, 298) + alpha7 + 1.0 - _rotation - 0 + color7 + "yellow" - - - fir_filter_xxx - id - fir_filter_xxx_0 + label7 + - _enabled - True + marker7 + -1 - type - ccc + style7 + 1 - decim + width7 1 - taps - int(ntaps)*[1,]+[1,] + alpha8 + 1.0 - samp_delay - int(ntaps) + color8 + "dark red" - affinity + label8 - minoutbuf - 0 + marker8 + -1 - _coordinate - (660, 76) + style8 + 1 - _rotation - 0 + width8 + 1 - - - qtgui_time_sink_x - id - qtgui_time_sink_x_0_1 + alpha9 + 1.0 - _enabled - True + color9 + "dark green" - type - complex + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 name + nconnections + 2 + + size 1000 @@ -795,20 +2083,16 @@ samp_rate - ymin - -0.1 - - - ymax - 4.5 + tr_chan + 0 - nconnections - 2 + tr_delay + 0.015 - update_time - 0.10 + tr_level + .1 tr_mode @@ -819,379 +2103,394 @@ qtgui.TRIG_SLOPE_POS - tr_level - .1 + tr_tag + "" - tr_delay - 0.015 + type + complex - tr_chan - 0 + update_time + 0.10 - tr_tag + ylabel + Amplitude + + + yunit "" - entags - True + ymax + 4.5 - gui_hint - 1,0,1,1 + ymin + -0.1 + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False affinity + entags + True + + + _enabled + True + + _coordinate - (1072, 77) + (857, 173) + + + gui_hint + 1,1,1,1 _rotation 0 - - - qtgui_time_sink_x - id - qtgui_time_sink_x_0_0 + grid + False - _enabled - False + id + qtgui_time_sink_x_0_1_0 - type - float + legend + True - name - + alpha1 + 1.0 - size - 1024 + color1 + "blue" - srate - samp_rate + label1 + - ymin + marker1 -1 - ymax + style1 1 - nconnections - 2 + width1 + 1 - update_time - 0.10 + alpha10 + 1.0 - tr_mode - qtgui.TRIG_MODE_TAG + color10 + "blue" - tr_slope - qtgui.TRIG_SLOPE_POS + label10 + - tr_level - 0.0 + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + - tr_delay - 0 + marker2 + -1 - tr_chan + style2 1 - tr_tag - second stream + width2 + 1 - entags - True + alpha3 + 1.0 - gui_hint - + color3 + "green" - affinity + label3 - _coordinate - (475, 444) + marker3 + -1 - _rotation - 0 + style3 + 1 - - - blocks_vector_source_x - id - blocks_vector_source_x_0_0_0 + width3 + 1 - _enabled - False + alpha4 + 1.0 - type - float + color4 + "black" - vector - 10*[0,] + [0.5,] + (100-10-1)*[0,] + label4 + - tags - tagged_streams.make_lengthtags((128,), (110,), "second stream") + marker4 + -1 - repeat - True + style4 + 1 - vlen + width4 1 - affinity - + alpha5 + 1.0 - minoutbuf - 0 + color5 + "cyan" - _coordinate - (15, 489) + label5 + - _rotation - 0 + marker5 + -1 - - - blocks_vector_source_x - id - blocks_vector_source_x_0_1 + style5 + 1 - _enabled - False + width5 + 1 - type - float + alpha6 + 1.0 - vector - [-0.85,] + (100-1)*[0,] + color6 + "magenta" - tags - tagged_streams.make_lengthtags((1024,), (0,), "testing tags") + label6 + - repeat - True + marker6 + -1 - vlen + style6 1 - affinity - + width6 + 1 - minoutbuf - 0 + alpha7 + 1.0 - _coordinate - (15, 398) + color7 + "yellow" - _rotation - 0 + label7 + - - - blocks_throttle - id - blocks_throttle_0_0 + marker7 + -1 - _enabled - False + style7 + 1 - type - float + width7 + 1 - samples_per_second - samp_rate + alpha8 + 1.0 - vlen - 1 + color8 + "dark red" - affinity + label8 - minoutbuf - 0 + marker8 + -1 - _coordinate - (267, 414) + style8 + 1 - _rotation - 0 + width8 + 1 - - - blocks_delay - id - blocks_delay_0_0 + alpha9 + 1.0 - _enabled - True + color9 + "dark green" - type - complex + label9 + - delay - int(delay) + marker9 + -1 - num_ports + style9 1 - vlen + width9 1 - affinity + name - minoutbuf - 0 - - - _coordinate - (890, 44) + nconnections + 1 - _rotation - 0 + size + 5100 - - - variable_qtgui_range - id - delay + srate + samp_rate - _enabled - True + tr_chan + 0 - label - Delay + tr_delay + 0.06 - value - 300 + tr_level + .5 - start - 0 + tr_mode + qtgui.TRIG_MODE_TAG - stop - 1000 + tr_slope + qtgui.TRIG_SLOPE_POS - step - 1 + tr_tag + strobe - widget - counter_slider + type + complex - orient - Qt.Horizontal + update_time + 0.001 - min_len - 200 + ylabel + Amplitude - gui_hint - + yunit + "" - _coordinate - (814, 390) + ymax + 1.5 - _rotation - 0 + ymin + -0.1 - blocks_vector_source_x_0 - blocks_throttle_0 - 0 - 0 - - - blocks_throttle_0 - blocks_add_xx_0 - 0 - 0 - - - blocks_delay_0 - blocks_add_xx_0 - 0 - 1 - - analog_fastnoise_source_x_0 blocks_add_xx_1 0 @@ -1210,28 +2509,28 @@ 0 - fir_filter_xxx_0 - blocks_delay_0_0 + blocks_add_xx_1 + qtgui_time_sink_x_0 0 0 - blocks_delay_0_0 - qtgui_time_sink_x_0_1 + blocks_add_xx_1 + qtgui_time_sink_x_0_1_0 0 0 - fir_filter_xxx_0 - qtgui_time_sink_x_0_1 + blocks_delay_0 + blocks_add_xx_0 0 1 - blocks_vector_source_x_0_0 - qtgui_time_sink_x_0 + blocks_delay_0_0 + qtgui_time_sink_x_0_1 0 - 1 + 0 blocks_tags_strobe_0 @@ -1240,28 +2539,34 @@ 0 - blocks_add_xx_1 - qtgui_time_sink_x_0_1_0 + blocks_throttle_0 + blocks_add_xx_0 0 0 - blocks_add_xx_1 - qtgui_time_sink_x_0 + blocks_throttle_0_0 + qtgui_time_sink_x_0_0 0 0 - blocks_vector_source_x_0_0_0 - qtgui_time_sink_x_0_0 + blocks_vector_source_x_0 + blocks_throttle_0 + 0 + 0 + + + blocks_vector_source_x_0_0 + qtgui_time_sink_x_0 0 1 - blocks_throttle_0_0 + blocks_vector_source_x_0_0_0 qtgui_time_sink_x_0_0 0 - 0 + 1 blocks_vector_source_x_0_1 @@ -1269,4 +2574,16 @@ 0 0 + + fir_filter_xxx_0 + blocks_delay_0_0 + 0 + 0 + + + fir_filter_xxx_0 + qtgui_time_sink_x_0_1 + 0 + 1 + -- 2.11.0 From 1dae9e033016f35416cb433a8a129b4f011eb8c1 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 28 Apr 2016 10:53:12 -0400 Subject: [PATCH 07/22] qtgui: Fixes for edit_box_msg to work with QT5. --- gr-qtgui/examples/c++/CMakeLists.txt | 20 +++++++++++--------- gr-qtgui/grc/qtgui_edit_box_msg.xml | 2 +- gr-qtgui/lib/edit_box_msg_impl.cc | 4 ---- 3 files changed, 12 insertions(+), 14 deletions(-) --- a/gr-qtgui/examples/c++/CMakeLists.txt +++ b/gr-qtgui/examples/c++/CMakeLists.txt @@ -18,14 +18,14 @@ # Boston, MA 02110-1301, USA. include_directories( - ${GR_QTGUI_INCLUDE_DIRS} - ${GR_ANALOG_INCLUDE_DIRS} - ${GR_FILTER_INCLUDE_DIRS} - ${GR_BLOCKS_INCLUDE_DIRS} - ${GR_FFT_INCLUDE_DIRS} - ${GNURADIO_RUNTIME_INCLUDE_DIRS} - ${QT_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} + ${GR_QTGUI_INCLUDE_DIRS} + ${GR_ANALOG_INCLUDE_DIRS} + ${GR_FILTER_INCLUDE_DIRS} + ${GR_BLOCKS_INCLUDE_DIRS} + ${GR_FFT_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} ) list(APPEND QTGUI_LIBRARIES @@ -35,9 +35,11 @@ gnuradio-blocks gnuradio-fft gnuradio-runtime + ${QWT_LIBRARY_DIRS} + ${Qt5Widgets_LIBRARIES} ) -QT4_WRAP_CPP(qtgui_moc_sources display_qt.h) +QT5_WRAP_CPP(qtgui_moc_sources display_qt.h) add_executable(display_qt display_qt.cc ${qtgui_moc_sources}) target_link_libraries(display_qt ${QTGUI_LIBRARIES}) --- a/gr-qtgui/grc/qtgui_edit_box_msg.xml +++ b/gr-qtgui/grc/qtgui_edit_box_msg.xml @@ -7,7 +7,7 @@ QT GUI Message Edit Box qtgui_edit_box_msg - from PyQt4 import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id --- a/gr-qtgui/lib/edit_box_msg_impl.cc +++ b/gr-qtgui/lib/edit_box_msg_impl.cc @@ -66,10 +66,6 @@ d_qApplication = qApp; } else { -#if QT_VERSION >= 0x040500 - std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); - QApplication::setGraphicsSystem(QString(style.c_str())); -#endif d_qApplication = new QApplication(d_argc, &d_argv); } From aa06972a708d3559eae667dd9484edadf722d73c Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 20 Jun 2016 18:37:43 +0200 Subject: [PATCH 08/22] gr-qtgui: Allow build with Qt4 or Qt5 (default) Signed-off-by: Paul Cercueil --- gr-qtgui/CMakeLists.txt | 27 ++++++++++++++++++++------- gr-qtgui/examples/c++/CMakeLists.txt | 11 ++++++++--- gr-qtgui/include/gnuradio/qtgui/form_menus.h | 4 ++++ gr-qtgui/lib/CMakeLists.txt | 14 ++++++++++---- 4 files changed, 42 insertions(+), 14 deletions(-) --- a/gr-qtgui/CMakeLists.txt +++ b/gr-qtgui/CMakeLists.txt @@ -22,14 +22,27 @@ ######################################################################## include(GrBoost) -find_package(Qt5Widgets) - -find_package(Qwt) - find_package(PythonLibs 2) include(GrPython) -GR_PYTHON_CHECK_MODULE("PyQt5" PyQt5 True PYQT5_FOUND) + +set(DESIRED_QT_VERSION 5 CACHE STRING "The Qt version to use (4 or 5)") +set_property(CACHE DESIRED_QT_VERSION PROPERTY STRINGS 4 5) + +if (DESIRED_QT_VERSION MATCHES 4) + find_package(Qt4 COMPONENTS QtCore QtGui) + set(QT_FOUND ${Qt4_FOUND}) + include(GrSetupQt4) +else() + find_package(Qt5Widgets) + set(QT_FOUND ${Qt5Widgets_FOUND}) + set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) + set(QT_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS}) +endif() + +GR_PYTHON_CHECK_MODULE("PyQt${DESIRED_QT_VERSION}" PyQt${DESIRED_QT_VERSION} True PYQT${DESIRED_QT_VERSION}_FOUND) + +find_package(Qwt) ######################################################################## # Register component @@ -37,13 +50,13 @@ include(GrComponent) if(NOT CMAKE_CROSSCOMPILING) set(qt_gui_python_deps - PYQT5_FOUND + PYQT${DESIRED_QT_VERSION}_FOUND ) endif(NOT CMAKE_CROSSCOMPILING) GR_REGISTER_COMPONENT("gr-qtgui" ENABLE_GR_QTGUI Boost_FOUND - Qt5Widgets_FOUND + QT_FOUND QWT_FOUND ENABLE_VOLK ENABLE_GNURADIO_RUNTIME --- a/gr-qtgui/examples/c++/CMakeLists.txt +++ b/gr-qtgui/examples/c++/CMakeLists.txt @@ -24,7 +24,7 @@ ${GR_BLOCKS_INCLUDE_DIRS} ${GR_FFT_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} - ${Qt5Widgets_INCLUDE_DIRS} + ${QT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ) @@ -36,10 +36,15 @@ gnuradio-fft gnuradio-runtime ${QWT_LIBRARY_DIRS} - ${Qt5Widgets_LIBRARIES} + ${QT_LIBRARIES} ) -QT5_WRAP_CPP(qtgui_moc_sources display_qt.h) +if (${DESIRED_QT_VERSION} MATCHES 4) + QT4_WRAP_CPP(qtgui_moc_sources display_qt.h) +else() + QT5_WRAP_CPP(qtgui_moc_sources display_qt.h) +endif() + add_executable(display_qt display_qt.cc ${qtgui_moc_sources}) target_link_libraries(display_qt ${QTGUI_LIBRARIES}) --- a/gr-qtgui/include/gnuradio/qtgui/form_menus.h +++ b/gr-qtgui/include/gnuradio/qtgui/form_menus.h @@ -28,7 +28,11 @@ #include #include #include + +#if QT_VERSION >= 0x050000 #include +#endif + #include #include #include --- a/gr-qtgui/lib/CMakeLists.txt +++ b/gr-qtgui/lib/CMakeLists.txt @@ -45,8 +45,14 @@ ${qtgui_mod_includedir}/VectorDisplayPlot.h edit_box_msg_impl.h ) -QT5_WRAP_CPP(qtgui_moc_sources ${qtgui_moc_hdrs}) -QT5_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui) + +if (${DESIRED_QT_VERSION} MATCHES 4) + QT4_WRAP_CPP(qtgui_moc_sources ${qtgui_moc_hdrs}) + QT4_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui) +else() + QT5_WRAP_CPP(qtgui_moc_sources ${qtgui_moc_hdrs}) + QT5_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui) +endif() #FIXME the sources expect .ui.h, but the macros generate ui_foo.h #avoid changing the sources by generating the header with the include @@ -127,7 +133,7 @@ ${GNURADIO_RUNTIME_INCLUDE_DIRS} ${VOLK_INCLUDE_DIRS} ${QWT_INCLUDE_DIRS} - ${Qt5Widgets_INCLUDE_DIRS} + ${QT_INCLUDE_DIRS} ${FFTW3F_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} @@ -154,7 +160,7 @@ gnuradio-filter ${VOLK_LIBRARIES} ${QWT_LIBRARIES} - ${Qt5Widgets_LIBRARIES} + ${QT_LIBRARIES} ${FFTW3F_LIBRARIES} ) if (WIN32) From dc3db3b5ac29769aa4ab571a670d26e2fc7b6bf6 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 21 Jun 2016 17:42:45 +0200 Subject: [PATCH 09/22] gr-qtgui: Fix PyQt[4,5] include in XMLs for GRC Signed-off-by: Paul Cercueil --- gr-qtgui/grc/CMakeLists.txt | 9 ++++++++- .../grc/{qtgui_ber_sink_b.xml => qtgui_ber_sink_b.xml.cmakein} | 2 +- .../grc/{qtgui_block_tree.xml => qtgui_block_tree.xml.cmakein} | 0 .../grc/{qtgui_check_box.xml => qtgui_check_box.xml.cmakein} | 2 +- gr-qtgui/grc/{qtgui_chooser.xml => qtgui_chooser.xml.cmakein} | 4 ++-- .../{qtgui_const_sink_x.xml => qtgui_const_sink_x.xml.cmakein} | 2 +- .../{qtgui_edit_box_msg.xml => qtgui_edit_box_msg.xml.cmakein} | 2 +- gr-qtgui/grc/{qtgui_entry.xml => qtgui_entry.xml.cmakein} | 2 +- .../grc/{qtgui_freq_sink_x.xml => qtgui_freq_sink_x.xml.cmakein} | 2 +- ...i_histogram_sink_x.xml => qtgui_histogram_sink_x.xml.cmakein} | 2 +- gr-qtgui/grc/{qtgui_label.xml => qtgui_label.xml.cmakein} | 2 +- .../grc/{qtgui_number_sink.xml => qtgui_number_sink.xml.cmakein} | 2 +- .../grc/{qtgui_push_button.xml => qtgui_push_button.xml.cmakein} | 2 +- gr-qtgui/grc/{qtgui_range.xml => qtgui_range.xml.cmakein} | 0 gr-qtgui/grc/{qtgui_sink_x.xml => qtgui_sink_x.xml.cmakein} | 2 +- .../grc/{qtgui_tab_widget.xml => qtgui_tab_widget.xml.cmakein} | 2 +- .../{qtgui_time_raster_x.xml => qtgui_time_raster_x.xml.cmakein} | 2 +- .../grc/{qtgui_time_sink_x.xml => qtgui_time_sink_x.xml.cmakein} | 2 +- .../{qtgui_vector_sink_f.xml => qtgui_vector_sink_f.xml.cmakein} | 2 +- ...i_waterfall_sink_x.xml => qtgui_waterfall_sink_x.xml.cmakein} | 2 +- 20 files changed, 26 insertions(+), 19 deletions(-) rename gr-qtgui/grc/{qtgui_ber_sink_b.xml => qtgui_ber_sink_b.xml.cmakein} (99%) rename gr-qtgui/grc/{qtgui_block_tree.xml => qtgui_block_tree.xml.cmakein} (100%) rename gr-qtgui/grc/{qtgui_check_box.xml => qtgui_check_box.xml.cmakein} (97%) rename gr-qtgui/grc/{qtgui_chooser.xml => qtgui_chooser.xml.cmakein} (98%) rename gr-qtgui/grc/{qtgui_const_sink_x.xml => qtgui_const_sink_x.xml.cmakein} (99%) rename gr-qtgui/grc/{qtgui_edit_box_msg.xml => qtgui_edit_box_msg.xml.cmakein} (98%) rename gr-qtgui/grc/{qtgui_entry.xml => qtgui_entry.xml.cmakein} (97%) rename gr-qtgui/grc/{qtgui_freq_sink_x.xml => qtgui_freq_sink_x.xml.cmakein} (99%) rename gr-qtgui/grc/{qtgui_histogram_sink_x.xml => qtgui_histogram_sink_x.xml.cmakein} (99%) rename gr-qtgui/grc/{qtgui_label.xml => qtgui_label.xml.cmakein} (97%) rename gr-qtgui/grc/{qtgui_number_sink.xml => qtgui_number_sink.xml.cmakein} (99%) rename gr-qtgui/grc/{qtgui_push_button.xml => qtgui_push_button.xml.cmakein} (97%) rename gr-qtgui/grc/{qtgui_range.xml => qtgui_range.xml.cmakein} (100%) rename gr-qtgui/grc/{qtgui_sink_x.xml => qtgui_sink_x.xml.cmakein} (98%) rename gr-qtgui/grc/{qtgui_tab_widget.xml => qtgui_tab_widget.xml.cmakein} (99%) rename gr-qtgui/grc/{qtgui_time_raster_x.xml => qtgui_time_raster_x.xml.cmakein} (99%) rename gr-qtgui/grc/{qtgui_time_sink_x.xml => qtgui_time_sink_x.xml.cmakein} (99%) rename gr-qtgui/grc/{qtgui_vector_sink_f.xml => qtgui_vector_sink_f.xml.cmakein} (99%) rename gr-qtgui/grc/{qtgui_waterfall_sink_x.xml => qtgui_waterfall_sink_x.xml.cmakein} (99%) diff --git a/gr-qtgui/grc/CMakeLists.txt b/gr-qtgui/grc/CMakeLists.txt index d56158ac70..d01bcc52c4 100644 --- a/gr-qtgui/grc/CMakeLists.txt +++ b/gr-qtgui/grc/CMakeLists.txt @@ -18,5 +18,12 @@ # Boston, MA 02110-1301, USA. ######################################################################## -file(GLOB xml_files "*.xml") +file(GLOB xml_cmakein_files "*.xml.cmakein") + +foreach(xml_cmakein_file IN ITEMS ${xml_cmakein_files}) + get_filename_component(FILE_NAME ${xml_cmakein_file} NAME_WE) + configure_file(${xml_cmakein_file} "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.xml" @ONLY) + set(xml_files ${xml_files} "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.xml") +endforeach(xml_cmakein_file) + install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "qtgui_python") diff --git a/gr-qtgui/grc/qtgui_ber_sink_b.xml b/gr-qtgui/grc/qtgui_ber_sink_b.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_ber_sink_b.xml rename to gr-qtgui/grc/qtgui_ber_sink_b.xml.cmakein index 085bf282be..91a87ce595 100644 --- a/gr-qtgui/grc/qtgui_ber_sink_b.xml +++ b/gr-qtgui/grc/qtgui_ber_sink_b.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Bercurve Sink qtgui_bercurve_sink - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui import sip import numpy diff --git a/gr-qtgui/grc/qtgui_block_tree.xml b/gr-qtgui/grc/qtgui_block_tree.xml.cmakein similarity index 100% rename from gr-qtgui/grc/qtgui_block_tree.xml rename to gr-qtgui/grc/qtgui_block_tree.xml.cmakein diff --git a/gr-qtgui/grc/qtgui_check_box.xml b/gr-qtgui/grc/qtgui_check_box.xml.cmakein similarity index 97% rename from gr-qtgui/grc/qtgui_check_box.xml rename to gr-qtgui/grc/qtgui_check_box.xml.cmakein index ccee59dd92..9edacb24d8 100644 --- a/gr-qtgui/grc/qtgui_check_box.xml +++ b/gr-qtgui/grc/qtgui_check_box.xml.cmakein @@ -8,7 +8,7 @@ QT GUI Check Box variable_qtgui_check_box - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt self.$(id) = $(id) = $value #set $win = '_%s_check_box'%$id #if not $label() diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml.cmakein similarity index 98% rename from gr-qtgui/grc/qtgui_chooser.xml rename to gr-qtgui/grc/qtgui_chooser.xml.cmakein index f79bb8ccb3..40c782bede 100644 --- a/gr-qtgui/grc/qtgui_chooser.xml +++ b/gr-qtgui/grc/qtgui_chooser.xml.cmakein @@ -8,8 +8,8 @@ QT GUI Chooser variable_qtgui_chooser - from PyQt5 import Qt - from PyQt5.QtCore import QObject, pyqtSlot + from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt@DESIRED_QT_VERSION@.QtCore import QObject, pyqtSlot self.$(id) = $(id) = $value #slurp #set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())] diff --git a/gr-qtgui/grc/qtgui_const_sink_x.xml b/gr-qtgui/grc/qtgui_const_sink_x.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_const_sink_x.xml rename to gr-qtgui/grc/qtgui_const_sink_x.xml.cmakein index 10f82cce82..6fa725acb1 100644 --- a/gr-qtgui/grc/qtgui_const_sink_x.xml +++ b/gr-qtgui/grc/qtgui_const_sink_x.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Constellation Sink qtgui_const_sink_x - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_edit_box_msg.xml b/gr-qtgui/grc/qtgui_edit_box_msg.xml.cmakein similarity index 98% rename from gr-qtgui/grc/qtgui_edit_box_msg.xml rename to gr-qtgui/grc/qtgui_edit_box_msg.xml.cmakein index d77a4b3e1b..75ff93349f 100644 --- a/gr-qtgui/grc/qtgui_edit_box_msg.xml +++ b/gr-qtgui/grc/qtgui_edit_box_msg.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Message Edit Box qtgui_edit_box_msg - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_entry.xml b/gr-qtgui/grc/qtgui_entry.xml.cmakein similarity index 97% rename from gr-qtgui/grc/qtgui_entry.xml rename to gr-qtgui/grc/qtgui_entry.xml.cmakein index fc0f4089d1..da61ee723a 100644 --- a/gr-qtgui/grc/qtgui_entry.xml +++ b/gr-qtgui/grc/qtgui_entry.xml.cmakein @@ -8,7 +8,7 @@ QT GUI Entry variable_qtgui_entry - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import eng_notation self.$(id) = $(id) = $value #set $win = 'self._%s_tool_bar'%$id diff --git a/gr-qtgui/grc/qtgui_freq_sink_x.xml b/gr-qtgui/grc/qtgui_freq_sink_x.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_freq_sink_x.xml rename to gr-qtgui/grc/qtgui_freq_sink_x.xml.cmakein index ed39db7781..aaf0d75271 100644 --- a/gr-qtgui/grc/qtgui_freq_sink_x.xml +++ b/gr-qtgui/grc/qtgui_freq_sink_x.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Frequency Sink qtgui_freq_sink_x - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip diff --git a/gr-qtgui/grc/qtgui_histogram_sink_x.xml b/gr-qtgui/grc/qtgui_histogram_sink_x.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_histogram_sink_x.xml rename to gr-qtgui/grc/qtgui_histogram_sink_x.xml.cmakein index 9e3dcb104f..d04a44da13 100644 --- a/gr-qtgui/grc/qtgui_histogram_sink_x.xml +++ b/gr-qtgui/grc/qtgui_histogram_sink_x.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Histogram Sink qtgui_histogram_sink_x - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml.cmakein similarity index 97% rename from gr-qtgui/grc/qtgui_label.xml rename to gr-qtgui/grc/qtgui_label.xml.cmakein index 946cee36ab..c546e09dcc 100644 --- a/gr-qtgui/grc/qtgui_label.xml +++ b/gr-qtgui/grc/qtgui_label.xml.cmakein @@ -9,7 +9,7 @@ QT GUI Label variable_qtgui_label - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import eng_notation self.$(id) = $(id) = $value #set $win = 'self._%s_tool_bar'%$id diff --git a/gr-qtgui/grc/qtgui_number_sink.xml b/gr-qtgui/grc/qtgui_number_sink.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_number_sink.xml rename to gr-qtgui/grc/qtgui_number_sink.xml.cmakein index 06837493c3..d4b4c5808f 100644 --- a/gr-qtgui/grc/qtgui_number_sink.xml +++ b/gr-qtgui/grc/qtgui_number_sink.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Number Sink qtgui_number_sink - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_push_button.xml b/gr-qtgui/grc/qtgui_push_button.xml.cmakein similarity index 97% rename from gr-qtgui/grc/qtgui_push_button.xml rename to gr-qtgui/grc/qtgui_push_button.xml.cmakein index 49c2e9d6f0..d99f230acf 100644 --- a/gr-qtgui/grc/qtgui_push_button.xml +++ b/gr-qtgui/grc/qtgui_push_button.xml.cmakein @@ -8,7 +8,7 @@ QT GUI Push Button variable_qtgui_push_button - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt self.$(id) = $(id) = $value #set $win = '_%s_push_button'%$id #if not $label() diff --git a/gr-qtgui/grc/qtgui_range.xml b/gr-qtgui/grc/qtgui_range.xml.cmakein similarity index 100% rename from gr-qtgui/grc/qtgui_range.xml rename to gr-qtgui/grc/qtgui_range.xml.cmakein diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml.cmakein similarity index 98% rename from gr-qtgui/grc/qtgui_sink_x.xml rename to gr-qtgui/grc/qtgui_sink_x.xml.cmakein index a9bc469cd2..1c75921a75 100644 --- a/gr-qtgui/grc/qtgui_sink_x.xml +++ b/gr-qtgui/grc/qtgui_sink_x.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Sink qtgui_sink_x - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip diff --git a/gr-qtgui/grc/qtgui_tab_widget.xml b/gr-qtgui/grc/qtgui_tab_widget.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_tab_widget.xml rename to gr-qtgui/grc/qtgui_tab_widget.xml.cmakein index 805542cc8b..f5a1a73cdc 100644 --- a/gr-qtgui/grc/qtgui_tab_widget.xml +++ b/gr-qtgui/grc/qtgui_tab_widget.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Tab Widget qtgui_tab_widget - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt #set $win = 'self.%s'%$id Qt.QTabWidget() #set $all_labels = [$label0, $label1, $label2, $label3, $label4, diff --git a/gr-qtgui/grc/qtgui_time_raster_x.xml b/gr-qtgui/grc/qtgui_time_raster_x.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_time_raster_x.xml rename to gr-qtgui/grc/qtgui_time_raster_x.xml.cmakein index d458f67eb9..94b7ef136a 100644 --- a/gr-qtgui/grc/qtgui_time_raster_x.xml +++ b/gr-qtgui/grc/qtgui_time_raster_x.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Time Raster Sink qtgui_time_raster_sink_x - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_time_sink_x.xml b/gr-qtgui/grc/qtgui_time_sink_x.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_time_sink_x.xml rename to gr-qtgui/grc/qtgui_time_sink_x.xml.cmakein index d4347950ea..d239917907 100644 --- a/gr-qtgui/grc/qtgui_time_sink_x.xml +++ b/gr-qtgui/grc/qtgui_time_sink_x.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Time Sink qtgui_time_sink_x - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip diff --git a/gr-qtgui/grc/qtgui_vector_sink_f.xml b/gr-qtgui/grc/qtgui_vector_sink_f.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_vector_sink_f.xml rename to gr-qtgui/grc/qtgui_vector_sink_f.xml.cmakein index 0f456323bf..8b928eb7ea 100644 --- a/gr-qtgui/grc/qtgui_vector_sink_f.xml +++ b/gr-qtgui/grc/qtgui_vector_sink_f.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Vector Sink qtgui_vector_sink_f - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml.cmakein similarity index 99% rename from gr-qtgui/grc/qtgui_waterfall_sink_x.xml rename to gr-qtgui/grc/qtgui_waterfall_sink_x.xml.cmakein index a684492246..d198ca084a 100644 --- a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml +++ b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml.cmakein @@ -7,7 +7,7 @@ QT GUI Waterfall Sink qtgui_waterfall_sink_x - from PyQt5 import Qt + from PyQt@DESIRED_QT_VERSION@ import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip -- 2.11.0 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 From 988c1520d5b6f763caa0164faef404185e7dbc85 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 21 Jun 2016 18:30:21 +0200 Subject: [PATCH 11/22] gr-qtgui: Re-introduce some Qt4-specific code Signed-off-by: Paul Cercueil --- gr-qtgui/lib/const_sink_c_impl.cc | 4 ++++ gr-qtgui/lib/freq_sink_c_impl.cc | 4 ++++ gr-qtgui/lib/freq_sink_f_impl.cc | 4 ++++ gr-qtgui/lib/histogram_sink_f_impl.cc | 4 ++++ gr-qtgui/lib/sink_c_impl.cc | 4 ++++ gr-qtgui/lib/sink_f_impl.cc | 4 ++++ gr-qtgui/lib/time_raster_sink_b_impl.cc | 4 ++++ gr-qtgui/lib/time_raster_sink_f_impl.cc | 4 ++++ gr-qtgui/lib/time_sink_c_impl.cc | 4 ++++ gr-qtgui/lib/time_sink_f_impl.cc | 4 ++++ gr-qtgui/lib/vector_sink_f_impl.cc | 4 ++++ gr-qtgui/lib/waterfall_sink_c_impl.cc | 4 ++++ gr-qtgui/lib/waterfall_sink_f_impl.cc | 4 ++++ 13 files changed, 52 insertions(+) --- a/gr-qtgui/lib/const_sink_c_impl.cc +++ b/gr-qtgui/lib/const_sink_c_impl.cc @@ -127,6 +127,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/freq_sink_c_impl.cc +++ b/gr-qtgui/lib/freq_sink_c_impl.cc @@ -156,6 +156,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/freq_sink_f_impl.cc +++ b/gr-qtgui/lib/freq_sink_f_impl.cc @@ -154,6 +154,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/histogram_sink_f_impl.cc +++ b/gr-qtgui/lib/histogram_sink_f_impl.cc @@ -115,6 +115,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/sink_c_impl.cc +++ b/gr-qtgui/lib/sink_c_impl.cc @@ -131,6 +131,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/sink_f_impl.cc +++ b/gr-qtgui/lib/sink_f_impl.cc @@ -131,6 +131,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/time_raster_sink_b_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_b_impl.cc @@ -130,6 +130,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/time_raster_sink_f_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_f_impl.cc @@ -128,6 +128,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/time_sink_c_impl.cc +++ b/gr-qtgui/lib/time_sink_c_impl.cc @@ -134,6 +134,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/time_sink_f_impl.cc +++ b/gr-qtgui/lib/time_sink_f_impl.cc @@ -129,6 +129,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/vector_sink_f_impl.cc +++ b/gr-qtgui/lib/vector_sink_f_impl.cc @@ -140,6 +140,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/waterfall_sink_c_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc @@ -159,6 +159,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } --- a/gr-qtgui/lib/waterfall_sink_f_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc @@ -155,6 +155,10 @@ d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 && QT_VERSION < 0x050000 + std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); + QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } From 6cd8e365b7e519f49c81cfeb7137200d7b5e8b2f Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 21 Jun 2016 19:27:19 +0200 Subject: [PATCH 12/22] grc: Fix generation of Python code for Qt4 and Qt5 Signed-off-by: Paul Cercueil --- 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(-) rename grc/blocks/{options.xml => options.xml.cmakein} (99%) --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -528,7 +528,6 @@ 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) @@ -551,6 +550,7 @@ 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) --- a/grc/blocks/CMakeLists.txt +++ b/grc/blocks/CMakeLists.txt @@ -22,6 +22,8 @@ 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 @@ 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" ) --- a/grc/blocks/options.xml +++ /dev/null @@ -1,294 +0,0 @@ - - - - Options - options - from gnuradio import gr - from gnuradio.filter import firdes - #if $generate_options() == 'wx_gui' -from grc_gnuradio import wxgui as grc_wxgui -import wx -#end if -#if $generate_options() == 'qt_gui' -from PyQt5 import Qt -import sys -#end if -#if $generate_options() == 'bokeh_gui' -import time -import signal -import functools -from bokeh.client import push_session -from bokeh.plotting import curdoc -#end if -#if not $generate_options().startswith('hb') -from optparse import OptionParser -from gnuradio.eng_option import eng_option -from gnuradio import eng_notation -#end if - - if $run: self.start() -else: self.stop(); self.wait() - - Title - title - - string - #if $title() then 'none' else 'part'# - - - Author - author - - string - #if $author() then 'none' else 'part'# - - - Description - description - - string - #if $description() then 'none' else 'part'# - - - Canvas Size - window_size - - int_vector - part - - - Generate Options - generate_options - qt_gui - enum - - - - - - - - - Category - category - [GRC Hier Blocks] - string - #if $generate_options().startswith('hb') then 'none' else 'all'# - - - Run Options - run_options - prompt - enum - #if $generate_options() == 'no_gui' then 'none' else 'all'# - - - - - Widget Placement - placement - (0,0) - int_vector - #if $generate_options() == 'bokeh_gui' then 'part' else 'all'# - - - Sizing Mode - sizing_mode - fixed - enum - #if $generate_options() == 'bokeh_gui' then 'part' else 'all'# - - - - - - - - Run - run - True - bool - -#if $generate_options() in ('qt_gui', 'wx_gui', 'bokeh_gui') - #if $run() - part - #else - none - #end if -#else - all -#end if - - - - - - Max Number of Output - max_nouts - 0 - int - #if $generate_options().startswith('hb') -all#slurp -#elif $max_nouts() -none#slurp -#else -part#slurp -#end if - - - Realtime Scheduling - realtime_scheduling - - enum - #if $generate_options().startswith('hb') -all#slurp -#elif $realtime_scheduling() -none#slurp -#else -part#slurp -#end if - - - - - QSS Theme - qt_qss_theme - - file_open - -#if $generate_options() in ('qt_gui',) - #if $qt_qss_theme() - none - #else - part - #end if -#else - all -#end if - - - - Thread-safe setters - thread_safe_setters - - enum - part - - - Advanced - - - Run Command - run_command - {python} -u {filename} - string - #if $generate_options().startswith('hb') -all#slurp -#else -part#slurp -#end if - Advanced - - - Hier Block Source Path - hier_block_src_path - .: - string - part - Advanced - - not $window_size or len($window_size) == 2 - not $window_size or 300 <= $(window_size)[0] <= 4096 - not $window_size or 300 <= $(window_size)[1] <= 4096 - len($placement) == 4 or len($placement) == 2 - all(i >= 0 for i in $(placement)) - -The options block sets special parameters for the flow graph. \ -Only one option block is allowed per flow graph. - -Title, author, and description parameters are for identification purposes. - -The window size controls the dimensions of the flow graph editor. \ -The window size (width, height) must be between (300, 300) and (4096, 4096). - -The generate options controls the type of code generated. \ -Non-graphical flow graphs should avoid using graphical sinks or graphical variable controls. - -In a graphical application, \ -run can be controlled by a variable to start and stop the flowgraph at runtime. - -The id of this block determines the name of the generated file and the name of the class. \ -For example, an id of my_block will generate the file my_block.py and class my_block(gr.... - -The category parameter determines the placement of the block in the block selection window. \ -The category only applies when creating hier blocks. \ -To put hier blocks into the root category, enter / for the category. - -The Max Number of Output is the maximum number of output items allowed for any block \ -in the flowgraph; to disable this set the max_nouts equal to 0.\ -Use this to adjust the maximum latency a flowgraph can exhibit. - - --- /dev/null +++ b/grc/blocks/options.xml.cmakein @@ -0,0 +1,294 @@ + + + + Options + options + from gnuradio import gr + from gnuradio.filter import firdes + #if $generate_options() == 'wx_gui' +from grc_gnuradio import wxgui as grc_wxgui +import wx +#end if +#if $generate_options() == 'qt_gui' +from PyQt@DESIRED_QT_VERSION@ import Qt +import sys +#end if +#if $generate_options() == 'bokeh_gui' +import time +import signal +import functools +from bokeh.client import push_session +from bokeh.plotting import curdoc +#end if +#if not $generate_options().startswith('hb') +from optparse import OptionParser +from gnuradio.eng_option import eng_option +from gnuradio import eng_notation +#end if + + if $run: self.start() +else: self.stop(); self.wait() + + Title + title + + string + #if $title() then 'none' else 'part'# + + + Author + author + + string + #if $author() then 'none' else 'part'# + + + Description + description + + string + #if $description() then 'none' else 'part'# + + + Canvas Size + window_size + + int_vector + part + + + Generate Options + generate_options + qt_gui + enum + + + + + + + + + Category + category + [GRC Hier Blocks] + string + #if $generate_options().startswith('hb') then 'none' else 'all'# + + + Run Options + run_options + prompt + enum + #if $generate_options() == 'no_gui' then 'none' else 'all'# + + + + + Widget Placement + placement + (0,0) + int_vector + #if $generate_options() == 'bokeh_gui' then 'part' else 'all'# + + + Sizing Mode + sizing_mode + fixed + enum + #if $generate_options() == 'bokeh_gui' then 'part' else 'all'# + + + + + + + + Run + run + True + bool + +#if $generate_options() in ('qt_gui', 'wx_gui', 'bokeh_gui') + #if $run() + part + #else + none + #end if +#else + all +#end if + + + + + + Max Number of Output + max_nouts + 0 + int + #if $generate_options().startswith('hb') +all#slurp +#elif $max_nouts() +none#slurp +#else +part#slurp +#end if + + + Realtime Scheduling + realtime_scheduling + + enum + #if $generate_options().startswith('hb') +all#slurp +#elif $realtime_scheduling() +none#slurp +#else +part#slurp +#end if + + + + + QSS Theme + qt_qss_theme + + file_open + +#if $generate_options() in ('qt_gui',) + #if $qt_qss_theme() + none + #else + part + #end if +#else + all +#end if + + + + Thread-safe setters + thread_safe_setters + + enum + part + + + Advanced + + + Run Command + run_command + {python} -u {filename} + string + #if $generate_options().startswith('hb') +all#slurp +#else +part#slurp +#end if + Advanced + + + Hier Block Source Path + hier_block_src_path + .: + string + part + Advanced + + not $window_size or len($window_size) == 2 + not $window_size or 300 <= $(window_size)[0] <= 4096 + not $window_size or 300 <= $(window_size)[1] <= 4096 + len($placement) == 4 or len($placement) == 2 + all(i >= 0 for i in $(placement)) + +The options block sets special parameters for the flow graph. \ +Only one option block is allowed per flow graph. + +Title, author, and description parameters are for identification purposes. + +The window size controls the dimensions of the flow graph editor. \ +The window size (width, height) must be between (300, 300) and (4096, 4096). + +The generate options controls the type of code generated. \ +Non-graphical flow graphs should avoid using graphical sinks or graphical variable controls. + +In a graphical application, \ +run can be controlled by a variable to start and stop the flowgraph at runtime. + +The id of this block determines the name of the generated file and the name of the class. \ +For example, an id of my_block will generate the file my_block.py and class my_block(gr.... + +The category parameter determines the placement of the block in the block selection window. \ +The category only applies when creating hier blocks. \ +To put hier blocks into the root category, enter / for the category. + +The Max Number of Output is the maximum number of output items allowed for any block \ +in the flowgraph; to disable this set the max_nouts equal to 0.\ +Use this to adjust the maximum latency a flowgraph can exhibit. + + --- a/grc/core/generator/flow_graph.tmpl +++ b/grc/core/generator/flow_graph.tmpl @@ -36,6 +36,10 @@ 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', 'bokeh_gui') From ab58fcfd12be3e60a9dfaac757a3b8c663c2fc4b Mon Sep 17 00:00:00 2001 From: Sebastian Koslowski Date: Tue, 30 Aug 2016 09:49:58 +0200 Subject: [PATCH 13/22] grc: replace templated xml files with search and replace for qt4 --- grc/blocks/CMakeLists.txt | 23 +++++++++++++++++++---- grc/blocks/{options.xml.cmakein => options.xml} | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) rename grc/blocks/{options.xml.cmakein => options.xml} (99%) --- a/grc/blocks/CMakeLists.txt +++ b/grc/blocks/CMakeLists.txt @@ -22,7 +22,18 @@ file(GLOB xml_files "*.xml") -configure_file(options.xml.cmakein "${CMAKE_CURRENT_BINARY_DIR}/options.xml" @ONLY) +macro(REPLACE_IN_FILE _xml_block match replace) + set(xml_block_src "${CMAKE_CURRENT_SOURCE_DIR}/${_xml_block}") + set(xml_block "${CMAKE_CURRENT_BINARY_DIR}/${_xml_block}") + + list(REMOVE_ITEM xml_files "${xml_block_src}") + file(READ "${xml_block_src}" xml_block_src_text) + string(REPLACE "${match}" "${replace}" + xml_block_text "${xml_block_src_text}") + file(WRITE "${xml_block}" "${xml_block_text}") + + list(APPEND generated_xml_files "${xml_block}") +endmacro() macro(GEN_BLOCK_XML _generator _xml_block) set(generator ${CMAKE_CURRENT_SOURCE_DIR}/${_generator}) @@ -32,14 +43,18 @@ DEPENDS ${generator} OUTPUT ${xml_block} COMMAND ${PYTHON_EXECUTABLE} ${generator} ${xml_block} ) -endmacro(GEN_BLOCK_XML) +endmacro() + +GEN_BLOCK_XML(variable_struct.xml.py variable_struct.xml) -GEN_BLOCK_XML(variable_struct.xml.py variable_struct.xml) +if(DESIRED_QT_VERSION EQUAL 4) + REPLACE_IN_FILE(options.xml PyQt5 PyQt4) +endif() add_custom_target(grc_generated_xml ALL DEPENDS ${generated_xml_files}) install( - FILES ${xml_files} "${CMAKE_CURRENT_BINARY_DIR}/options.xml" ${generated_xml_files} + FILES ${xml_files} ${generated_xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "grc" ) --- a/grc/blocks/options.xml.cmakein +++ /dev/null @@ -1,294 +0,0 @@ - - - - Options - options - from gnuradio import gr - from gnuradio.filter import firdes - #if $generate_options() == 'wx_gui' -from grc_gnuradio import wxgui as grc_wxgui -import wx -#end if -#if $generate_options() == 'qt_gui' -from PyQt@DESIRED_QT_VERSION@ import Qt -import sys -#end if -#if $generate_options() == 'bokeh_gui' -import time -import signal -import functools -from bokeh.client import push_session -from bokeh.plotting import curdoc -#end if -#if not $generate_options().startswith('hb') -from optparse import OptionParser -from gnuradio.eng_option import eng_option -from gnuradio import eng_notation -#end if - - if $run: self.start() -else: self.stop(); self.wait() - - Title - title - - string - #if $title() then 'none' else 'part'# - - - Author - author - - string - #if $author() then 'none' else 'part'# - - - Description - description - - string - #if $description() then 'none' else 'part'# - - - Canvas Size - window_size - - int_vector - part - - - Generate Options - generate_options - qt_gui - enum - - - - - - - - - Category - category - [GRC Hier Blocks] - string - #if $generate_options().startswith('hb') then 'none' else 'all'# - - - Run Options - run_options - prompt - enum - #if $generate_options() == 'no_gui' then 'none' else 'all'# - - - - - Widget Placement - placement - (0,0) - int_vector - #if $generate_options() == 'bokeh_gui' then 'part' else 'all'# - - - Sizing Mode - sizing_mode - fixed - enum - #if $generate_options() == 'bokeh_gui' then 'part' else 'all'# - - - - - - - - Run - run - True - bool - -#if $generate_options() in ('qt_gui', 'wx_gui', 'bokeh_gui') - #if $run() - part - #else - none - #end if -#else - all -#end if - - - - - - Max Number of Output - max_nouts - 0 - int - #if $generate_options().startswith('hb') -all#slurp -#elif $max_nouts() -none#slurp -#else -part#slurp -#end if - - - Realtime Scheduling - realtime_scheduling - - enum - #if $generate_options().startswith('hb') -all#slurp -#elif $realtime_scheduling() -none#slurp -#else -part#slurp -#end if - - - - - QSS Theme - qt_qss_theme - - file_open - -#if $generate_options() in ('qt_gui',) - #if $qt_qss_theme() - none - #else - part - #end if -#else - all -#end if - - - - Thread-safe setters - thread_safe_setters - - enum - part - - - Advanced - - - Run Command - run_command - {python} -u {filename} - string - #if $generate_options().startswith('hb') -all#slurp -#else -part#slurp -#end if - Advanced - - - Hier Block Source Path - hier_block_src_path - .: - string - part - Advanced - - not $window_size or len($window_size) == 2 - not $window_size or 300 <= $(window_size)[0] <= 4096 - not $window_size or 300 <= $(window_size)[1] <= 4096 - len($placement) == 4 or len($placement) == 2 - all(i >= 0 for i in $(placement)) - -The options block sets special parameters for the flow graph. \ -Only one option block is allowed per flow graph. - -Title, author, and description parameters are for identification purposes. - -The window size controls the dimensions of the flow graph editor. \ -The window size (width, height) must be between (300, 300) and (4096, 4096). - -The generate options controls the type of code generated. \ -Non-graphical flow graphs should avoid using graphical sinks or graphical variable controls. - -In a graphical application, \ -run can be controlled by a variable to start and stop the flowgraph at runtime. - -The id of this block determines the name of the generated file and the name of the class. \ -For example, an id of my_block will generate the file my_block.py and class my_block(gr.... - -The category parameter determines the placement of the block in the block selection window. \ -The category only applies when creating hier blocks. \ -To put hier blocks into the root category, enter / for the category. - -The Max Number of Output is the maximum number of output items allowed for any block \ -in the flowgraph; to disable this set the max_nouts equal to 0.\ -Use this to adjust the maximum latency a flowgraph can exhibit. - - --- /dev/null +++ b/grc/blocks/options.xml @@ -0,0 +1,294 @@ + + + + Options + options + from gnuradio import gr + from gnuradio.filter import firdes + #if $generate_options() == 'wx_gui' +from grc_gnuradio import wxgui as grc_wxgui +import wx +#end if +#if $generate_options() == 'qt_gui' +from PyQt5 import Qt +import sys +#end if +#if $generate_options() == 'bokeh_gui' +import time +import signal +import functools +from bokeh.client import push_session +from bokeh.plotting import curdoc +#end if +#if not $generate_options().startswith('hb') +from optparse import OptionParser +from gnuradio.eng_option import eng_option +from gnuradio import eng_notation +#end if + + if $run: self.start() +else: self.stop(); self.wait() + + Title + title + + string + #if $title() then 'none' else 'part'# + + + Author + author + + string + #if $author() then 'none' else 'part'# + + + Description + description + + string + #if $description() then 'none' else 'part'# + + + Canvas Size + window_size + + int_vector + part + + + Generate Options + generate_options + qt_gui + enum + + + + + + + + + Category + category + [GRC Hier Blocks] + string + #if $generate_options().startswith('hb') then 'none' else 'all'# + + + Run Options + run_options + prompt + enum + #if $generate_options() == 'no_gui' then 'none' else 'all'# + + + + + Widget Placement + placement + (0,0) + int_vector + #if $generate_options() == 'bokeh_gui' then 'part' else 'all'# + + + Sizing Mode + sizing_mode + fixed + enum + #if $generate_options() == 'bokeh_gui' then 'part' else 'all'# + + + + + + + + Run + run + True + bool + +#if $generate_options() in ('qt_gui', 'wx_gui', 'bokeh_gui') + #if $run() + part + #else + none + #end if +#else + all +#end if + + + + + + Max Number of Output + max_nouts + 0 + int + #if $generate_options().startswith('hb') +all#slurp +#elif $max_nouts() +none#slurp +#else +part#slurp +#end if + + + Realtime Scheduling + realtime_scheduling + + enum + #if $generate_options().startswith('hb') +all#slurp +#elif $realtime_scheduling() +none#slurp +#else +part#slurp +#end if + + + + + QSS Theme + qt_qss_theme + + file_open + +#if $generate_options() in ('qt_gui',) + #if $qt_qss_theme() + none + #else + part + #end if +#else + all +#end if + + + + Thread-safe setters + thread_safe_setters + + enum + part + + + Advanced + + + Run Command + run_command + {python} -u {filename} + string + #if $generate_options().startswith('hb') +all#slurp +#else +part#slurp +#end if + Advanced + + + Hier Block Source Path + hier_block_src_path + .: + string + part + Advanced + + not $window_size or len($window_size) == 2 + not $window_size or 300 <= $(window_size)[0] <= 4096 + not $window_size or 300 <= $(window_size)[1] <= 4096 + len($placement) == 4 or len($placement) == 2 + all(i >= 0 for i in $(placement)) + +The options block sets special parameters for the flow graph. \ +Only one option block is allowed per flow graph. + +Title, author, and description parameters are for identification purposes. + +The window size controls the dimensions of the flow graph editor. \ +The window size (width, height) must be between (300, 300) and (4096, 4096). + +The generate options controls the type of code generated. \ +Non-graphical flow graphs should avoid using graphical sinks or graphical variable controls. + +In a graphical application, \ +run can be controlled by a variable to start and stop the flowgraph at runtime. + +The id of this block determines the name of the generated file and the name of the class. \ +For example, an id of my_block will generate the file my_block.py and class my_block(gr.... + +The category parameter determines the placement of the block in the block selection window. \ +The category only applies when creating hier blocks. \ +To put hier blocks into the root category, enter / for the category. + +The Max Number of Output is the maximum number of output items allowed for any block \ +in the flowgraph; to disable this set the max_nouts equal to 0.\ +Use this to adjust the maximum latency a flowgraph can exhibit. + + From d796f30a241ed29831d597ee27df01556a80d2f1 Mon Sep 17 00:00:00 2001 From: Sebastian Koslowski Date: Tue, 30 Aug 2016 17:52:09 +0200 Subject: [PATCH 14/22] qtgui: replace templated xml files with search and replace for qt4 --- gr-qtgui/grc/CMakeLists.txt | 32 +++++++++++++++++----- ...ber_sink_b.xml.cmakein => qtgui_ber_sink_b.xml} | 2 +- ...block_tree.xml.cmakein => qtgui_block_tree.xml} | 0 ...i_check_box.xml.cmakein => qtgui_check_box.xml} | 2 +- ...qtgui_chooser.xml.cmakein => qtgui_chooser.xml} | 4 +-- ...t_sink_x.xml.cmakein => qtgui_const_sink_x.xml} | 2 +- ..._box_msg.xml.cmakein => qtgui_edit_box_msg.xml} | 2 +- .../{qtgui_entry.xml.cmakein => qtgui_entry.xml} | 2 +- ...eq_sink_x.xml.cmakein => qtgui_freq_sink_x.xml} | 2 +- ...nk_x.xml.cmakein => qtgui_histogram_sink_x.xml} | 2 +- .../{qtgui_label.xml.cmakein => qtgui_label.xml} | 2 +- ...mber_sink.xml.cmakein => qtgui_number_sink.xml} | 2 +- ...sh_button.xml.cmakein => qtgui_push_button.xml} | 2 +- .../{qtgui_range.xml.cmakein => qtgui_range.xml} | 0 .../{qtgui_sink_x.xml.cmakein => qtgui_sink_x.xml} | 2 +- ...tab_widget.xml.cmakein => qtgui_tab_widget.xml} | 2 +- ...aster_x.xml.cmakein => qtgui_time_raster_x.xml} | 2 +- ...me_sink_x.xml.cmakein => qtgui_time_sink_x.xml} | 2 +- ..._sink_f.xml.cmakein => qtgui_vector_sink_f.xml} | 2 +- ...nk_x.xml.cmakein => qtgui_waterfall_sink_x.xml} | 2 +- 20 files changed, 43 insertions(+), 25 deletions(-) rename gr-qtgui/grc/{qtgui_ber_sink_b.xml.cmakein => qtgui_ber_sink_b.xml} (99%) rename gr-qtgui/grc/{qtgui_block_tree.xml.cmakein => qtgui_block_tree.xml} (100%) rename gr-qtgui/grc/{qtgui_check_box.xml.cmakein => qtgui_check_box.xml} (97%) rename gr-qtgui/grc/{qtgui_chooser.xml.cmakein => qtgui_chooser.xml} (98%) rename gr-qtgui/grc/{qtgui_const_sink_x.xml.cmakein => qtgui_const_sink_x.xml} (99%) rename gr-qtgui/grc/{qtgui_edit_box_msg.xml.cmakein => qtgui_edit_box_msg.xml} (98%) rename gr-qtgui/grc/{qtgui_entry.xml.cmakein => qtgui_entry.xml} (97%) rename gr-qtgui/grc/{qtgui_freq_sink_x.xml.cmakein => qtgui_freq_sink_x.xml} (99%) rename gr-qtgui/grc/{qtgui_histogram_sink_x.xml.cmakein => qtgui_histogram_sink_x.xml} (99%) rename gr-qtgui/grc/{qtgui_label.xml.cmakein => qtgui_label.xml} (97%) rename gr-qtgui/grc/{qtgui_number_sink.xml.cmakein => qtgui_number_sink.xml} (99%) rename gr-qtgui/grc/{qtgui_push_button.xml.cmakein => qtgui_push_button.xml} (97%) rename gr-qtgui/grc/{qtgui_range.xml.cmakein => qtgui_range.xml} (100%) rename gr-qtgui/grc/{qtgui_sink_x.xml.cmakein => qtgui_sink_x.xml} (98%) rename gr-qtgui/grc/{qtgui_tab_widget.xml.cmakein => qtgui_tab_widget.xml} (99%) rename gr-qtgui/grc/{qtgui_time_raster_x.xml.cmakein => qtgui_time_raster_x.xml} (99%) rename gr-qtgui/grc/{qtgui_time_sink_x.xml.cmakein => qtgui_time_sink_x.xml} (99%) rename gr-qtgui/grc/{qtgui_vector_sink_f.xml.cmakein => qtgui_vector_sink_f.xml} (99%) rename gr-qtgui/grc/{qtgui_waterfall_sink_x.xml.cmakein => qtgui_waterfall_sink_x.xml} (99%) diff --git a/gr-qtgui/grc/CMakeLists.txt b/gr-qtgui/grc/CMakeLists.txt index d01bcc52c4..74e6958639 100644 --- a/gr-qtgui/grc/CMakeLists.txt +++ b/gr-qtgui/grc/CMakeLists.txt @@ -18,12 +18,30 @@ # Boston, MA 02110-1301, USA. ######################################################################## -file(GLOB xml_cmakein_files "*.xml.cmakein") +file(GLOB xml_files "*.xml") -foreach(xml_cmakein_file IN ITEMS ${xml_cmakein_files}) - get_filename_component(FILE_NAME ${xml_cmakein_file} NAME_WE) - configure_file(${xml_cmakein_file} "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.xml" @ONLY) - set(xml_files ${xml_files} "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.xml") -endforeach(xml_cmakein_file) +macro(REPLACE_IN_FILE _xml_block match replace) + set(xml_block_src "${CMAKE_CURRENT_SOURCE_DIR}/${_xml_block}") + set(xml_block "${CMAKE_CURRENT_BINARY_DIR}/${_xml_block}") -install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "qtgui_python") + list(REMOVE_ITEM xml_files "${xml_block_src}") + file(READ "${xml_block_src}" xml_block_src_text) + string(REPLACE "${match}" "${replace}" + xml_block_text "${xml_block_src_text}") + file(WRITE "${xml_block}" "${xml_block_text}") + + list(APPEND generated_xml_files "${xml_block}") +endmacro() + + +if(DESIRED_QT_VERSION EQUAL 4) + foreach(xml_block_src ${xml_files}) + get_filename_component(xml_block "${xml_block_src}" NAME) + REPLACE_IN_FILE("${xml_block}" "PyQt5" "PyQt4") + endforeach() +endif() + +install( + FILES ${xml_files} ${generated_xml_files} + DESTINATION "${GRC_BLOCKS_DIR}" +) diff --git a/gr-qtgui/grc/qtgui_ber_sink_b.xml.cmakein b/gr-qtgui/grc/qtgui_ber_sink_b.xml similarity index 99% rename from gr-qtgui/grc/qtgui_ber_sink_b.xml.cmakein rename to gr-qtgui/grc/qtgui_ber_sink_b.xml index 91a87ce595..05a36dfbc0 100644 --- a/gr-qtgui/grc/qtgui_ber_sink_b.xml.cmakein +++ b/gr-qtgui/grc/qtgui_ber_sink_b.xml @@ -7,7 +7,7 @@ QT GUI Bercurve Sink qtgui_bercurve_sink - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5import Qt from gnuradio import qtgui import sip import numpy diff --git a/gr-qtgui/grc/qtgui_block_tree.xml.cmakein b/gr-qtgui/grc/qtgui_block_tree.xml similarity index 100% rename from gr-qtgui/grc/qtgui_block_tree.xml.cmakein rename to gr-qtgui/grc/qtgui_block_tree.xml diff --git a/gr-qtgui/grc/qtgui_check_box.xml.cmakein b/gr-qtgui/grc/qtgui_check_box.xml similarity index 97% rename from gr-qtgui/grc/qtgui_check_box.xml.cmakein rename to gr-qtgui/grc/qtgui_check_box.xml index 9edacb24d8..ccee59dd92 100644 --- a/gr-qtgui/grc/qtgui_check_box.xml.cmakein +++ b/gr-qtgui/grc/qtgui_check_box.xml @@ -8,7 +8,7 @@ QT GUI Check Box variable_qtgui_check_box - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt self.$(id) = $(id) = $value #set $win = '_%s_check_box'%$id #if not $label() diff --git a/gr-qtgui/grc/qtgui_chooser.xml.cmakein b/gr-qtgui/grc/qtgui_chooser.xml similarity index 98% rename from gr-qtgui/grc/qtgui_chooser.xml.cmakein rename to gr-qtgui/grc/qtgui_chooser.xml index 40c782bede..f79bb8ccb3 100644 --- a/gr-qtgui/grc/qtgui_chooser.xml.cmakein +++ b/gr-qtgui/grc/qtgui_chooser.xml @@ -8,8 +8,8 @@ QT GUI Chooser variable_qtgui_chooser - from PyQt@DESIRED_QT_VERSION@ import Qt - from PyQt@DESIRED_QT_VERSION@.QtCore import QObject, pyqtSlot + from PyQt5 import Qt + from PyQt5.QtCore import QObject, pyqtSlot self.$(id) = $(id) = $value #slurp #set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())] diff --git a/gr-qtgui/grc/qtgui_const_sink_x.xml.cmakein b/gr-qtgui/grc/qtgui_const_sink_x.xml similarity index 99% rename from gr-qtgui/grc/qtgui_const_sink_x.xml.cmakein rename to gr-qtgui/grc/qtgui_const_sink_x.xml index 6fa725acb1..10f82cce82 100644 --- a/gr-qtgui/grc/qtgui_const_sink_x.xml.cmakein +++ b/gr-qtgui/grc/qtgui_const_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Constellation Sink qtgui_const_sink_x - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_edit_box_msg.xml.cmakein b/gr-qtgui/grc/qtgui_edit_box_msg.xml similarity index 98% rename from gr-qtgui/grc/qtgui_edit_box_msg.xml.cmakein rename to gr-qtgui/grc/qtgui_edit_box_msg.xml index 75ff93349f..d77a4b3e1b 100644 --- a/gr-qtgui/grc/qtgui_edit_box_msg.xml.cmakein +++ b/gr-qtgui/grc/qtgui_edit_box_msg.xml @@ -7,7 +7,7 @@ QT GUI Message Edit Box qtgui_edit_box_msg - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_entry.xml.cmakein b/gr-qtgui/grc/qtgui_entry.xml similarity index 97% rename from gr-qtgui/grc/qtgui_entry.xml.cmakein rename to gr-qtgui/grc/qtgui_entry.xml index da61ee723a..fc0f4089d1 100644 --- a/gr-qtgui/grc/qtgui_entry.xml.cmakein +++ b/gr-qtgui/grc/qtgui_entry.xml @@ -8,7 +8,7 @@ QT GUI Entry variable_qtgui_entry - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import eng_notation self.$(id) = $(id) = $value #set $win = 'self._%s_tool_bar'%$id diff --git a/gr-qtgui/grc/qtgui_freq_sink_x.xml.cmakein b/gr-qtgui/grc/qtgui_freq_sink_x.xml similarity index 99% rename from gr-qtgui/grc/qtgui_freq_sink_x.xml.cmakein rename to gr-qtgui/grc/qtgui_freq_sink_x.xml index aaf0d75271..ed39db7781 100644 --- a/gr-qtgui/grc/qtgui_freq_sink_x.xml.cmakein +++ b/gr-qtgui/grc/qtgui_freq_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Frequency Sink qtgui_freq_sink_x - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip diff --git a/gr-qtgui/grc/qtgui_histogram_sink_x.xml.cmakein b/gr-qtgui/grc/qtgui_histogram_sink_x.xml similarity index 99% rename from gr-qtgui/grc/qtgui_histogram_sink_x.xml.cmakein rename to gr-qtgui/grc/qtgui_histogram_sink_x.xml index d04a44da13..9e3dcb104f 100644 --- a/gr-qtgui/grc/qtgui_histogram_sink_x.xml.cmakein +++ b/gr-qtgui/grc/qtgui_histogram_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Histogram Sink qtgui_histogram_sink_x - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_label.xml.cmakein b/gr-qtgui/grc/qtgui_label.xml similarity index 97% rename from gr-qtgui/grc/qtgui_label.xml.cmakein rename to gr-qtgui/grc/qtgui_label.xml index c546e09dcc..946cee36ab 100644 --- a/gr-qtgui/grc/qtgui_label.xml.cmakein +++ b/gr-qtgui/grc/qtgui_label.xml @@ -9,7 +9,7 @@ QT GUI Label variable_qtgui_label - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import eng_notation self.$(id) = $(id) = $value #set $win = 'self._%s_tool_bar'%$id diff --git a/gr-qtgui/grc/qtgui_number_sink.xml.cmakein b/gr-qtgui/grc/qtgui_number_sink.xml similarity index 99% rename from gr-qtgui/grc/qtgui_number_sink.xml.cmakein rename to gr-qtgui/grc/qtgui_number_sink.xml index d4b4c5808f..06837493c3 100644 --- a/gr-qtgui/grc/qtgui_number_sink.xml.cmakein +++ b/gr-qtgui/grc/qtgui_number_sink.xml @@ -7,7 +7,7 @@ QT GUI Number Sink qtgui_number_sink - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_push_button.xml.cmakein b/gr-qtgui/grc/qtgui_push_button.xml similarity index 97% rename from gr-qtgui/grc/qtgui_push_button.xml.cmakein rename to gr-qtgui/grc/qtgui_push_button.xml index d99f230acf..49c2e9d6f0 100644 --- a/gr-qtgui/grc/qtgui_push_button.xml.cmakein +++ b/gr-qtgui/grc/qtgui_push_button.xml @@ -8,7 +8,7 @@ QT GUI Push Button variable_qtgui_push_button - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt self.$(id) = $(id) = $value #set $win = '_%s_push_button'%$id #if not $label() diff --git a/gr-qtgui/grc/qtgui_range.xml.cmakein b/gr-qtgui/grc/qtgui_range.xml similarity index 100% rename from gr-qtgui/grc/qtgui_range.xml.cmakein rename to gr-qtgui/grc/qtgui_range.xml diff --git a/gr-qtgui/grc/qtgui_sink_x.xml.cmakein b/gr-qtgui/grc/qtgui_sink_x.xml similarity index 98% rename from gr-qtgui/grc/qtgui_sink_x.xml.cmakein rename to gr-qtgui/grc/qtgui_sink_x.xml index 1c75921a75..a9bc469cd2 100644 --- a/gr-qtgui/grc/qtgui_sink_x.xml.cmakein +++ b/gr-qtgui/grc/qtgui_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Sink qtgui_sink_x - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip diff --git a/gr-qtgui/grc/qtgui_tab_widget.xml.cmakein b/gr-qtgui/grc/qtgui_tab_widget.xml similarity index 99% rename from gr-qtgui/grc/qtgui_tab_widget.xml.cmakein rename to gr-qtgui/grc/qtgui_tab_widget.xml index f5a1a73cdc..805542cc8b 100644 --- a/gr-qtgui/grc/qtgui_tab_widget.xml.cmakein +++ b/gr-qtgui/grc/qtgui_tab_widget.xml @@ -7,7 +7,7 @@ QT GUI Tab Widget qtgui_tab_widget - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt #set $win = 'self.%s'%$id Qt.QTabWidget() #set $all_labels = [$label0, $label1, $label2, $label3, $label4, diff --git a/gr-qtgui/grc/qtgui_time_raster_x.xml.cmakein b/gr-qtgui/grc/qtgui_time_raster_x.xml similarity index 99% rename from gr-qtgui/grc/qtgui_time_raster_x.xml.cmakein rename to gr-qtgui/grc/qtgui_time_raster_x.xml index 94b7ef136a..d458f67eb9 100644 --- a/gr-qtgui/grc/qtgui_time_raster_x.xml.cmakein +++ b/gr-qtgui/grc/qtgui_time_raster_x.xml @@ -7,7 +7,7 @@ QT GUI Time Raster Sink qtgui_time_raster_sink_x - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_time_sink_x.xml.cmakein b/gr-qtgui/grc/qtgui_time_sink_x.xml similarity index 99% rename from gr-qtgui/grc/qtgui_time_sink_x.xml.cmakein rename to gr-qtgui/grc/qtgui_time_sink_x.xml index d239917907..d4347950ea 100644 --- a/gr-qtgui/grc/qtgui_time_sink_x.xml.cmakein +++ b/gr-qtgui/grc/qtgui_time_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Time Sink qtgui_time_sink_x - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip diff --git a/gr-qtgui/grc/qtgui_vector_sink_f.xml.cmakein b/gr-qtgui/grc/qtgui_vector_sink_f.xml similarity index 99% rename from gr-qtgui/grc/qtgui_vector_sink_f.xml.cmakein rename to gr-qtgui/grc/qtgui_vector_sink_f.xml index 8b928eb7ea..0f456323bf 100644 --- a/gr-qtgui/grc/qtgui_vector_sink_f.xml.cmakein +++ b/gr-qtgui/grc/qtgui_vector_sink_f.xml @@ -7,7 +7,7 @@ QT GUI Vector Sink qtgui_vector_sink_f - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui import sip #set $win = 'self._%s_win'%$id diff --git a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml.cmakein b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml similarity index 99% rename from gr-qtgui/grc/qtgui_waterfall_sink_x.xml.cmakein rename to gr-qtgui/grc/qtgui_waterfall_sink_x.xml index d198ca084a..a684492246 100644 --- a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml.cmakein +++ b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml @@ -7,7 +7,7 @@ QT GUI Waterfall Sink qtgui_waterfall_sink_x - from PyQt@DESIRED_QT_VERSION@ import Qt + from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip -- 2.11.0 From 1bd3700c2333b86e5374c1bb753270b50e0ecc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20M=C3=BCller?= Date: Wed, 14 Sep 2016 16:48:16 -0600 Subject: [PATCH 15/22] fixed the FindQwt to prefer pkgconfig for qt5-qwt --- cmake/Modules/FindQwt.cmake | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake index 2cffbe66f4..971578fd23 100644 --- a/cmake/Modules/FindQwt.cmake +++ b/cmake/Modules/FindQwt.cmake @@ -5,6 +5,14 @@ # qwt_global.h holds a string with the QWT version; # test to make sure it's at least 5.2 +if (${DESIRED_QT_VERSION} MATCHES 5) + set(QWT_QT_VERSION qt5) + message(STATUS "Looking for Qt5Qwt6") + pkg_check_modules(QWT Qt5Qwt6) + message(STATUS "found ${QWT_FOUND}") +else() + set(QWT_QT_VERSION qt4) + find_path(QWT_INCLUDE_DIRS NAMES qwt_global.h HINTS @@ -36,9 +44,15 @@ find_library (QWT_LIBRARIES /usr/local/lib/qwt.framework ) +endif() set(QWT_FOUND FALSE) if(QWT_INCLUDE_DIRS) - file(STRINGS "${QWT_INCLUDE_DIRS}/qwt_global.h" + find_path(QWT_GLOBAL_DIR + NAMES qwt_global.h + HINTS + ${QWT_INCLUDE_DIRS} + ) + file(STRINGS "${QWT_GLOBAL_DIR}/qwt_global.h" QWT_STRING_VERSION REGEX "QWT_VERSION_STR") set(QWT_WRONG_VERSION True) set(QWT_VERSION "No Version") -- 2.11.0 From 0eaf5c46e85d34ce4c527315141fc5c8a9381acd Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Tue, 20 Sep 2016 06:44:31 -0700 Subject: [PATCH 16/22] Revert "fixed the FindQwt to prefer pkgconfig for qt5-qwt" This reverts commit 222fd4391a39873b5e114f3d30d47608a658b090. --- cmake/Modules/FindQwt.cmake | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake index 971578fd23..2b83fbf2a4 100644 --- a/cmake/Modules/FindQwt.cmake +++ b/cmake/Modules/FindQwt.cmake @@ -7,11 +7,9 @@ if (${DESIRED_QT_VERSION} MATCHES 5) set(QWT_QT_VERSION qt5) - message(STATUS "Looking for Qt5Qwt6") - pkg_check_modules(QWT Qt5Qwt6) - message(STATUS "found ${QWT_FOUND}") else() set(QWT_QT_VERSION qt4) +endif() find_path(QWT_INCLUDE_DIRS NAMES qwt_global.h @@ -44,15 +42,9 @@ find_library (QWT_LIBRARIES /usr/local/lib/qwt.framework ) -endif() set(QWT_FOUND FALSE) if(QWT_INCLUDE_DIRS) - find_path(QWT_GLOBAL_DIR - NAMES qwt_global.h - HINTS - ${QWT_INCLUDE_DIRS} - ) - file(STRINGS "${QWT_GLOBAL_DIR}/qwt_global.h" + file(STRINGS "${QWT_INCLUDE_DIRS}/qwt_global.h" QWT_STRING_VERSION REGEX "QWT_VERSION_STR") set(QWT_WRONG_VERSION True) set(QWT_VERSION "No Version") -- 2.11.0 From ae10f7b4f1ec25fc2e800d42a061603a08c0283b Mon Sep 17 00:00:00 2001 From: Bastian Bloessl Date: Fri, 11 Nov 2016 13:27:55 +0100 Subject: [PATCH 17/22] qtgui: fix stylesheet for qt5 --- gr-qtgui/python/qtgui/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gr-qtgui/python/qtgui/util.py b/gr-qtgui/python/qtgui/util.py index d2e9495ac6..fffc482615 100644 --- a/gr-qtgui/python/qtgui/util.py +++ b/gr-qtgui/python/qtgui/util.py @@ -25,7 +25,7 @@ from PyQt4 import Qt, QtCore, QtGui from gnuradio import gr def check_set_qss(): - app = QtGui.qApp + app = QtWidgets.qApp qssfile = gr.prefs().get_string("qtgui","qss","") if(len(qssfile)>0): try: -- 2.11.0 From 2cf36532281caf6cf7ee54d92b3f22537819e012 Mon Sep 17 00:00:00 2001 From: "A. Maitland Bottoms" Date: Sun, 25 Feb 2018 13:25:55 -0500 Subject: [PATCH 19/22] qtgui fixed apps for Qt5 compatibility --- gr-qtgui/apps/gr_constellation_plot | 12 +-- gr-qtgui/apps/gr_psd_plot_b | 7 +- gr-qtgui/apps/gr_psd_plot_c | 7 +- gr-qtgui/apps/gr_psd_plot_f | 7 +- gr-qtgui/apps/gr_psd_plot_i | 7 +- gr-qtgui/apps/gr_psd_plot_s | 7 +- gr-qtgui/apps/gr_spectrogram_plot | 6 +- gr-qtgui/apps/gr_spectrogram_plot_b | 7 +- gr-qtgui/apps/gr_spectrogram_plot_c | 7 +- gr-qtgui/apps/gr_spectrogram_plot_f | 7 +- gr-qtgui/apps/gr_spectrogram_plot_i | 7 +- gr-qtgui/apps/gr_spectrogram_plot_s | 7 +- gr-qtgui/apps/gr_time_plot_b | 7 +- gr-qtgui/apps/gr_time_plot_c | 7 +- gr-qtgui/apps/gr_time_plot_f | 7 +- gr-qtgui/apps/gr_time_plot_i | 7 +- gr-qtgui/apps/gr_time_plot_s | 7 +- gr-qtgui/apps/gr_time_raster_b | 7 +- gr-qtgui/apps/gr_time_raster_f | 7 +- gr-qtgui/apps/plot_base.py | 8 +- gr-qtgui/apps/plot_constellation_form.py | 16 +-- gr-qtgui/apps/plot_form.py | 160 +++++++++++++--------------- gr-qtgui/apps/plot_psd_base.py | 12 +-- gr-qtgui/apps/plot_psd_form.py | 34 +++--- gr-qtgui/apps/plot_spectrogram_base.py | 12 +-- gr-qtgui/apps/plot_spectrogram_form.py | 67 ++++++------ gr-qtgui/apps/plot_time_base.py | 12 +-- gr-qtgui/apps/plot_time_form.py | 21 ++-- gr-qtgui/apps/plot_time_raster_base.py | 14 +-- gr-qtgui/apps/plot_time_raster_form.py | 60 +++++------ gr-qtgui/apps/qt_digital.py | 58 +++++------ gr-qtgui/apps/qt_digital_window.py | 148 +++++++++++++------------- gr-qtgui/apps/uhd_display.py | 58 +++++------ gr-qtgui/apps/usrp_display_qtgui.py | 172 +++++++++++++++---------------- 34 files changed, 473 insertions(+), 516 deletions(-) diff --git a/gr-qtgui/apps/gr_constellation_plot b/gr-qtgui/apps/gr_constellation_plot index 528bb97e5a..80d02d31ca 100755 --- a/gr-qtgui/apps/gr_constellation_plot +++ b/gr-qtgui/apps/gr_constellation_plot @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -28,16 +28,16 @@ import os, sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: import scipy except ImportError: - print "Error: Scipy required (www.scipy.org)." + sys.stderr.write("Error: Scipy required (www.scipy.org).\n") sys.exit(1) try: @@ -66,7 +66,7 @@ class my_top_block(gr.top_block): self._y_value = 2 self.gui_y_axis = None - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) self.skip = blocks.skiphead(gr.sizeof_gr_complex, self._start) self.gui_snk = qtgui.const_sink_c(self._nsamps, "", self._nsigs) @@ -98,7 +98,7 @@ class my_top_block(gr.top_block): # Get Python Qt references pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + self.pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) def get_gui(self): return self.pyWin diff --git a/gr-qtgui/apps/gr_psd_plot_b b/gr-qtgui/apps/gr_psd_plot_b index 606311af48..70b9eabe38 100755 --- a/gr-qtgui/apps/gr_psd_plot_b +++ b/gr-qtgui/apps/gr_psd_plot_b @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class psd_plot_b(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_psd_plot_c b/gr-qtgui/apps/gr_psd_plot_c index 6df9fae190..7d827ac995 100755 --- a/gr-qtgui/apps/gr_psd_plot_c +++ b/gr-qtgui/apps/gr_psd_plot_c @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -32,10 +32,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class psd_plot_c(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_psd_plot_f b/gr-qtgui/apps/gr_psd_plot_f index f07e3e8b50..abb66f013b 100755 --- a/gr-qtgui/apps/gr_psd_plot_f +++ b/gr-qtgui/apps/gr_psd_plot_f @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -32,10 +32,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.sterr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class psd_plot_f(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_psd_plot_i b/gr-qtgui/apps/gr_psd_plot_i index 1852345823..17d4970ec2 100755 --- a/gr-qtgui/apps/gr_psd_plot_i +++ b/gr-qtgui/apps/gr_psd_plot_i @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class psd_plot_i(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_psd_plot_s b/gr-qtgui/apps/gr_psd_plot_s index c06076f1f9..5f99c70209 100755 --- a/gr-qtgui/apps/gr_psd_plot_s +++ b/gr-qtgui/apps/gr_psd_plot_s @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class psd_plot_s(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_spectrogram_plot b/gr-qtgui/apps/gr_spectrogram_plot index db79f9dbad..5f5b8ba431 100755 --- a/gr-qtgui/apps/gr_spectrogram_plot +++ b/gr-qtgui/apps/gr_spectrogram_plot @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -36,10 +36,10 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class spectrogram_plot_c(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_spectrogram_plot_b b/gr-qtgui/apps/gr_spectrogram_plot_b index 0d7a16ea6e..29feaa33f5 100755 --- a/gr-qtgui/apps/gr_spectrogram_plot_b +++ b/gr-qtgui/apps/gr_spectrogram_plot_b @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class spectrogram_plot_b(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_spectrogram_plot_c b/gr-qtgui/apps/gr_spectrogram_plot_c index 52b0d4dff7..b5a7686da6 100755 --- a/gr-qtgui/apps/gr_spectrogram_plot_c +++ b/gr-qtgui/apps/gr_spectrogram_plot_c @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -32,10 +32,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class spectrogram_plot_c(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_spectrogram_plot_f b/gr-qtgui/apps/gr_spectrogram_plot_f index 6ea5afc4ef..26346945f1 100755 --- a/gr-qtgui/apps/gr_spectrogram_plot_f +++ b/gr-qtgui/apps/gr_spectrogram_plot_f @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -32,10 +32,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class spectrogram_plot_f(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_spectrogram_plot_i b/gr-qtgui/apps/gr_spectrogram_plot_i index 893df2a234..693d961d0d 100755 --- a/gr-qtgui/apps/gr_spectrogram_plot_i +++ b/gr-qtgui/apps/gr_spectrogram_plot_i @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class spectrogram_plot_i(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_spectrogram_plot_s b/gr-qtgui/apps/gr_spectrogram_plot_s index 82a22f740d..270bacbcaf 100755 --- a/gr-qtgui/apps/gr_spectrogram_plot_s +++ b/gr-qtgui/apps/gr_spectrogram_plot_s @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class spectrogram_plot_s(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_time_plot_b b/gr-qtgui/apps/gr_time_plot_b index d822557f1b..ae240561e6 100755 --- a/gr-qtgui/apps/gr_time_plot_b +++ b/gr-qtgui/apps/gr_time_plot_b @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -30,10 +30,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class plot_time_b(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_time_plot_c b/gr-qtgui/apps/gr_time_plot_c index 202e0f88f4..af184304d4 100755 --- a/gr-qtgui/apps/gr_time_plot_c +++ b/gr-qtgui/apps/gr_time_plot_c @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class plot_time_c(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_time_plot_f b/gr-qtgui/apps/gr_time_plot_f index 8f5ad9f60d..e9892ac302 100755 --- a/gr-qtgui/apps/gr_time_plot_f +++ b/gr-qtgui/apps/gr_time_plot_f @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class plot_time_f(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_time_plot_i b/gr-qtgui/apps/gr_time_plot_i index 8a7888b451..be995897c1 100755 --- a/gr-qtgui/apps/gr_time_plot_i +++ b/gr-qtgui/apps/gr_time_plot_i @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -30,10 +30,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class plot_time_i(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_time_plot_s b/gr-qtgui/apps/gr_time_plot_s index 7cee262379..7eff341225 100755 --- a/gr-qtgui/apps/gr_time_plot_s +++ b/gr-qtgui/apps/gr_time_plot_s @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012,2013 Free Software Foundation, Inc. +# Copyright 2012,2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -30,10 +30,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class plot_time_s(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_time_raster_b b/gr-qtgui/apps/gr_time_raster_b index ad8691489c..dc361832e6 100755 --- a/gr-qtgui/apps/gr_time_raster_b +++ b/gr-qtgui/apps/gr_time_raster_b @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class plot_time_raster_b(plot_base.plot_base): diff --git a/gr-qtgui/apps/gr_time_raster_f b/gr-qtgui/apps/gr_time_raster_f index 5d6a8389cf..ccd5a79069 100755 --- a/gr-qtgui/apps/gr_time_raster_f +++ b/gr-qtgui/apps/gr_time_raster_f @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,11 @@ except ImportError: try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class plot_time_raster_f(plot_base.plot_base): diff --git a/gr-qtgui/apps/plot_base.py b/gr-qtgui/apps/plot_base.py index eaab7599c7..a08f460c9c 100644 --- a/gr-qtgui/apps/plot_base.py +++ b/gr-qtgui/apps/plot_base.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -29,16 +29,16 @@ os.environ['GR_CONF_CONTROLPORT_ON'] = 'False' try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: import scipy except ImportError: - print "Error: Scipy required (www.scipy.org)." + sys.stderr.write("Error: Scipy required (www.scipy.org).\n") sys.exit(1) try: diff --git a/gr-qtgui/apps/plot_constellation_form.py b/gr-qtgui/apps/plot_constellation_form.py index 01c6ed1865..dc62e09f13 100644 --- a/gr-qtgui/apps/plot_constellation_form.py +++ b/gr-qtgui/apps/plot_constellation_form.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,10 +24,11 @@ import sys from gnuradio import filter try: - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4." + import sys + sys.stderr.write("Error: Program requires PyQt5.\n") sys.exit(1) try: @@ -39,8 +40,8 @@ class plot_constellation_form(plot_form): def __init__(self, top_block, title='', scale=1): plot_form.__init__(self, top_block, title, scale) - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() + self.right_col_layout = QtWidgets.QVBoxLayout() + self.right_col_form = QtWidgets.QFormLayout() self.right_col_layout.addLayout(self.right_col_form) self.layout.addLayout(self.right_col_layout, 1,4,1,1) @@ -51,12 +52,11 @@ class plot_constellation_form(plot_form): self.ybar.setSingleStep(self._pos_scale*(max(self.top_block._y_range/10, 0.010))) self.ybar.setPageStep(self._pos_scale*(max(self.top_block._y_range/2, 0.010))) - self.auto_scale = QtGui.QCheckBox("Auto Scale", self) + self.auto_scale = QtWidgets.QCheckBox("Auto Scale", self) if(self.top_block._auto_scale): self.auto_scale.setChecked(self.top_block._auto_scale) self.set_auto_scale(self.top_block._auto_scale) - self.connect(self.auto_scale, QtCore.SIGNAL("stateChanged(int)"), - self.set_auto_scale) + self.auto_scale.stateChanged.connect(self.set_auto_scale) self.right_col_layout.addWidget(self.auto_scale) self.ybar.setValue(1000*self.top_block._y_value) diff --git a/gr-qtgui/apps/plot_form.py b/gr-qtgui/apps/plot_form.py index 931565bd3e..39e3e1a928 100644 --- a/gr-qtgui/apps/plot_form.py +++ b/gr-qtgui/apps/plot_form.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,17 +21,18 @@ # try: - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4." + import sys + sys.stderr.write("Error: Program requires PyQt5.\n") sys.exit(1) import numpy -class plot_form(QtGui.QWidget): +class plot_form(QtWidgets.QWidget): def __init__(self, top_block, title='', scale=1): - QtGui.QWidget.__init__(self, None) + QtWidgets.QWidget.__init__(self, None) self._start = 0 self._end = 0 @@ -44,81 +45,73 @@ class plot_form(QtGui.QWidget): self.setWindowTitle(title) - self.layout = QtGui.QGridLayout(self) + self.layout = QtWidgets.QGridLayout(self) self.layout.addWidget(top_block.get_gui(), 1,2,1,2) # Create a save action - self.save_act = QtGui.QAction("Save", self) - self.save_act.setShortcut(QtGui.QKeySequence.Save) - self.connect(self.save_act, QtCore.SIGNAL("triggered()"), - self.save_figure) + self.save_act = QtWidgets.QAction("Save", self) + self.save_act.setShortcut(QtWidgets.QKeySequence.Save) + self.save_act.triggered.connect(self.save_figure) # Create an exit action - self.exit_act = QtGui.QAction("Exit", self) - self.exit_act.setShortcut(QtGui.QKeySequence.Close) - self.connect(self.exit_act, QtCore.SIGNAL("triggered()"), - self.close) + self.exit_act = QtWidgets.QAction("Exit", self) + self.exit_act.setShortcut(QtWidgets.QKeySequence.Close) + self.exit_act.triggered.connect(self.close) # Create a menu for the window - self.menu = QtGui.QToolBar("Menu", self) + self.menu = QtWidgets.QToolBar("Menu", self) self.menu.addAction(self.save_act) self.menu.addAction(self.exit_act) self.layout.addWidget(self.menu, 0,0,1,4) - self.left_col_form = QtGui.QFormLayout() + self.left_col_form = QtWidgets.QFormLayout() self.layout.addLayout(self.left_col_form, 1,0,1,1) self.layout.setColumnStretch(0, 0) self.layout.setColumnStretch(2, 1) # Create Edit boxes for X-axis start/stop - self.size_val = QtGui.QIntValidator(0, top_block._max_nsamps, self) + self.size_val = QtWidgets.QIntValidator(0, top_block._max_nsamps, self) - self.start_edit = QtGui.QLineEdit(self) + self.start_edit = QtWidgets.QLineEdit(self) self.start_edit.setMinimumWidth(100) self.start_edit.setMaximumWidth(100) - self.start_edit.setText(QtCore.QString("%1").arg(top_block._start)) + self.start_edit.setText("{0}".format(top_block._start)) self.start_edit.setValidator(self.size_val) self.left_col_form.addRow("Start:", self.start_edit) - self.connect(self.start_edit, QtCore.SIGNAL("returnPressed()"), - self.update_xaxis_pos) + self.start_edit.returnPressed.connect(self.update_xaxis_pos) end = top_block._start + top_block._nsamps - self.end_edit = QtGui.QLineEdit(self) + self.end_edit = QtWidgets.QLineEdit(self) self.end_edit.setMinimumWidth(100) self.end_edit.setMaximumWidth(100) - self.end_edit.setText(QtCore.QString("%1").arg(end)) + self.end_edit.setText("{0}".format(end)) self.end_edit.setValidator(self.size_val) self.left_col_form.addRow("End:", self.end_edit) - self.connect(self.end_edit, QtCore.SIGNAL("returnPressed()"), - self.update_xaxis_pos) + self.end_edit.returnPressed.connect(self.update_xaxis_pos) # Create a slider to move the position in the file - self.posbar = QtGui.QSlider(QtCore.Qt.Horizontal, self) + self.posbar = QtWidgets.QSlider(Qt.Qt.Horizontal, self) self.posbar.setMaximum(self.top_block._max_nsamps) self.posbar.setPageStep(self.top_block._nsamps) - self.connect(self.posbar, QtCore.SIGNAL("valueChanged(int)"), - self.update_xaxis_slider) + self.posbar.valueChanged.connect(self.update_xaxis_slider) self.layout.addWidget(self.posbar, 2,2,1,1) # Create Edit boxes for Y-axis min/max - self.y_max_edit = QtGui.QLineEdit(self) + self.y_max_edit = QtWidgets.QLineEdit(self) self.y_max_edit.setMinimumWidth(100) self.y_max_edit.setMaximumWidth(100) self.left_col_form.addRow("Y Max:", self.y_max_edit) - self.connect(self.y_max_edit, QtCore.SIGNAL("editingFinished()"), - self.update_yaxis_pos) + self.y_max_edit.editingFinished.connect(self.update_yaxis_pos) - self.y_min_edit = QtGui.QLineEdit(self) + self.y_min_edit = QtWidgets.QLineEdit(self) self.y_min_edit.setMinimumWidth(100) self.y_min_edit.setMaximumWidth(100) self.left_col_form.addRow("Y Min:", self.y_min_edit) - self.connect(self.y_min_edit, QtCore.SIGNAL("editingFinished()"), - self.update_yaxis_pos) + self.y_min_edit.editingFinished.connect(self.update_yaxis_pos) - self.grid_check = QtGui.QCheckBox("Grid", self) - self.connect(self.grid_check, QtCore.SIGNAL("stateChanged(int)"), - self.set_grid_check) + self.grid_check = QtWidgets.QCheckBox("Grid", self) + self.grid_check.stateChanged.connect(self.set_grid_check) self.left_col_form.addWidget(self.grid_check) # Create a slider to move the plot's y-axis offset @@ -126,42 +119,39 @@ class plot_form(QtGui.QWidget): _ymin = numpy.int32(max(numpy.iinfo(numpy.int32).min, self.top_block._y_min)) _yrng = numpy.int32(min(numpy.iinfo(numpy.int32).max, self.top_block._y_range)) _yval = numpy.int32(min(numpy.iinfo(numpy.int32).max, self.top_block._y_value)) - self.ybar = QtGui.QSlider(QtCore.Qt.Vertical, self) + self.ybar = QtWidgets.QSlider(Qt.Qt.Vertical, self) self.ybar.setMinimum(self._pos_scale*_ymin) self.ybar.setMaximum(self._pos_scale*_ymax) self.ybar.setSingleStep(self._pos_scale*(_yrng/10)) self.ybar.setPageStep(self._pos_scale*(_yrng/2)) self.ybar.setValue(self._pos_scale*_ymax) - self.connect(self.ybar, QtCore.SIGNAL("valueChanged(int)"), - self.update_yaxis_slider) + self.ybar.valueChanged.connect(self.update_yaxis_slider) self.layout.addWidget(self.ybar, 1,1,1,1) self.gui_y_axis(top_block._y_value-top_block._y_range, top_block._y_value) # Create an edit box for the Sample Rate sr = top_block._samp_rate - self.samp_rate_edit = QtGui.QLineEdit(self) + self.samp_rate_edit = QtWidgets.QLineEdit(self) self.samp_rate_edit.setMinimumWidth(100) self.samp_rate_edit.setMaximumWidth(100) - self.samp_rate_edit.setText(QtCore.QString("%1").arg(sr)) + self.samp_rate_edit.setText("{0}".format(sr)) self.left_col_form.addRow("Sample Rate:", self.samp_rate_edit) - self.connect(self.samp_rate_edit, QtCore.SIGNAL("returnPressed()"), - self.update_samp_rate) + self.samp_rate_edit.returnPressed.connect(self.update_samp_rate) # Create an edit box for the center frequency freq = top_block._center_freq - self.freq_edit = QtGui.QLineEdit(self) + self.freq_edit = QtWidgets.QLineEdit(self) self.freq_edit.setMinimumWidth(100) self.freq_edit.setMaximumWidth(100) - self.freq_edit.setText(QtCore.QString("%1").arg(freq)) + self.freq_edit.setText("{0}".format(freq)) self.left_col_form.addRow("Frequency:", self.freq_edit) - self.connect(self.freq_edit, QtCore.SIGNAL("returnPressed()"), - self.update_samp_rate) + self.freq_edit.returnPressed.connect(self.update_samp_rate) self.resize(1000, 500) def add_line_control(self, layout): - self._line_tabs = QtGui.QTabWidget() + self._line_tabs = QtWidgets.QTabWidget() self._line_pages = [] self._line_forms = [] @@ -172,51 +162,46 @@ class plot_form(QtGui.QWidget): self._marker_edit = [] self._alpha_edit = [] for n in xrange(self.top_block._nsigs): - self._line_pages.append(QtGui.QDialog()) - self._line_forms.append(QtGui.QFormLayout(self._line_pages[-1])) + self._line_pages.append(QtWidgets.QDialog()) + self._line_forms.append(QtWidgets.QFormLayout(self._line_pages[-1])) label = self.top_block.gui_snk.line_label(n) - self._label_edit.append(QtGui.QLineEdit(self)) + self._label_edit.append(QtWidgets.QLineEdit(self)) self._label_edit[-1].setMinimumWidth(125) self._label_edit[-1].setMaximumWidth(125) - self._label_edit[-1].setText(QtCore.QString("%1").arg(label)) + self._label_edit[-1].setText("{0}".format(label)) self._line_forms[-1].addRow("Label:", self._label_edit[-1]) - self.connect(self._label_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_label) + self._label_edit[-1].returnPressed.connect(self.update_line_label) - width_val = QtGui.QIntValidator(1, 20, self) - self._size_edit.append(QtGui.QLineEdit(self)) + width_val = QtWidgets.QIntValidator(1, 20, self) + self._size_edit.append(QtWidgets.QLineEdit(self)) self._size_edit[-1].setValidator(width_val) self._size_edit[-1].setMinimumWidth(100) self._size_edit[-1].setMaximumWidth(100) - self._size_edit[-1].setText(QtCore.QString("%1").arg(1)) + self._size_edit[-1].setText("{0}".format(1)) self._line_forms[-1].addRow("Width:", self._size_edit[-1]) - self.connect(self._size_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_size) + self._size_edit[-1].returnPressed.connect(self.update_line_size) color = self.top_block.gui_snk.line_color(n) - self._color_edit.append(QtGui.QLineEdit(self)) + self._color_edit.append(QtWidgets.QLineEdit(self)) self._color_edit[-1].setMinimumWidth(100) self._color_edit[-1].setMaximumWidth(100) - self._color_edit[-1].setText(QtCore.QString("%1").arg(color)) + self._color_edit[-1].setText("{0}".format(color)) self._line_forms[-1].addRow("Color:", self._color_edit[-1]) - self.connect(self._color_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_color) - - self._qtstyles = {"None": QtCore.Qt.NoPen, - "Solid": QtCore.Qt.SolidLine, - "Dash": QtCore.Qt.DashLine, - "Dot": QtCore.Qt.DotLine, - "DashDot": QtCore.Qt.DashDotLine, - "DashDotDot": QtCore.Qt.DashDotDotLine} - self._style_edit.append(QtGui.QComboBox(self)) + self._color_edit[-1].returnPressed.connect(self.update_line_color) + + self._qtstyles = {"None": Qt.Qt.NoPen, + "Solid": Qt.Qt.SolidLine, + "Dash": Qt.Qt.DashLine, + "Dot": Qt.Qt.DotLine, + "DashDot": Qt.Qt.DashDotLine, + "DashDotDot": Qt.Qt.DashDotDotLine} + self._style_edit.append(QtWidgets.QComboBox(self)) self._style_edit[-1].addItems(["None", "Solid", "Dash", "Dot", "DashDot", "DashDotDot"]) self._style_edit[-1].setCurrentIndex(1) self._line_forms[-1].addRow("Style:", self._style_edit[-1]) - self.connect(self._style_edit[-1], - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_line_style) + self._style_edit[-1].currentIndexChanged.connect(self.update_line_style) # A bit dangerous, this. If QWT ever changes the lineup, # we will have to adjust this, too. But we also can't @@ -236,28 +221,25 @@ class plot_form(QtGui.QWidget): "Star 1": 12, "Star 2": 13, "Hexagon": 14} - self._marker_edit.append(QtGui.QComboBox(self)) + self._marker_edit.append(QtWidgets.QComboBox(self)) self._marker_edit[-1].addItems(["None", "Circle", "Rectangle", "Diamond", "Triangle", "Down Triangle", "Left Triangle", "Right Triangle", "Cross", "X-Cross", "Horiz. Line", "Vert. Line", "Star 1", "Star 2", "Hexagon"]) self._line_forms[-1].addRow("Marker:", self._marker_edit[-1]) - self.connect(self._marker_edit[-1], - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_line_marker) + self._marker_edit[-1].currentIndexChanged.connect(self.update_line_marker) - alpha_val = QtGui.QDoubleValidator(0, 1.0, 2, self) + alpha_val = QtWidgets.QDoubleValidator(0, 1.0, 2, self) alpha_val.setTop(1.0) alpha = self.top_block.gui_snk.line_alpha(n) - self._alpha_edit.append(QtGui.QLineEdit(self)) + self._alpha_edit.append(QtWidgets.QLineEdit(self)) self._alpha_edit[-1].setMinimumWidth(50) self._alpha_edit[-1].setMaximumWidth(100) - self._alpha_edit[-1].setText(QtCore.QString("%1").arg(alpha)) + self._alpha_edit[-1].setText("{0]".format(alpha)) self._alpha_edit[-1].setValidator(alpha_val) self._line_forms[-1].addRow("Alpha:", self._alpha_edit[-1]) - self.connect(self._alpha_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_alpha) + self._alpha_edit[-1].returnPressed.connect(self.update_line_alpha) self._line_tabs.addTab(self._line_pages[-1], "{0}".format(label)) @@ -303,10 +285,10 @@ class plot_form(QtGui.QWidget): newend = self.end_edit.text().toUInt()[0] if(newstart != self._start or newend != self._end): if(newend < newstart): - QtGui.QMessageBox.information( + QtWidgets.QMessageBox.information( self, "Warning", "End sample is less than start sample.", - QtGui.QMessageBox.Ok); + QtWidgets.QMessageBox.Ok); else: newnsamps = newend - newstart self.top_block.reset(newstart, newnsamps) @@ -377,13 +359,13 @@ class plot_form(QtGui.QWidget): self.top_block.gui_snk.enable_grid(False) def save_figure(self): - qpix = QtGui.QPixmap.grabWidget(self.top_block.pyWin) + qpix = QtWidgets.QPixmap.grabWidget(self.top_block.pyWin) types = "JPEG file (*.jpg);;" + \ "Portable Network Graphics file (*.png);;" + \ "Bitmap file (*.bmp);;" + \ "TIFF file (*.tiff)" - filebox = QtGui.QFileDialog(self, "Save Image", "./", types) - filebox.setViewMode(QtGui.QFileDialog.Detail) + filebox = QtWidgets.QFileDialog(self, "Save Image", "./", types) + filebox.setViewMode(QtWidgets.QFileDialog.Detail) if(filebox.exec_()): filename = filebox.selectedFiles()[0] filetype = filebox.selectedNameFilter() diff --git a/gr-qtgui/apps/plot_psd_base.py b/gr-qtgui/apps/plot_psd_base.py index 46f903e1b5..bf070f2c1c 100644 --- a/gr-qtgui/apps/plot_psd_base.py +++ b/gr-qtgui/apps/plot_psd_base.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -27,16 +27,16 @@ import os, sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: import scipy except ImportError: - print "Error: Scipy required (www.scipy.org)." + sys.stderr.write("Error: Scipy required (www.scipy.org).\n") sys.exit(1) try: @@ -69,7 +69,7 @@ class plot_base(gr.top_block): self._is_setup = False - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) def setup(self): self.skip = blocks.skiphead(self.dsize, self._start) @@ -104,7 +104,7 @@ class plot_base(gr.top_block): # Get Python Qt references pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + self.pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) self._is_setup = True diff --git a/gr-qtgui/apps/plot_psd_form.py b/gr-qtgui/apps/plot_psd_form.py index 2d1fcd10bc..3109fb2b0c 100644 --- a/gr-qtgui/apps/plot_psd_form.py +++ b/gr-qtgui/apps/plot_psd_form.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,10 +24,10 @@ import sys from gnuradio import filter try: - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -39,39 +39,35 @@ class plot_psd_form(plot_form): def __init__(self, top_block, title=''): plot_form.__init__(self, top_block, title) - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() + self.right_col_layout = QtWidgets.QVBoxLayout() + self.right_col_form = QtWidgets.QFormLayout() self.right_col_layout.addLayout(self.right_col_form) self.layout.addLayout(self.right_col_layout, 1,4,1,1) - self.psd_size_val = QtGui.QIntValidator(0, 2**18, self) - self.psd_size_edit = QtGui.QLineEdit(self) + self.psd_size_val = QtWidgets.QIntValidator(0, 2**18, self) + self.psd_size_edit = QtWidgets.QLineEdit(self) self.psd_size_edit.setMinimumWidth(50) self.psd_size_edit.setMaximumWidth(100) - self.psd_size_edit.setText(QtCore.QString("%1").arg(top_block._psd_size)) + self.psd_size_edit.setText("{0}".format(top_block._psd_size)) self.psd_size_edit.setValidator(self.psd_size_val) self.right_col_form.addRow("FFT:", self.psd_size_edit) - self.connect(self.psd_size_edit, QtCore.SIGNAL("returnPressed()"), - self.update_psd_size) + self.psd_size_edit.returnPressed.connect(self.update_psd_size) - self.psd_win_combo = QtGui.QComboBox(self) + self.psd_win_combo = QtWidgets.QComboBox(self) self.psd_win_combo.addItems(["None", "Hamming", "Hann", "Blackman", "Rectangular", "Kaiser", "Blackman-harris"]) self.psd_win_combo.setCurrentIndex(self.top_block.gui_snk.fft_window()+1) self.right_col_form.addRow("Window:", self.psd_win_combo) - self.connect(self.psd_win_combo, - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_psd_win) + self.psd_win_combo.currentIndexChanged.connect(self.update_psd_win) - self.psd_avg_val = QtGui.QDoubleValidator(0, 1.0, 4, self) - self.psd_avg_edit = QtGui.QLineEdit(self) + self.psd_avg_val = QtWidgets.QDoubleValidator(0, 1.0, 4, self) + self.psd_avg_edit = QtWidgets.QLineEdit(self) self.psd_avg_edit.setMinimumWidth(50) self.psd_avg_edit.setMaximumWidth(100) - self.psd_avg_edit.setText(QtCore.QString("%1").arg(top_block._avg)) + self.psd_avg_edit.setText("{0}".format(top_block._avg)) self.psd_avg_edit.setValidator(self.psd_avg_val) self.right_col_form.addRow("Average:", self.psd_avg_edit) - self.connect(self.psd_avg_edit, QtCore.SIGNAL("returnPressed()"), - self.update_psd_avg) + self.psd_avg_edit.returnPressed.connect(self.update_psd_avg) self.add_line_control(self.right_col_layout) diff --git a/gr-qtgui/apps/plot_spectrogram_base.py b/gr-qtgui/apps/plot_spectrogram_base.py index b252bb8863..295ef4a753 100644 --- a/gr-qtgui/apps/plot_spectrogram_base.py +++ b/gr-qtgui/apps/plot_spectrogram_base.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -27,16 +27,16 @@ import os, sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: import scipy except ImportError: - print "Error: Scipy required (www.scipy.org)." + sys.stderr.write("Error: Scipy required (www.scipy.org).\n") sys.exit(1) try: @@ -69,7 +69,7 @@ class plot_base(gr.top_block): self._is_setup = False - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) def setup(self): self.skip = blocks.skiphead(self.dsize, self._start) @@ -106,7 +106,7 @@ class plot_base(gr.top_block): # Get Python Qt references pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + self.pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) self._is_setup = True diff --git a/gr-qtgui/apps/plot_spectrogram_form.py b/gr-qtgui/apps/plot_spectrogram_form.py index 17cb0335bd..ab4685106d 100644 --- a/gr-qtgui/apps/plot_spectrogram_form.py +++ b/gr-qtgui/apps/plot_spectrogram_form.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,10 +24,10 @@ import sys from gnuradio import filter try: - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4." + sys.stderr.write("Error: Program requires PyQt5.\n") sys.exit(1) try: @@ -39,45 +39,40 @@ class plot_spectrogram_form(plot_form): def __init__(self, top_block, title=''): plot_form.__init__(self, top_block, title) - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() + self.right_col_layout = QtWidgets.QVBoxLayout() + self.right_col_form = QtWidgets.QFormLayout() self.right_col_layout.addLayout(self.right_col_form) self.layout.addLayout(self.right_col_layout, 1,4,1,1) - self.psd_size_val = QtGui.QIntValidator(0, 2**18, self) - self.psd_size_edit = QtGui.QLineEdit(self) + self.psd_size_val = QtWidgets.QIntValidator(0, 2**18, self) + self.psd_size_edit = QtWidgets.QLineEdit(self) self.psd_size_edit.setMinimumWidth(50) self.psd_size_edit.setMaximumWidth(100) - self.psd_size_edit.setText(QtCore.QString("%1").arg(top_block._psd_size)) + self.psd_size_edit.setText("{0}".format(top_block._psd_size)) self.psd_size_edit.setValidator(self.psd_size_val) self.right_col_form.addRow("FFT Size:", self.psd_size_edit) - self.connect(self.psd_size_edit, QtCore.SIGNAL("returnPressed()"), - self.update_psd_size) + self.psd_size_edit.returnPressed.connect(self.update_psd_size) - self.psd_win_combo = QtGui.QComboBox(self) + self.psd_win_combo = QtWidgets.QComboBox(self) self.psd_win_combo.addItems(["None", "Hamming", "Hann", "Blackman", "Rectangular", "Kaiser", "Blackman-harris"]) self.psd_win_combo.setCurrentIndex(self.top_block.gui_snk.fft_window()+1) self.right_col_form.addRow("Window:", self.psd_win_combo) - self.connect(self.psd_win_combo, - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_psd_win) + self.psd_win_combo.currentIndexChanged.connect(self.update_psd_win) - self.psd_avg_val = QtGui.QDoubleValidator(0, 1.0, 4, self) - self.psd_avg_edit = QtGui.QLineEdit(self) + self.psd_avg_val = QtWidgets.QDoubleValidator(0, 1.0, 4, self) + self.psd_avg_edit = QtWidgets.QLineEdit(self) self.psd_avg_edit.setMinimumWidth(50) self.psd_avg_edit.setMaximumWidth(100) - self.psd_avg_edit.setText(QtCore.QString("%1").arg(top_block._avg)) + self.psd_avg_edit.setText("{0}".format(top_block._avg)) self.psd_avg_edit.setValidator(self.psd_avg_val) self.right_col_form.addRow("Average:", self.psd_avg_edit) - self.connect(self.psd_avg_edit, QtCore.SIGNAL("returnPressed()"), - self.update_psd_avg) + self.psd_avg_edit.returnPressed.connect(self.update_psd_avg) - self.autoscale_button = QtGui.QPushButton("Auto Scale", self) + self.autoscale_button = QtWidgets.QPushButton("Auto Scale", self) self.autoscale_button.setMaximumWidth(100) self.right_col_layout.addWidget(self.autoscale_button) - self.connect(self.autoscale_button, QtCore.SIGNAL("clicked()"), - self.spectrogram_auto_scale) + self.autoscale_button.clicked.connect(self.spectrogram_auto_scale) self.add_spectrogram_control(self.right_col_layout) @@ -103,7 +98,7 @@ class plot_spectrogram_form(plot_form): self.top_block._nsamps) def add_spectrogram_control(self, layout): - self._line_tabs = QtGui.QTabWidget() + self._line_tabs = QtWidgets.QTabWidget() self._line_pages = [] self._line_forms = [] @@ -114,38 +109,34 @@ class plot_spectrogram_form(plot_form): self._marker_edit = [] self._alpha_edit = [] for n in xrange(self.top_block._nsigs): - self._line_pages.append(QtGui.QDialog()) - self._line_forms.append(QtGui.QFormLayout(self._line_pages[-1])) + self._line_pages.append(QtWidgets.QDialog()) + self._line_forms.append(QtWidgets.QFormLayout(self._line_pages[-1])) label = self.top_block.gui_snk.line_label(n) - self._label_edit.append(QtGui.QLineEdit(self)) + self._label_edit.append(QtWidgets.QLineEdit(self)) self._label_edit[-1].setMinimumWidth(125) self._label_edit[-1].setMaximumWidth(125) - self._label_edit[-1].setText(QtCore.QString("%1").arg(label)) + self._label_edit[-1].setText("{0}".format(label)) self._line_forms[-1].addRow("Label:", self._label_edit[-1]) - self.connect(self._label_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_label) + self._label_edit[-1].returnPressed.connect(self.update_line_label) self._qtcolormaps = ["Multi Color", "White Hot", "Black Hot", "Incandescent"] - self._color_edit.append(QtGui.QComboBox(self)) + self._color_edit.append(QtWidgets.QComboBox(self)) self._color_edit[-1].addItems(self._qtcolormaps) self._line_forms[-1].addRow("Color Map:", self._color_edit[-1]) - self.connect(self._color_edit[-1], - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_color_map) + self._color_edit[-1].currentIndexChanged.connect(self.update_color_map) - alpha_val = QtGui.QDoubleValidator(0, 1.0, 2, self) + alpha_val = QtWidgets.QDoubleValidator(0, 1.0, 2, self) alpha_val.setTop(1.0) alpha = self.top_block.gui_snk.line_alpha(n) - self._alpha_edit.append(QtGui.QLineEdit(self)) + self._alpha_edit.append(QtWidgets.QLineEdit(self)) self._alpha_edit[-1].setMinimumWidth(50) self._alpha_edit[-1].setMaximumWidth(100) - self._alpha_edit[-1].setText(QtCore.QString("%1").arg(alpha)) + self._alpha_edit[-1].setText("{0}".format(alpha)) self._alpha_edit[-1].setValidator(alpha_val) self._line_forms[-1].addRow("Alpha:", self._alpha_edit[-1]) - self.connect(self._alpha_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_alpha) + self._alpha_edit[-1].returnPressed.connect(self.update_line_alpha) self._line_tabs.addTab(self._line_pages[-1], "{0}".format(label)) diff --git a/gr-qtgui/apps/plot_time_base.py b/gr-qtgui/apps/plot_time_base.py index 007c94d044..82e7d75cae 100644 --- a/gr-qtgui/apps/plot_time_base.py +++ b/gr-qtgui/apps/plot_time_base.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -27,16 +27,16 @@ import os, sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: import scipy except ImportError: - print "Error: Scipy required (www.scipy.org)." + sys.stderr.write("Error: Scipy required (www.scipy.org).\n") sys.exit(1) try: @@ -68,7 +68,7 @@ class plot_base(gr.top_block): self._y_value = 1 self.gui_y_axis = None - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) def setup(self): self.skip = blocks.skiphead(self.dsize, self._start) @@ -108,7 +108,7 @@ class plot_base(gr.top_block): # Get Python Qt references pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + self.pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) self._is_setup = True diff --git a/gr-qtgui/apps/plot_time_form.py b/gr-qtgui/apps/plot_time_form.py index 0ab94e6cfe..0e650813ff 100644 --- a/gr-qtgui/apps/plot_time_form.py +++ b/gr-qtgui/apps/plot_time_form.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,10 +24,10 @@ import sys from gnuradio import filter try: - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4." + sys.stderr.write("Error: Program requires PyQt5.\n") sys.exit(1) try: @@ -39,21 +39,19 @@ class plot_time_form(plot_form): def __init__(self, top_block, title='', scale=1): plot_form.__init__(self, top_block, title, scale) - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() + self.right_col_layout = QtWidgets.QVBoxLayout() + self.right_col_form = QtWidgets.QFormLayout() self.right_col_layout.addLayout(self.right_col_form) self.layout.addLayout(self.right_col_layout, 1,4,1,1) - self.auto_scale = QtGui.QCheckBox("Auto Scale", self) + self.auto_scale = QtWidgets.QCheckBox("Auto Scale", self) if(self.top_block._auto_scale): self.auto_scale.setChecked(self.top_block._auto_scale) - self.connect(self.auto_scale, QtCore.SIGNAL("stateChanged(int)"), - self.set_auto_scale) + self.auto_scale.stateChanged.connect(self.set_auto_scale) self.right_col_layout.addWidget(self.auto_scale) - self.stem = QtGui.QCheckBox("Stem", self) - self.connect(self.stem, QtCore.SIGNAL("stateChanged(int)"), - self.enable_stem) + self.stem = QtWidgets.QCheckBox("Stem", self) + self.stem.stateChanged.connect(self.enable_stem) self.right_col_layout.addWidget(self.stem) self.add_line_control(self.right_col_layout) @@ -76,4 +74,3 @@ class plot_time_form(plot_form): def update_samp_rate(self): sr = self.samp_rate_edit.text().toDouble()[0] self.top_block.gui_snk.set_samp_rate(sr) - diff --git a/gr-qtgui/apps/plot_time_raster_base.py b/gr-qtgui/apps/plot_time_raster_base.py index 856c8c8945..f1d4db8523 100644 --- a/gr-qtgui/apps/plot_time_raster_base.py +++ b/gr-qtgui/apps/plot_time_raster_base.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -27,16 +27,18 @@ import os, sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + import sys + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: import scipy except ImportError: - print "Error: Scipy required (www.scipy.org)." + import sys + sys.stderr.write("Error: Scipy required (www.scipy.org).\n") sys.exit(1) try: @@ -68,7 +70,7 @@ class plot_base(gr.top_block): self._y_value = 1 self.gui_y_axis = None - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) def setup(self): self.skip = blocks.skiphead(self.dsize, self._start) @@ -103,7 +105,7 @@ class plot_base(gr.top_block): # Get Python Qt references pyQt = self.gui_snk.pyqwidget() - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + self.pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget) self._is_setup = True diff --git a/gr-qtgui/apps/plot_time_raster_form.py b/gr-qtgui/apps/plot_time_raster_form.py index 32fbba0765..ffd2975042 100644 --- a/gr-qtgui/apps/plot_time_raster_form.py +++ b/gr-qtgui/apps/plot_time_raster_form.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Free Software Foundation, Inc. +# Copyright 2013,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,10 +24,10 @@ import sys, math from gnuradio import filter try: - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -39,39 +39,35 @@ class plot_time_raster_form(plot_form): def __init__(self, top_block, title='', scale=1): plot_form.__init__(self, top_block, title, scale) - self.right_col_layout = QtGui.QVBoxLayout() - self.right_col_form = QtGui.QFormLayout() + self.right_col_layout = QtWidgets.QVBoxLayout() + self.right_col_form = QtWidgets.QFormLayout() self.right_col_layout.addLayout(self.right_col_form) self.layout.addLayout(self.right_col_layout, 1,4,1,1) - self.auto_scale = QtGui.QCheckBox("Auto Scale", self) + self.auto_scale = QtWidgets.QCheckBox("Auto Scale", self) if(self.top_block._auto_scale): self.auto_scale.setChecked(self.top_block._auto_scale) - self.connect(self.auto_scale, QtCore.SIGNAL("stateChanged(int)"), - self.set_auto_scale) + self.auto_scale.stateChanged.connect(self.set_auto_scale) self.right_col_layout.addWidget(self.auto_scale) - self.ncols_edit = QtGui.QLineEdit(self) + self.ncols_edit = QtWidgets.QLineEdit(self) self.ncols_edit.setMinimumWidth(100) self.ncols_edit.setMaximumWidth(100) - self.ncols_edit.setText(QtCore.QString("%1").arg(top_block._ncols)) + self.ncols_edit.setText("{0}".format(top_block._ncols)) self.right_col_form.addRow("Num. Cols.", self.ncols_edit) - self.connect(self.ncols_edit, QtCore.SIGNAL("returnPressed()"), - self.ncols_update) + self.ncols_edit.returnPressed.connect(self.ncols_update) - self.nrows_edit = QtGui.QLineEdit(self) + self.nrows_edit = QtWidgets.QLineEdit(self) self.nrows_edit.setMinimumWidth(100) self.nrows_edit.setMaximumWidth(100) - self.nrows_edit.setText(QtCore.QString("%1").arg(top_block._nrows)) + self.nrows_edit.setText("{0}".format(top_block._nrows)) self.right_col_form.addRow("Num. Rows.", self.nrows_edit) - self.connect(self.nrows_edit, QtCore.SIGNAL("returnPressed()"), - self.nrows_update) - + self.nrows_edit.returnPressed.connect(self.nrows_update) self.add_raster_control(self.right_col_layout) def add_raster_control(self, layout): - self._line_tabs = QtGui.QTabWidget() + self._line_tabs = QtWidgets.QTabWidget() self._line_pages = [] self._line_forms = [] @@ -82,39 +78,35 @@ class plot_time_raster_form(plot_form): self._marker_edit = [] self._alpha_edit = [] for n in xrange(self.top_block._nsigs): - self._line_pages.append(QtGui.QDialog()) - self._line_forms.append(QtGui.QFormLayout(self._line_pages[-1])) + self._line_pages.append(QtWidgets.QDialog()) + self._line_forms.append(QtWidgets.QFormLayout(self._line_pages[-1])) label = self.top_block.gui_snk.line_label(n) - self._label_edit.append(QtGui.QLineEdit(self)) + self._label_edit.append(QtWidgets.QLineEdit(self)) self._label_edit[-1].setMinimumWidth(125) self._label_edit[-1].setMaximumWidth(125) - self._label_edit[-1].setText(QtCore.QString("%1").arg(label)) + self._label_edit[-1].setText("{0}".format(label)) self._line_forms[-1].addRow("Label:", self._label_edit[-1]) - self.connect(self._label_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_label) + self._label_edit[-1].returnPressed.connect(self.update_line_label) self._qtcolormaps = ["Multi Color", "White Hot", "Black Hot", "Incandescent"] - self._color_edit.append(QtGui.QComboBox(self)) + self._color_edit.append(QtWidgets.QComboBox(self)) self._color_edit[-1].addItems(self._qtcolormaps) self._color_edit[-1].setCurrentIndex(1) self._line_forms[-1].addRow("Color Map:", self._color_edit[-1]) - self.connect(self._color_edit[-1], - QtCore.SIGNAL("currentIndexChanged(int)"), - self.update_color_map) + self._color_edit[-1].currentIndexChanged.connect(self.update_color_map) - alpha_val = QtGui.QDoubleValidator(0, 1.0, 2, self) + alpha_val = QtWidgets.QDoubleValidator(0, 1.0, 2, self) alpha_val.setTop(1.0) alpha = self.top_block.gui_snk.line_alpha(n) - self._alpha_edit.append(QtGui.QLineEdit(self)) + self._alpha_edit.append(QtWidgets.QLineEdit(self)) self._alpha_edit[-1].setMinimumWidth(50) self._alpha_edit[-1].setMaximumWidth(100) - self._alpha_edit[-1].setText(QtCore.QString("%1").arg(alpha)) + self._alpha_edit[-1].setText("{0}".format(alpha)) self._alpha_edit[-1].setValidator(alpha_val) self._line_forms[-1].addRow("Alpha:", self._alpha_edit[-1]) - self.connect(self._alpha_edit[-1], QtCore.SIGNAL("returnPressed()"), - self.update_line_alpha) + self._alpha_edit[-1].returnPressed.connect(self.update_line_alpha) self._line_tabs.addTab(self._line_pages[-1], "{0}".format(label)) @@ -153,5 +145,3 @@ class plot_time_raster_form(plot_form): nsamps = int(math.ceil(self.top_block._ncols*(n+1))) self.top_block.reset(self._start, nsamps) - - diff --git a/gr-qtgui/apps/qt_digital.py b/gr-qtgui/apps/qt_digital.py index fef4f448b4..fbaeacd462 100755 --- a/gr-qtgui/apps/qt_digital.py +++ b/gr-qtgui/apps/qt_digital.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -29,28 +29,28 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: import scipy except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." + sys.stderr.write("Error: Program requires scipy (see: www.scipy.org).\n") sys.exit(1) try: from qt_digital_window import Ui_DigitalWindow except ImportError: - print "Error: could not find qt_digital_window.py:" - print "\t\"Please run: pyuic4 qt_digital_window.ui -o qt_digital_window.py\"" + sys.stderr.write("Error: could not find qt_digital_window.py:\n") + sys.stderr.write("\t\"Please run: pyuic5 qt_digital_window.ui -o qt_digital_window.py\"\n") sys.exit(1) -class dialog_box(QtGui.QMainWindow): +class dialog_box(QtWidgets.QMainWindow): def __init__(self, snkTx, snkRx, fg, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.gui = Ui_DigitalWindow() self.gui.setupUi(self) @@ -71,23 +71,13 @@ class dialog_box(QtGui.QMainWindow): # Connect up some signals - self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), - self.pauseFg) - - self.connect(self.gui.sampleRateEdit, QtCore.SIGNAL("editingFinished()"), - self.sampleRateEditText) - - self.connect(self.gui.snrEdit, QtCore.SIGNAL("editingFinished()"), - self.snrEditText) - self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"), - self.freqEditText) - self.connect(self.gui.timeEdit, QtCore.SIGNAL("editingFinished()"), - self.timeEditText) - - self.connect(self.gui.gainMuEdit, QtCore.SIGNAL("editingFinished()"), - self.gainMuEditText) - self.connect(self.gui.alphaEdit, QtCore.SIGNAL("editingFinished()"), - self.alphaEditText) + self.gui.pauseButton.clicked.connect(self.pauseFg) + self.gui.sampleRateEdit.editingFinished.connect(self.sampleRateEditText) + self.gui.snrEdit.editingFinished.connect(self.snrEditText) + self.gui.freqEdit.editingFinished.connect(self.freqEditText) + self.gui.timeEdit.editingFinished.connect(self.timeEditText) + self.gui.gainMuEdit.editingFinished.connect(self.gainMuEditText) + self.gui.alphaEdit.editingFinished.connect(self.alphaEditText) def pauseFg(self): @@ -102,7 +92,7 @@ class dialog_box(QtGui.QMainWindow): # Accessor functions for Gui to manipulate system parameters def set_sample_rate(self, sr): ssr = eng_notation.num_to_str(sr) - self.gui.sampleRateEdit.setText(QtCore.QString("%1").arg(ssr)) + self.gui.sampleRateEdit.setText("{0}".format(ssr)) def sampleRateEditText(self): try: @@ -115,13 +105,13 @@ class dialog_box(QtGui.QMainWindow): # Accessor functions for Gui to manipulate channel model def set_snr(self, snr): - self.gui.snrEdit.setText(QtCore.QString("%1").arg(snr)) + self.gui.snrEdit.setText("{0}".format(snr)) def set_frequency(self, fo): - self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo)) + self.gui.freqEdit.setText("{0}".format(fo)) def set_time_offset(self, to): - self.gui.timeEdit.setText(QtCore.QString("%1").arg(to)) + self.gui.timeEdit.setText("{0}".format(to)) def snrEditText(self): try: @@ -147,10 +137,10 @@ class dialog_box(QtGui.QMainWindow): # Accessor functions for Gui to manipulate receiver parameters def set_gain_mu(self, gain): - self.gui.gainMuEdit.setText(QtCore.QString("%1").arg(gain)) + self.gui.gainMuEdit.setText("{0}".format(gain)) def set_loop_bw(self, bw): - self.gui.alphaEdit.setText(QtCore.QString("%1").arg(bw)) + self.gui.alphaEdit.setText("{0}".format(bw)) def alphaEditText(self): try: @@ -171,7 +161,7 @@ class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self) - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) self._sample_rate = 2000e3 @@ -231,10 +221,10 @@ class my_top_block(gr.top_block): self.connect(self.channel, self.rx_rrc, self.receiver, self.snk_rx) pyTxQt = self.snk_tx.pyqwidget() - pyTx = sip.wrapinstance(pyTxQt, QtGui.QWidget) + pyTx = sip.wrapinstance(pyTxQt, QtWidgets.QWidget) pyRxQt = self.snk_rx.pyqwidget() - pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget) + pyRx = sip.wrapinstance(pyRxQt, QtWidgets.QWidget) self.main_box = dialog_box(pyTx, pyRx, self); self.main_box.show() diff --git a/gr-qtgui/apps/qt_digital_window.py b/gr-qtgui/apps/qt_digital_window.py index 50dd53a923..90c0f29e09 100644 --- a/gr-qtgui/apps/qt_digital_window.py +++ b/gr-qtgui/apps/qt_digital_window.py @@ -3,159 +3,159 @@ # Form implementation generated from reading ui file 'qt_digital_window.ui' # # Created: Sat May 1 20:14:02 2010 -# by: PyQt4 UI code generator 4.6.1 +# by: PyQt5 UI code generator 4.6.1 # # WARNING! All changes made in this file will be lost! -from PyQt4 import QtCore, QtGui +from PyQt5 import QtWidgets, Qt class Ui_DigitalWindow(object): def setupUi(self, DigitalWindow): DigitalWindow.setObjectName("DigitalWindow") DigitalWindow.resize(1236, 741) - self.centralwidget = QtGui.QWidget(DigitalWindow) + self.centralwidget = QtWidgets.QWidget(DigitalWindow) self.centralwidget.setObjectName("centralwidget") - self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) + self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") - self.sinkFrame = QtGui.QFrame(self.centralwidget) - self.sinkFrame.setMinimumSize(QtCore.QSize(0, 550)) - self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) - self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) + self.sinkFrame = QtWidgets.QFrame(self.centralwidget) + self.sinkFrame.setMinimumSize(Qt.QSize(0, 550)) + self.sinkFrame.setFrameShape(QtWidgets.QFrame.StyledPanel) + self.sinkFrame.setFrameShadow(QtWidgets.QFrame.Raised) self.sinkFrame.setObjectName("sinkFrame") - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.sinkFrame) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.sinkFrame) self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.sinkLayout = QtGui.QHBoxLayout() + self.sinkLayout = QtWidgets.QHBoxLayout() self.sinkLayout.setObjectName("sinkLayout") self.horizontalLayout_2.addLayout(self.sinkLayout) self.verticalLayout.addWidget(self.sinkFrame) - self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") - self.sysBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) + self.sysBox = QtWidgets.QGroupBox(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth()) self.sysBox.setSizePolicy(sizePolicy) - self.sysBox.setMinimumSize(QtCore.QSize(0, 0)) - self.sysBox.setMaximumSize(QtCore.QSize(16777215, 120)) - self.sysBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.sysBox.setMinimumSize(Qt.QSize(0, 0)) + self.sysBox.setMaximumSize(Qt.QSize(16777215, 120)) + self.sysBox.setAlignment(Qt.Qt.AlignLeading|Qt.Qt.AlignLeft|Qt.Qt.AlignTop) self.sysBox.setObjectName("sysBox") - self.gridLayout_2 = QtGui.QGridLayout(self.sysBox) + self.gridLayout_2 = QtWidgets.QGridLayout(self.sysBox) self.gridLayout_2.setObjectName("gridLayout_2") - self.sampleRateEdit = QtGui.QLineEdit(self.sysBox) - self.sampleRateEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.sampleRateEdit = QtWidgets.QLineEdit(self.sysBox) + self.sampleRateEdit.setMaximumSize(Qt.QSize(100, 16777215)) self.sampleRateEdit.setObjectName("sampleRateEdit") self.gridLayout_2.addWidget(self.sampleRateEdit, 0, 3, 1, 1) - self.sampleRateLabel = QtGui.QLabel(self.sysBox) + self.sampleRateLabel = QtWidgets.QLabel(self.sysBox) self.sampleRateLabel.setObjectName("sampleRateLabel") self.gridLayout_2.addWidget(self.sampleRateLabel, 0, 2, 1, 1) self.horizontalLayout.addWidget(self.sysBox) - self.rxBox = QtGui.QGroupBox(self.centralwidget) - self.rxBox.setMaximumSize(QtCore.QSize(16777215, 120)) - self.rxBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.rxBox = QtWidgets.QGroupBox(self.centralwidget) + self.rxBox.setMaximumSize(Qt.QSize(16777215, 120)) + self.rxBox.setAlignment(Qt.Qt.AlignLeading|Qt.Qt.AlignLeft|Qt.Qt.AlignTop) self.rxBox.setObjectName("rxBox") - self.gridLayout_3 = QtGui.QGridLayout(self.rxBox) + self.gridLayout_3 = QtWidgets.QGridLayout(self.rxBox) self.gridLayout_3.setObjectName("gridLayout_3") - self.alphaLabel = QtGui.QLabel(self.rxBox) + self.alphaLabel = QtWidgets.QLabel(self.rxBox) self.alphaLabel.setObjectName("alphaLabel") self.gridLayout_3.addWidget(self.alphaLabel, 1, 0, 1, 1) - self.alphaEdit = QtGui.QLineEdit(self.rxBox) - self.alphaEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.alphaEdit = QtWidgets.QLineEdit(self.rxBox) + self.alphaEdit.setMaximumSize(Qt.QSize(100, 16777215)) self.alphaEdit.setObjectName("alphaEdit") self.gridLayout_3.addWidget(self.alphaEdit, 1, 1, 1, 1) - self.gainMuLabel = QtGui.QLabel(self.rxBox) + self.gainMuLabel = QtWidgets.QLabel(self.rxBox) self.gainMuLabel.setObjectName("gainMuLabel") self.gridLayout_3.addWidget(self.gainMuLabel, 0, 0, 1, 1) - self.gainMuEdit = QtGui.QLineEdit(self.rxBox) - self.gainMuEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.gainMuEdit = QtWidgets.QLineEdit(self.rxBox) + self.gainMuEdit.setMaximumSize(Qt.QSize(100, 16777215)) self.gainMuEdit.setObjectName("gainMuEdit") self.gridLayout_3.addWidget(self.gainMuEdit, 0, 1, 1, 1) self.horizontalLayout.addWidget(self.rxBox) - self.channelModeBox = QtGui.QGroupBox(self.centralwidget) - self.channelModeBox.setMaximumSize(QtCore.QSize(16777215, 120)) - self.channelModeBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.channelModeBox = QtWidgets.QGroupBox(self.centralwidget) + self.channelModeBox.setMaximumSize(Qt.QSize(16777215, 120)) + self.channelModeBox.setAlignment(Qt.Qt.AlignLeading|Qt.Qt.AlignLeft|Qt.Qt.AlignTop) self.channelModeBox.setObjectName("channelModeBox") - self.gridLayout = QtGui.QGridLayout(self.channelModeBox) - self.gridLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize) + self.gridLayout = QtWidgets.QGridLayout(self.channelModeBox) + self.gridLayout.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize) self.gridLayout.setObjectName("gridLayout") - self.snrLabel = QtGui.QLabel(self.channelModeBox) + self.snrLabel = QtWidgets.QLabel(self.channelModeBox) self.snrLabel.setObjectName("snrLabel") self.gridLayout.addWidget(self.snrLabel, 0, 1, 1, 1) - self.snrEdit = QtGui.QLineEdit(self.channelModeBox) - self.snrEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.snrEdit = QtWidgets.QLineEdit(self.channelModeBox) + self.snrEdit.setMaximumSize(Qt.QSize(100, 16777215)) self.snrEdit.setObjectName("snrEdit") self.gridLayout.addWidget(self.snrEdit, 0, 2, 1, 1) - self.freqLabel = QtGui.QLabel(self.channelModeBox) + self.freqLabel = QtWidgets.QLabel(self.channelModeBox) self.freqLabel.setObjectName("freqLabel") self.gridLayout.addWidget(self.freqLabel, 1, 1, 1, 1) - self.freqEdit = QtGui.QLineEdit(self.channelModeBox) - self.freqEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.freqEdit = QtWidgets.QLineEdit(self.channelModeBox) + self.freqEdit.setMaximumSize(Qt.QSize(100, 16777215)) self.freqEdit.setObjectName("freqEdit") self.gridLayout.addWidget(self.freqEdit, 1, 2, 1, 1) - self.timeLabel = QtGui.QLabel(self.channelModeBox) + self.timeLabel = QtWidgets.QLabel(self.channelModeBox) self.timeLabel.setObjectName("timeLabel") self.gridLayout.addWidget(self.timeLabel, 2, 1, 1, 1) - self.timeEdit = QtGui.QLineEdit(self.channelModeBox) - self.timeEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.timeEdit = QtWidgets.QLineEdit(self.channelModeBox) + self.timeEdit.setMaximumSize(Qt.QSize(100, 16777215)) self.timeEdit.setObjectName("timeEdit") self.gridLayout.addWidget(self.timeEdit, 2, 2, 1, 1) self.horizontalLayout.addWidget(self.channelModeBox) - spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) - self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem1) - self.pauseButton = QtGui.QPushButton(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.pauseButton = QtWidgets.QPushButton(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pauseButton.sizePolicy().hasHeightForWidth()) self.pauseButton.setSizePolicy(sizePolicy) - self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.pauseButton.setMaximumSize(Qt.QSize(80, 16777215)) self.pauseButton.setObjectName("pauseButton") self.verticalLayout_2.addWidget(self.pauseButton) - self.closeButton = QtGui.QPushButton(self.centralwidget) - self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.closeButton = QtWidgets.QPushButton(self.centralwidget) + self.closeButton.setMaximumSize(Qt.QSize(80, 16777215)) self.closeButton.setObjectName("closeButton") self.verticalLayout_2.addWidget(self.closeButton) self.horizontalLayout.addLayout(self.verticalLayout_2) self.verticalLayout.addLayout(self.horizontalLayout) DigitalWindow.setCentralWidget(self.centralwidget) - self.menubar = QtGui.QMenuBar(DigitalWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1236, 23)) + self.menubar = QtWidgets.QMenuBar(DigitalWindow) + self.menubar.setGeometry(Qt.QRect(0, 0, 1236, 23)) self.menubar.setObjectName("menubar") - self.menuFile = QtGui.QMenu(self.menubar) + self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") DigitalWindow.setMenuBar(self.menubar) - self.statusbar = QtGui.QStatusBar(DigitalWindow) + self.statusbar = QtWidgets.QStatusBar(DigitalWindow) self.statusbar.setObjectName("statusbar") DigitalWindow.setStatusBar(self.statusbar) - self.actionExit = QtGui.QAction(DigitalWindow) + self.actionExit = QtWidgets.QAction(DigitalWindow) self.actionExit.setObjectName("actionExit") self.menuFile.addAction(self.actionExit) self.menubar.addAction(self.menuFile.menuAction()) self.retranslateUi(DigitalWindow) - QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) - QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close) - QtCore.QMetaObject.connectSlotsByName(DigitalWindow) + Qt.QObject.connect(self.closeButton, Qt.SIGNAL("clicked()"), DigitalWindow.close) + Qt.QObject.connect(self.actionExit, Qt.SIGNAL("triggered()"), DigitalWindow.close) + Qt.QMetaObject.connectSlotsByName(DigitalWindow) DigitalWindow.setTabOrder(self.snrEdit, self.freqEdit) DigitalWindow.setTabOrder(self.freqEdit, self.timeEdit) def retranslateUi(self, DigitalWindow): - DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) - self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain mu", None, QtGui.QApplication.UnicodeUTF8)) - self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.snrLabel.setText(QtGui.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8)) - self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) - self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) - self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) + DigitalWindow.setWindowTitle(QtWidgets.QApplication.translate("DigitalWindow", "MainWindow", None, QtWidgets.QApplication.UnicodeUTF8)) + self.sysBox.setTitle(QtWidgets.QApplication.translate("DigitalWindow", "System Parameters", None, QtWidgets.QApplication.UnicodeUTF8)) + self.sampleRateLabel.setText(QtWidgets.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtWidgets.QApplication.UnicodeUTF8)) + self.rxBox.setTitle(QtWidgets.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtWidgets.QApplication.UnicodeUTF8)) + self.alphaLabel.setText(QtWidgets.QApplication.translate("DigitalWindow", "Alpha", None, QtWidgets.QApplication.UnicodeUTF8)) + self.gainMuLabel.setText(QtWidgets.QApplication.translate("DigitalWindow", "Gain mu", None, QtWidgets.QApplication.UnicodeUTF8)) + self.channelModeBox.setTitle(QtWidgets.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtWidgets.QApplication.UnicodeUTF8)) + self.snrLabel.setText(QtWidgets.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtWidgets.QApplication.UnicodeUTF8)) + self.freqLabel.setText(QtWidgets.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtWidgets.QApplication.UnicodeUTF8)) + self.timeLabel.setText(QtWidgets.QApplication.translate("DigitalWindow", "Timing Offset", None, QtWidgets.QApplication.UnicodeUTF8)) + self.pauseButton.setText(QtWidgets.QApplication.translate("DigitalWindow", "Pause", None, QtWidgets.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtWidgets.QApplication.translate("DigitalWindow", "Close", None, QtWidgets.QApplication.UnicodeUTF8)) + self.menuFile.setTitle(QtWidgets.QApplication.translate("DigitalWindow", "&File", None, QtWidgets.QApplication.UnicodeUTF8)) + self.actionExit.setText(QtWidgets.QApplication.translate("DigitalWindow", "E&xit", None, QtWidgets.QApplication.UnicodeUTF8)) diff --git a/gr-qtgui/apps/uhd_display.py b/gr-qtgui/apps/uhd_display.py index 0e0c8a177d..e564e58c76 100755 --- a/gr-qtgui/apps/uhd_display.py +++ b/gr-qtgui/apps/uhd_display.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009,2011 Free Software Foundation, Inc. +# Copyright 2009,2011,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,10 +31,10 @@ import sys try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtWidgets, Qt import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) try: @@ -50,10 +50,10 @@ except ImportError: # //////////////////////////////////////////////////////////////////// -class main_window(QtGui.QMainWindow): +class main_window(QtWidgets.QMainWindow): def __init__(self, snk, fg, parent=None): - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.gui = Ui_MainWindow() self.gui.setupUi(self) @@ -62,28 +62,20 @@ class main_window(QtGui.QMainWindow): # Add the qtsnk widgets to the layout box self.gui.sinkLayout.addWidget(snk) - self.gui.dcGainEdit.setText(QtCore.QString("%1").arg(0.001)) + self.gui.dcGainEdit.setText("{0}".format(0.001)) # Connect up some signals - self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), - self.pauseFg) - self.connect(self.gui.frequencyEdit, QtCore.SIGNAL("editingFinished()"), - self.frequencyEditText) - self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"), - self.gainEditText) - self.connect(self.gui.bandwidthEdit, QtCore.SIGNAL("editingFinished()"), - self.bandwidthEditText) - self.connect(self.gui.amplifierEdit, QtCore.SIGNAL("editingFinished()"), - self.amplifierEditText) - - self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"), - self.saveData) - self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save) - - self.connect(self.gui.dcGainEdit, QtCore.SIGNAL("editingFinished()"), - self.dcGainEditText) - self.connect(self.gui.dcCancelCheckBox, QtCore.SIGNAL("clicked(bool)"), - self.dcCancelClicked) + self.gui.pauseButton.clicked.connect(self.pauseFg) + self.gui.frequencyEdit.editingFinished.connect(self.frequencyEditText) + self.gui.gainEdit.editingFinished.connect(self.gainEditText) + self.gui.bandwidthEdit.editingFinished.connect(self.bandwidthEditText) + self.gui.amplifierEdit.editingFinished.connect(self.amplifierEditText) + + self.gui.actionSaveData.activated.connect(self.saveData) + self.gui.actionSaveData.setShortcut(QtWidgets.QKeySequence.Save) + + self.gui.dcGainEdit.editingFinished.connect(self.dcGainEditText) + self.gui.dcCancelCheckBox.clicked.connect(self.dcCancelClicked) def pauseFg(self): if(self.gui.pauseButton.text() == "Pause"): @@ -99,20 +91,20 @@ class main_window(QtGui.QMainWindow): def set_frequency(self, freq): self.freq = freq sfreq = eng_notation.num_to_str(self.freq) - self.gui.frequencyEdit.setText(QtCore.QString("%1").arg(sfreq)) + self.gui.frequencyEdit.setText("{0}".format(sfreq)) def set_gain(self, gain): self.gain = gain - self.gui.gainEdit.setText(QtCore.QString("%1").arg(self.gain)) + self.gui.gainEdit.setText("{0}".format(self.gain)) def set_bandwidth(self, bw): self.bw = bw sbw = eng_notation.num_to_str(self.bw) - self.gui.bandwidthEdit.setText(QtCore.QString("%1").arg(sbw)) + self.gui.bandwidthEdit.setText("{0}".format(sbw)) def set_amplifier(self, amp): self.amp = amp - self.gui.amplifierEdit.setText(QtCore.QString("%1").arg(self.amp)) + self.gui.amplifierEdit.setText("{0}".format(self.amp)) # Functions called when signals are triggered in the GUI @@ -149,7 +141,7 @@ class main_window(QtGui.QMainWindow): pass def saveData(self): - fileName = QtGui.QFileDialog.getSaveFileName(self, "Save data to file", "."); + fileName = QtWidgets.QFileDialog.getSaveFileName(self, "Save data to file", "."); if(len(fileName)): self.fg.save_to_file(str(fileName)) @@ -170,7 +162,7 @@ class my_top_block(gr.top_block): self.options = options self.show_debug_info = True - self.qapp = QtGui.QApplication(sys.argv) + self.qapp = QtWidgets.QApplication(sys.argv) self.u = uhd.usrp_source(device_addr=options.address, stream_args=uhd.stream_args('fc32')) @@ -218,8 +210,8 @@ class my_top_block(gr.top_block): # Get the reference pointer to the SpectrumDisplayForm QWidget # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - self.pysink = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + # This can now be manipulated as a PyQt5.QtWidgets.QWidget + self.pysink = sip.wrapinstance(self.snk.pyqwidget(), QtWidgets.QWidget) self.main_win = main_window(self.pysink, self) diff --git a/gr-qtgui/apps/usrp_display_qtgui.py b/gr-qtgui/apps/usrp_display_qtgui.py index 4c9de3a53c..89591af5fc 100644 --- a/gr-qtgui/apps/usrp_display_qtgui.py +++ b/gr-qtgui/apps/usrp_display_qtgui.py @@ -3,189 +3,189 @@ # Form implementation generated from reading ui file 'usrp_display_qtgui.ui' # # Created: Thu Jul 16 22:06:24 2009 -# by: PyQt4 UI code generator 4.4.3 +# by: PyQt5 UI code generator 4.4.3 # # WARNING! All changes made in this file will be lost! -from PyQt4 import QtCore, QtGui +from PyQt5 import Qt, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(820, 774) - self.centralwidget = QtGui.QWidget(MainWindow) + self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") - self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget) + self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout_2.setObjectName("gridLayout_2") - self.horizontalLayout_2 = QtGui.QHBoxLayout() + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.groupBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.groupBox = QtWidgets.QGroupBox(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) self.groupBox.setSizePolicy(sizePolicy) - self.groupBox.setMinimumSize(QtCore.QSize(240, 150)) - self.groupBox.setMaximumSize(QtCore.QSize(240, 16777215)) + self.groupBox.setMinimumSize(Qt.QSize(240, 150)) + self.groupBox.setMaximumSize(Qt.QSize(240, 16777215)) self.groupBox.setObjectName("groupBox") - self.formLayoutWidget = QtGui.QWidget(self.groupBox) - self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 221, 124)) + self.formLayoutWidget = QtWidgets.QWidget(self.groupBox) + self.formLayoutWidget.setGeometry(Qt.QRect(10, 20, 221, 124)) self.formLayoutWidget.setObjectName("formLayoutWidget") - self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) + self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget) self.formLayout.setObjectName("formLayout") - self.frequencyLabel = QtGui.QLabel(self.formLayoutWidget) + self.frequencyLabel = QtWidgets.QLabel(self.formLayoutWidget) self.frequencyLabel.setObjectName("frequencyLabel") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.frequencyLabel) - self.gainLabel = QtGui.QLabel(self.formLayoutWidget) + self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.frequencyLabel) + self.gainLabel = QtWidgets.QLabel(self.formLayoutWidget) self.gainLabel.setObjectName("gainLabel") - self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.gainLabel) - self.bandwidthLabel = QtGui.QLabel(self.formLayoutWidget) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.gainLabel) + self.bandwidthLabel = QtWidgets.QLabel(self.formLayoutWidget) self.bandwidthLabel.setObjectName("bandwidthLabel") - self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.bandwidthLabel) - self.frequencyEdit = QtGui.QLineEdit(self.formLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.bandwidthLabel) + self.frequencyEdit = QtWidgets.QLineEdit(self.formLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.frequencyEdit.sizePolicy().hasHeightForWidth()) self.frequencyEdit.setSizePolicy(sizePolicy) - self.frequencyEdit.setMinimumSize(QtCore.QSize(120, 26)) + self.frequencyEdit.setMinimumSize(Qt.QSize(120, 26)) self.frequencyEdit.setObjectName("frequencyEdit") - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.frequencyEdit) - self.gainEdit = QtGui.QLineEdit(self.formLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.frequencyEdit) + self.gainEdit = QtWidgets.QLineEdit(self.formLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.gainEdit.sizePolicy().hasHeightForWidth()) self.gainEdit.setSizePolicy(sizePolicy) - self.gainEdit.setMinimumSize(QtCore.QSize(120, 26)) + self.gainEdit.setMinimumSize(Qt.QSize(120, 26)) self.gainEdit.setObjectName("gainEdit") - self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.gainEdit) - self.bandwidthEdit = QtGui.QLineEdit(self.formLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.gainEdit) + self.bandwidthEdit = QtWidgets.QLineEdit(self.formLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.bandwidthEdit.sizePolicy().hasHeightForWidth()) self.bandwidthEdit.setSizePolicy(sizePolicy) - self.bandwidthEdit.setMinimumSize(QtCore.QSize(120, 26)) + self.bandwidthEdit.setMinimumSize(Qt.QSize(120, 26)) self.bandwidthEdit.setObjectName("bandwidthEdit") - self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.bandwidthEdit) - self.amplifierLabel = QtGui.QLabel(self.formLayoutWidget) + self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.bandwidthEdit) + self.amplifierLabel = QtWidgets.QLabel(self.formLayoutWidget) self.amplifierLabel.setObjectName("amplifierLabel") - self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.amplifierLabel) - self.amplifierEdit = QtGui.QLineEdit(self.formLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.amplifierLabel) + self.amplifierEdit = QtWidgets.QLineEdit(self.formLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.amplifierEdit.sizePolicy().hasHeightForWidth()) self.amplifierEdit.setSizePolicy(sizePolicy) - self.amplifierEdit.setMinimumSize(QtCore.QSize(120, 26)) + self.amplifierEdit.setMinimumSize(Qt.QSize(120, 26)) self.amplifierEdit.setObjectName("amplifierEdit") - self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.amplifierEdit) + self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.amplifierEdit) self.horizontalLayout_2.addWidget(self.groupBox) - self.frame_2 = QtGui.QFrame(self.centralwidget) - self.frame_2.setMinimumSize(QtCore.QSize(200, 0)) - self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel) - self.frame_2.setFrameShadow(QtGui.QFrame.Raised) + self.frame_2 = QtWidgets.QFrame(self.centralwidget) + self.frame_2.setMinimumSize(Qt.QSize(200, 0)) + self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) + self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) self.frame_2.setObjectName("frame_2") - self.verticalLayoutWidget = QtGui.QWidget(self.frame_2) - self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, -1, 191, 151)) + self.verticalLayoutWidget = QtWidgets.QWidget(self.frame_2) + self.verticalLayoutWidget.setGeometry(Qt.QRect(10, -1, 191, 151)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") - self.verticalLayout_3 = QtGui.QVBoxLayout(self.verticalLayoutWidget) + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout_3.setObjectName("verticalLayout_3") - self.dcCancelCheckBox = QtGui.QCheckBox(self.verticalLayoutWidget) + self.dcCancelCheckBox = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.dcCancelCheckBox.setObjectName("dcCancelCheckBox") self.verticalLayout_3.addWidget(self.dcCancelCheckBox) - self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") - self.dcGainLabel = QtGui.QLabel(self.verticalLayoutWidget) + self.dcGainLabel = QtWidgets.QLabel(self.verticalLayoutWidget) self.dcGainLabel.setObjectName("dcGainLabel") self.horizontalLayout.addWidget(self.dcGainLabel) - self.dcGainEdit = QtGui.QLineEdit(self.verticalLayoutWidget) + self.dcGainEdit = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.dcGainEdit.setObjectName("dcGainEdit") self.horizontalLayout.addWidget(self.dcGainEdit) self.verticalLayout_3.addLayout(self.horizontalLayout) - spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem) self.horizontalLayout_2.addWidget(self.frame_2) - spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem1) - self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") - spacerItem2 = QtGui.QSpacerItem(20, 80, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + spacerItem2 = QtWidgets.QSpacerItem(20, 80, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout.addItem(spacerItem2) - self.pauseButton = QtGui.QPushButton(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.pauseButton = QtWidgets.QPushButton(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pauseButton.sizePolicy().hasHeightForWidth()) self.pauseButton.setSizePolicy(sizePolicy) self.pauseButton.setObjectName("pauseButton") self.verticalLayout.addWidget(self.pauseButton) - self.closeButton = QtGui.QPushButton(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.closeButton = QtWidgets.QPushButton(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.closeButton.sizePolicy().hasHeightForWidth()) self.closeButton.setSizePolicy(sizePolicy) - self.closeButton.setMinimumSize(QtCore.QSize(75, 0)) + self.closeButton.setMinimumSize(Qt.QSize(75, 0)) self.closeButton.setObjectName("closeButton") self.verticalLayout.addWidget(self.closeButton) self.horizontalLayout_2.addLayout(self.verticalLayout) self.gridLayout_2.addLayout(self.horizontalLayout_2, 1, 0, 1, 1) - self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") - self.frame = QtGui.QFrame(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) + self.frame = QtWidgets.QFrame(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth()) self.frame.setSizePolicy(sizePolicy) - self.frame.setMinimumSize(QtCore.QSize(800, 550)) - self.frame.setFrameShape(QtGui.QFrame.StyledPanel) - self.frame.setFrameShadow(QtGui.QFrame.Raised) + self.frame.setMinimumSize(Qt.QSize(800, 550)) + self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) + self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") - self.gridLayout = QtGui.QGridLayout(self.frame) + self.gridLayout = QtWidgets.QGridLayout(self.frame) self.gridLayout.setObjectName("gridLayout") - self.sinkLayout = QtGui.QHBoxLayout() + self.sinkLayout = QtWidgets.QHBoxLayout() self.sinkLayout.setObjectName("sinkLayout") self.gridLayout.addLayout(self.sinkLayout, 0, 0, 1, 1) self.verticalLayout_2.addWidget(self.frame) self.gridLayout_2.addLayout(self.verticalLayout_2, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) - self.menubar = QtGui.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 820, 24)) + self.menubar = QtWidgets.QMenuBar(MainWindow) + self.menubar.setGeometry(Qt.QRect(0, 0, 820, 24)) self.menubar.setObjectName("menubar") - self.menuFile = QtGui.QMenu(self.menubar) + self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") MainWindow.setMenuBar(self.menubar) - self.statusbar = QtGui.QStatusBar(MainWindow) + self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) - self.actionExit = QtGui.QAction(MainWindow) + self.actionExit = QtWidgets.QAction(MainWindow) self.actionExit.setObjectName("actionExit") - self.actionSaveData = QtGui.QAction(MainWindow) + self.actionSaveData = QtWidgets.QAction(MainWindow) self.actionSaveData.setObjectName("actionSaveData") self.menuFile.addAction(self.actionSaveData) self.menuFile.addAction(self.actionExit) self.menubar.addAction(self.menuFile.menuAction()) self.retranslateUi(MainWindow) - QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), MainWindow.close) - QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), MainWindow.close) - QtCore.QMetaObject.connectSlotsByName(MainWindow) + Qt.QObject.connect(self.closeButton, Qt.SIGNAL("clicked()"), MainWindow.close) + Qt.QObject.connect(self.actionExit, Qt.SIGNAL("triggered()"), MainWindow.close) + Qt.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): - MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "USRP Display", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.frequencyLabel.setText(QtGui.QApplication.translate("MainWindow", "Frequency (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.gainLabel.setText(QtGui.QApplication.translate("MainWindow", "RF Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.bandwidthLabel.setText(QtGui.QApplication.translate("MainWindow", "Bandwidth", None, QtGui.QApplication.UnicodeUTF8)) - self.amplifierLabel.setText(QtGui.QApplication.translate("MainWindow", "Amplifier", None, QtGui.QApplication.UnicodeUTF8)) - self.dcCancelCheckBox.setText(QtGui.QApplication.translate("MainWindow", "Cancel DC", None, QtGui.QApplication.UnicodeUTF8)) - self.dcGainLabel.setText(QtGui.QApplication.translate("MainWindow", "DC Canceller Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.pauseButton.setText(QtGui.QApplication.translate("MainWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("MainWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) - self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) - self.actionExit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) - self.actionSaveData.setText(QtGui.QApplication.translate("MainWindow", "&Save Data", None, QtGui.QApplication.UnicodeUTF8)) + MainWindow.setWindowTitle(QtWidgets.QApplication.translate("MainWindow", "USRP Display", None, QtWidgets.QApplication.UnicodeUTF8)) + self.groupBox.setTitle(QtWidgets.QApplication.translate("MainWindow", "Receiver Parameters", None, QtWidgets.QApplication.UnicodeUTF8)) + self.frequencyLabel.setText(QtWidgets.QApplication.translate("MainWindow", "Frequency (Hz)", None, QtWidgets.QApplication.UnicodeUTF8)) + self.gainLabel.setText(QtWidgets.QApplication.translate("MainWindow", "RF Gain", None, QtWidgets.QApplication.UnicodeUTF8)) + self.bandwidthLabel.setText(QtWidgets.QApplication.translate("MainWindow", "Bandwidth", None, QtWidgets.QApplication.UnicodeUTF8)) + self.amplifierLabel.setText(QtWidgets.QApplication.translate("MainWindow", "Amplifier", None, QtWidgets.QApplication.UnicodeUTF8)) + self.dcCancelCheckBox.setText(QtWidgets.QApplication.translate("MainWindow", "Cancel DC", None, QtWidgets.QApplication.UnicodeUTF8)) + self.dcGainLabel.setText(QtWidgets.QApplication.translate("MainWindow", "DC Canceller Gain", None, QtWidgets.QApplication.UnicodeUTF8)) + self.pauseButton.setText(QtWidgets.QApplication.translate("MainWindow", "Pause", None, QtWidgets.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtWidgets.QApplication.translate("MainWindow", "Close", None, QtWidgets.QApplication.UnicodeUTF8)) + self.menuFile.setTitle(QtWidgets.QApplication.translate("MainWindow", "&File", None, QtWidgets.QApplication.UnicodeUTF8)) + self.actionExit.setText(QtWidgets.QApplication.translate("MainWindow", "E&xit", None, QtWidgets.QApplication.UnicodeUTF8)) + self.actionSaveData.setText(QtWidgets.QApplication.translate("MainWindow", "&Save Data", None, QtWidgets.QApplication.UnicodeUTF8)) -- 2.11.0 From b12439f3f600b9d0be03189e8a82310d9ceabdd6 Mon Sep 17 00:00:00 2001 From: "A. Maitland Bottoms" Date: Sun, 25 Feb 2018 13:27:38 -0500 Subject: [PATCH 21/22] gnuradio runtime ctrlport qt5 --- gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py | 4 ++-- gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-monitor | 4 ++-- gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py index c5bfd0a8cb..6d78565b3b 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py +++ b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py @@ -28,10 +28,10 @@ import sys, time, struct try: from gnuradio import qtgui - from PyQt4 import QtGui, QtCore + from PyQt5 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt5 and gr-qtgui.\n") sys.exit(1) class GrDataPlotParent(gr.top_block, QtGui.QWidget): diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-monitor b/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-monitor index c866776355..ce53c60c0e 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-monitor +++ b/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-monitor @@ -20,8 +20,8 @@ # Boston, MA 02110-1301, USA. # -from PyQt4 import QtCore,Qt -import PyQt4.QtGui as QtGui +from PyQt5 import QtCore,Qt +import PyQt5.QtGui as QtGui import os, sys, time, struct from gnuradio import gr, ctrlport diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx index 15a2153a0f..a9e43bff41 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx +++ b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx @@ -46,8 +46,8 @@ except ImportError: "Please check that they are installed and try again." sys.exit(1) -from PyQt4 import QtCore,Qt -import PyQt4.QtGui as QtGui +from PyQt5 import QtCore,Qt +import PyQt5.QtGui as QtGui import itertools from gnuradio import gr, ctrlport -- 2.11.0 From 18f5edf38cc6a24836f943d6976d913a4f35cab3 Mon Sep 17 00:00:00 2001 From: "A. Maitland Bottoms" Date: Sun, 25 Feb 2018 13:28:05 -0500 Subject: [PATCH 22/22] gr uhd qt5 --- gr-uhd/apps/uhd_fft | 8 ++++---- gr-uhd/apps/uhd_siggen_gui | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) --- a/gr-uhd/apps/uhd_fft +++ b/gr-uhd/apps/uhd_fft @@ -40,7 +40,7 @@ import threading import time from distutils.version import StrictVersion -from PyQt4 import Qt +from PyQt5 import Qt from gnuradio import eng_notation from gnuradio import eng_arg from gnuradio import gr @@ -478,8 +478,8 @@ Go, go, go! """ args = setup_argparser().parse_args() - if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): - Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster')) + #if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): + # Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster')) qapp = Qt.QApplication(sys.argv) tb = uhd_fft(args) tb.start() @@ -487,7 +487,7 @@ def quitting(): tb.stop() tb.wait() - qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) + qapp.aboutToQuit.connect(quitting) qapp.exec_() tb = None #to clean up Qt widgets --- a/gr-uhd/apps/uhd_siggen_gui +++ b/gr-uhd/apps/uhd_siggen_gui @@ -38,8 +38,8 @@ import threading import time from distutils.version import StrictVersion -from PyQt4 import Qt -from PyQt4.QtCore import pyqtSlot +from PyQt5 import Qt +from PyQt5.QtCore import pyqtSlot from gnuradio import analog from gnuradio import eng_notation from gnuradio import gr @@ -448,14 +448,14 @@ """ Go, go, go! """ parser = setup_parser() args = parser.parse_args() - if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): - Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui', 'style', 'raster')) + #if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): + # Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui', 'style', 'raster')) qapp = Qt.QApplication(sys.argv) siggen_gui = uhd_siggen_gui(args) siggen_gui.show() def quitting(): siggen_gui.stop() - qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) + qapp.aboutToQuit.connect(quitting) qapp.exec_() siggen_gui = None #to clean up Qt widgets From af4ab4e0f745ef3d61effc71824b09d0c15d8b86 Mon Sep 17 00:00:00 2001 From: "A. Maitland Bottoms" Date: Mon, 26 Feb 2018 21:36:29 -0500 Subject: [PATCH] gr qtgui util --- gr-qtgui/python/qtgui/util.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gr-qtgui/python/qtgui/util.py b/gr-qtgui/python/qtgui/util.py index fffc482615..ca9f6f5035 100644 --- a/gr-qtgui/python/qtgui/util.py +++ b/gr-qtgui/python/qtgui/util.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright 2016 Free Software Foundation, Inc. +# Copyright 2016,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ # Boston, MA 02110-1301, USA. # -from PyQt4 import Qt, QtCore, QtGui +from PyQt5 import Qt, QtCore, QtGui, QtWidgets from gnuradio import gr def check_set_qss(): @@ -32,4 +32,3 @@ def check_set_qss(): app.setStyleSheet(open(qssfile).read()) except: print "WARNING: bad QSS file, %s"%(qssfile) - -- 2.11.0 From b65bf73bc174183d6aec476c2fb161a4911c2351 Mon Sep 17 00:00:00 2001 From: Vasil Velichkov Date: Thu, 11 Jan 2018 00:32:37 +0000 Subject: [PATCH 27/27] Fix AttributeError: 'NoneType' object has no attribute 'toByteArray' Debian Bug #886807 --- gr-uhd/apps/uhd_fft | 6 +++--- gr-uhd/apps/uhd_siggen_gui | 4 ++-- grc/blocks/options.xml | 2 +- grc/core/generator/flow_graph.tmpl | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) --- a/gr-uhd/apps/uhd_fft +++ b/gr-uhd/apps/uhd_fft @@ -40,7 +40,7 @@ import threading import time from distutils.version import StrictVersion -from PyQt5 import Qt +from PyQt5 import Qt, QtCore from gnuradio import eng_notation from gnuradio import eng_arg from gnuradio import gr @@ -60,7 +60,7 @@ """ def __init__(self, args): gr.top_block.__init__(self, "UHD FFT") - Qt.QWidget.__init__(self) + Qt.QWidget.__init__(self, args=args) UHDApp.__init__(self, args=args, prefix="UHD FFT") ################################################## # Init QT App @@ -82,7 +82,7 @@ self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "uhd_fft") - self.restoreGeometry(self.settings.value("geometry").toByteArray()) + self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Parameters --- a/gr-uhd/apps/uhd_siggen_gui +++ b/gr-uhd/apps/uhd_siggen_gui @@ -39,7 +39,7 @@ import time from distutils.version import StrictVersion from PyQt5 import Qt -from PyQt5.QtCore import pyqtSlot +from PyQt5.QtCore import pyqtSlot, QByteArray from gnuradio import analog from gnuradio import eng_notation from gnuradio import gr @@ -85,7 +85,7 @@ self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "uhd_siggen_gui") - self.restoreGeometry(self.settings.value("geometry").toByteArray()) + self.restoreGeometry(self.settings.value("geometry", type=QByteArray)) ################################################## # Widgets + Controls --- a/grc/blocks/options.xml +++ b/grc/blocks/options.xml @@ -16,7 +16,7 @@ import wx #end if #if $generate_options() == 'qt_gui' -from PyQt5 import Qt +from PyQt5 import Qt, QtCore import sys #end if #if $generate_options() == 'bokeh_gui' --- a/grc/core/generator/flow_graph.tmpl +++ b/grc/core/generator/flow_graph.tmpl @@ -122,7 +122,7 @@ self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "$class_name") - self.restoreGeometry(self.settings.value("geometry")) + self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) #elif $generate_options == 'bokeh_gui'