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
00022 from roslib.packages import get_pkg_dir
00023
00024 from python_qt_binding.QtGui import *
00025 from python_qt_binding.QtCore import *
00026
00027 from launch_item import LaunchItem
00028
00029 class TableLaunchNodes:
00030
00031 def __init__(self, gui):
00032
00033 self._gui = gui
00034
00035 self._datamodel = QStandardItemModel(0, 3)
00036
00037 self._gui._table_launch.setModel(self._datamodel)
00038 self._gui._table_launch.verticalHeader().setVisible(False)
00039
00040 node_launchers_path = '/'.join([get_pkg_dir('node_launchers'),
00041 'launch'])
00042
00043 self._launch_list = []
00044
00045
00046
00047 i=0
00048 for launch_file in os.listdir(node_launchers_path):
00049 self._add_launcher(launch_file,'/cobotgui-dev', i)
00050 i+=1
00051
00052 self._gui._table_launch.resizeColumnsToContents()
00053 self._gui._table_launch.resizeRowsToContents()
00054
00055 def _add_launcher(self, launch_file, machine_name, index):
00056
00057 new_launch = LaunchItem(launch_file, machine_name)
00058
00059 self._datamodel.setItem(index, 0, QStandardItem())
00060
00061 qindex = self._datamodel.index(index, 0, QModelIndex())
00062 self._gui._table_launch.setIndexWidget(qindex, new_launch.launch_name)
00063
00064 qindex = self._datamodel.index(index, 1, QModelIndex())
00065 self._gui._table_launch.setIndexWidget(qindex, new_launch.combo_machines)
00066
00067 qindex = self._datamodel.index(index, 2, QModelIndex())
00068 self._gui._table_launch.setIndexWidget(qindex, new_launch.button_launch_widget)
00069
00070 self._launch_list.append(new_launch)
00071
00072 def translate(self):
00073
00074 self._gui.launch_header_label.setText(trUtf8('Nodes launch'))
00075
00076 header_label = [trUtf8('Name'), trUtf8('Default machine'), trUtf8('Launch')]
00077
00078 for i in range(len(header_label)):
00079 self._datamodel.setHeaderData(i, Qt.Horizontal, header_label[i])
00080
00081