From e35419d660d2466898dfa1f268700f88c887d1e6 Mon Sep 17 00:00:00 2001 From: Kanae Kochigami Date: Fri, 2 Nov 2018 15:18:59 +0900 Subject: [PATCH 1/2] fix some import to support qt>=5 --- src/naoqi_dashboard/avahi.py | 7 ++++++- src/naoqi_dashboard/frame.py | 9 +++++++-- src/naoqi_dashboard/motors.py | 7 ++++++- src/naoqi_dashboard/posture.py | 7 ++++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/naoqi_dashboard/avahi.py b/src/naoqi_dashboard/avahi.py index c725092..26cbf5d 100644 --- a/src/naoqi_dashboard/avahi.py +++ b/src/naoqi_dashboard/avahi.py @@ -33,7 +33,12 @@ import dbus, gobject, dbus.glib -from python_qt_binding.QtGui import QComboBox +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): From 6fed931934e8844deb9a6a9a2caf400ff227ca9a Mon Sep 17 00:00:00 2001 From: Kanae Kochigami Date: Thu, 21 Jul 2022 16:00:18 +0900 Subject: [PATCH 2/2] [naoqi_dashboard/src/naoqi_dashboard/avahi.py] fix ImportError: No module named gobject (for ROS melodic) --- src/naoqi_dashboard/avahi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/naoqi_dashboard/avahi.py b/src/naoqi_dashboard/avahi.py index 26cbf5d..bea1ae5 100644 --- a/src/naoqi_dashboard/avahi.py +++ b/src/naoqi_dashboard/avahi.py @@ -31,7 +31,8 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -import dbus, gobject, dbus.glib +import dbus, dbus.glib +from gi.repository import GObject as gobject from distutils.version import LooseVersion import python_qt_binding