From 7bc999f212d5f74d71bfa39218272b9d19cf1555 Mon Sep 17 00:00:00 2001 From: Tom Rondeau <tom@trondeau.com> Date: Tue, 13 Oct 2015 18:47:32 -0400 Subject: qtgui: fixed examples for Qt5 compatibility. --- gr-qtgui/examples/pyqt_time_raster_b.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'gr-qtgui/examples/pyqt_time_raster_b.py') 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() - -- cgit v1.2.3