From 6ccd0c20e5aa11f401b741bffc743d2d654ba4d1 Mon Sep 17 00:00:00 2001 From: Mike Lautman Date: Fri, 9 Nov 2018 20:12:41 -0700 Subject: [PATCH] ros2 port --- CMakeLists.txt | 21 +++++++++++++-------- package.xml | 19 ++++++++++--------- src/rqt_py_console/py_console_widget.py | 8 +++++--- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3d1f7f..80222ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,23 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.5) project(rqt_py_console) -# Load catkin and all dependencies required for this package -find_package(catkin REQUIRED) -catkin_package() -catkin_python_setup() + +# Load ament and all dependencies required for this package +find_package(ament_cmake REQUIRED) +find_package(ament_cmake_python REQUIRED) + +ament_python_install_package(${PROJECT_NAME} + PACKAGE_DIR src/${PROJECT_NAME}) install(FILES plugin.xml - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + DESTINATION share/${PROJECT_NAME} ) install(DIRECTORY resource - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + DESTINATION share/${PROJECT_NAME} ) install(PROGRAMS scripts/rqt_py_console - DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} + DESTINATION lib/${PROJECT_NAME} ) + +ament_package() \ No newline at end of file diff --git a/package.xml b/package.xml index 66deec5..bc32284 100644 --- a/package.xml +++ b/package.xml @@ -1,4 +1,4 @@ - + rqt_py_console 0.4.8 rqt_py_console is a Python GUI plugin providing an interactive Python console. @@ -12,18 +12,19 @@ Dorian Scholz - catkin + ament_cmake - python_qt_binding - python-rospkg - qt_gui - qt_gui_py_common - rospy - rqt_gui - rqt_gui_py + python_qt_binding + python-rospkg + qt_gui + qt_gui_py_common + rospy + rqt_gui + rqt_gui_py + ament_cmake diff --git a/src/rqt_py_console/py_console_widget.py b/src/rqt_py_console/py_console_widget.py index 983014c..7d695a8 100644 --- a/src/rqt_py_console/py_console_widget.py +++ b/src/rqt_py_console/py_console_widget.py @@ -31,7 +31,7 @@ # POSSIBILITY OF SUCH DAMAGE. import os -import rospkg +from ament_index_python.resources import get_resource from python_qt_binding import loadUi from python_qt_binding.QtWidgets import QWidget @@ -42,8 +42,10 @@ class PyConsoleWidget(QWidget): def __init__(self, context=None): super(PyConsoleWidget, self).__init__() - rp = rospkg.RosPack() - ui_file = os.path.join(rp.get_path('rqt_py_console'), 'resource', 'py_console_widget.ui') + + _, package_path = get_resource('packages', 'qt_gui_py_common') + ui_file = os.path.join(package_path, 'share', 'resource', 'py_console_widget.ui') + loadUi(ui_file, self, {'PyConsoleTextEdit': PyConsoleTextEdit}) self.setObjectName('PyConsoleWidget')