diff --git a/src/naoqi_dashboard/avahi.py b/src/naoqi_dashboard/avahi.py index c725092..bea1ae5 100644 --- a/src/naoqi_dashboard/avahi.py +++ b/src/naoqi_dashboard/avahi.py @@ -31,9 +31,15 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -import dbus, gobject, dbus.glib - -from python_qt_binding.QtGui import QComboBox +import dbus, dbus.glib +from gi.repository import GObject as gobject + +from distutils.version import LooseVersion +import python_qt_binding +if LooseVersion(python_qt_binding.QT_BINDING_VERSION).version[0] >= 5: + from python_qt_binding.QtWidgets import QComboBox +else: + from python_qt_binding.QtGui import QComboBox import collections diff --git a/src/naoqi_dashboard/frame.py b/src/naoqi_dashboard/frame.py index 9218909..1b699ce 100644 --- a/src/naoqi_dashboard/frame.py +++ b/src/naoqi_dashboard/frame.py @@ -55,7 +55,12 @@ from rqt_robot_dashboard.monitor_dash_widget import MonitorDashWidget from rqt_robot_dashboard.console_dash_widget import ConsoleDashWidget -from PyQt4 import QtGui, QtCore +from distutils.version import LooseVersion +import python_qt_binding +if LooseVersion(python_qt_binding.QT_BINDING_VERSION).version[0] >= 5: + from python_qt_binding.QtWidgets import QLabel +else: + from PyQt4.QtGui import QLabel class NAOqiDashboard(Dashboard): @@ -110,7 +115,7 @@ def get_widgets(self): self._motors_button], [self._power_state_ctrl], #[self.posture_combobox, self.posture_button] - [QtGui.QLabel("Posture"), self._postures] + [QLabel("Posture"), self._postures] ] diff --git a/src/naoqi_dashboard/motors.py b/src/naoqi_dashboard/motors.py index 5ce505f..12a6ebd 100644 --- a/src/naoqi_dashboard/motors.py +++ b/src/naoqi_dashboard/motors.py @@ -34,7 +34,12 @@ # Ported from pr2_motors: Vincent Rabaud, Aldebaran Robotics, 2014 # -from python_qt_binding.QtGui import QMessageBox +from distutils.version import LooseVersion +import python_qt_binding +if LooseVersion(python_qt_binding.QT_BINDING_VERSION).version[0] >= 5: + from python_qt_binding.QtWidgets import QMessageBox +else: + from python_qt_binding.QtGui import QMessageBox import actionlib import rospy diff --git a/src/naoqi_dashboard/posture.py b/src/naoqi_dashboard/posture.py index 61429ca..9bfda05 100644 --- a/src/naoqi_dashboard/posture.py +++ b/src/naoqi_dashboard/posture.py @@ -34,7 +34,12 @@ import actionlib import rospy -from python_qt_binding.QtGui import QComboBox, QMessageBox +from distutils.version import LooseVersion +import python_qt_binding +if LooseVersion(python_qt_binding.QT_BINDING_VERSION).version[0] >= 5: + from python_qt_binding.QtWidgets import QComboBox, QMessageBox +else: + from python_qt_binding.QtGui import QComboBox, QMessageBox from naoqi_bridge_msgs.msg import BodyPoseWithSpeedAction, BodyPoseWithSpeedGoal class PostureWidget(QComboBox):