Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import rospy
00019 import time
00020 import os
00021 import roslaunch
00022 import subprocess
00023
00024 from roslib.packages import get_pkg_dir
00025
00026 from python_qt_binding.QtGui import *
00027 from python_qt_binding.QtCore import *
00028
00029 def widget_creator(obj_ui):
00030
00031 widget = QWidget()
00032
00033 layout = QHBoxLayout(widget)
00034 layout.setSpacing(6)
00035 layout.setContentsMargins(0, 0, 0, 0)
00036 spacer_left = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
00037 spacer_right = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
00038
00039 layout.addItem(spacer_left)
00040 layout.addWidget(obj_ui)
00041 layout.addItem(spacer_right)
00042
00043 return widget
00044
00045 class LaunchItem:
00046
00047 def __init__(self, launch, machine):
00048
00049 self.launch_name = QLabel(launch)
00050 self.launch_name.setContentsMargins(0,0,10,0)
00051 self.launch_name.setMinimumHeight(40)
00052
00053
00054 self.combo_machines = QComboBox()
00055 self.combo_machines.setMinimumHeight(40)
00056 self.combo_machines.addItem('cobotgui-dev:127.0.0.1')
00057 self.combo_machines.addItem('cobot:192.168.0.1')
00058
00059 rsc = os.path.join(get_pkg_dir('airbus_plugin_node_manager'),'resources')
00060 icon_launch = QIcon(rsc+'/launch.png')
00061
00062 self.button_launch = QPushButton()
00063 self.button_launch.setIcon(icon_launch)
00064 self.button_launch.setIconSize(QSize(30,30))
00065 self.button_launch.setFixedSize(QSize(100,40))
00066 self.button_launch.clicked.connect(self._launch_node_slot)
00067
00068 self.button_launch_widget = widget_creator(self.button_launch)
00069
00070 def _launch_node_slot(self):
00071
00072 rospy.loginfo('%s::_launch_node()'%self.launch_name.text())
00073
00074 subprocess.Popen(['roslaunch',
00075 'node_launchers',
00076 self.launch_name.text()])
00077
00078