def __init__(self, context): super(QuestionDialogPlugin, self).__init__(context) # Give QObjects reasonable names self.setObjectName('QuestionDialogPlugin') font_size = rospy.get_param("~font_size", 40) # Create QWidget self._widget = QWidget() self._widget.setFont(QFont("Times", font_size, QFont.Bold)) self._layout = QVBoxLayout(self._widget) self._text_browser = QTextBrowser(self._widget) self._layout.addWidget(self._text_browser) self._button_layout = QHBoxLayout() self._layout.addLayout(self._button_layout) # layout = QVBoxLayout(self._widget) # layout.addWidget(self.button) self._widget.setObjectName('QuestionDialogPluginUI') if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number())) context.add_widget(self._widget) # Setup service provider self.service = rospy.Service('question_dialog', QuestionDialog, self.service_callback) self.response_ready = False self.response = None self.buttons = [] self.text_label = None self.text_input = None self.connect(self._widget, SIGNAL("update"), self.update) self.connect(self._widget, SIGNAL("timeout"), self.timeout)
def __init__(self, context): super(EusGUI, self).__init__(context) # Give QObjects reasonable names self.setObjectName('EusGUI') self.msg = None # Create a container widget and give it a layout self._toolbar = QToolBar() self._toolbar.addWidget(QLabel('EusGUI')) self._container = QWidget() self._layout = QVBoxLayout() self._container.setLayout(self._layout) self._layout.addWidget(self._toolbar) self._prev_button = QPushButton('PREV') self._prev_button.clicked.connect(self._prev_cb) self._layout.addWidget(self._prev_button) self._refresh_button = QPushButton('DO IT AGAIN') self._refresh_button.clicked.connect(self._refresh_cb) self._layout.addWidget(self._refresh_button) self._next_button = QPushButton('NEXT') self._next_button.clicked.connect(self._next_cb) self._layout.addWidget(self._next_button) context.add_widget(self._container)
def __init__(self, status): super(InspectorWidget, self).__init__() self.status = status self.setWindowTitle(status.name) self.paused = False layout = QVBoxLayout() self.disp = QTextEdit() self.snapshot = QPushButton("Snapshot") self.time = TimelineWidget(self) layout.addWidget(self.disp, 1) layout.addWidget(self.time, 0) layout.addWidget(self.snapshot) self.snaps = [] self.snapshot.clicked.connect(self.take_snapshot) self.write.connect(self.write_kv) self.newline.connect(lambda: self.disp.insertPlainText('\n')) self.clear.connect(lambda: self.disp.clear()) self.setLayout(layout) self.setGeometry(0,0,300,400) self.show() self.update(status)
def __init__(self, parent=None, logger=Logger()): QWidgetWithLogger.__init__(self, parent, logger) # start widget vbox = QVBoxLayout() vbox.setMargin(0) vbox.setContentsMargins(0, 0, 0, 0) # parameter action server topic selection topic_widget = QTopicWidget( self, 'vigir_generic_params/GetParameterSetNamesAction', True) vbox.addWidget(topic_widget) # parameter set selection self.parameter_set_selection_widget = QParameterSetSelectionWidget( self, logger) self.parameter_set_selection_widget.param_cleared_signal.connect( self.param_cleared) self.parameter_set_selection_widget.param_changed_signal.connect( self.param_changed) topic_widget.topic_changed_signal.connect(self.topic_changed) topic_widget.topic_changed_signal.connect( self.parameter_set_selection_widget.set_topic_name) vbox.addWidget(self.parameter_set_selection_widget) # end widget self.setLayout(vbox) # init widget topic_widget.emit_topic_name()
def __init__(self, filenames, search_text='', parent=None): ''' @param filenames: a list with filenames. The last one will be activated. @type filenames: C{[str, ...]} @param search_text: if not empty, searches in new document for first occurrence of the given text @type search_text: C{str} (Default: C{Empty String}) ''' QMainWindow.__init__(self, parent) self.setObjectName(' - '.join(['Editor', str(filenames)])) self.setAttribute(Qt.WA_DeleteOnClose, True) self.setWindowFlags(Qt.Window) self.mIcon = QIcon(":/icons/crystal_clear_edit_launch.png") self._error_icon = QIcon(":/icons/crystal_clear_warning.png") self._empty_icon = QIcon() self.setWindowIcon(self.mIcon) window_title = "ROSLaunch Editor" if filenames: window_title = self.__getTabName(filenames[0]) self.setWindowTitle(window_title) self.init_filenames = list(filenames) self._search_thread = None # list with all open files self.files = [] # create tabs for files self.main_widget = QWidget(self) self.verticalLayout = QVBoxLayout(self.main_widget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setSpacing(1) self.verticalLayout.setObjectName("verticalLayout") self.tabWidget = EditorTabWidget(self) self.tabWidget.setTabPosition(QTabWidget.North) self.tabWidget.setDocumentMode(True) self.tabWidget.setTabsClosable(True) self.tabWidget.setMovable(False) self.tabWidget.setObjectName("tabWidget") self.tabWidget.tabCloseRequested.connect(self.on_close_tab) self.tabWidget.currentChanged.connect(self.on_tab_changed) self.verticalLayout.addWidget(self.tabWidget) self.buttons = self._create_buttons() self.verticalLayout.addWidget(self.buttons) self.setCentralWidget(self.main_widget) self.find_dialog = TextSearchFrame(self.tabWidget, self) self.find_dialog.search_result_signal.connect(self.on_search_result) self.find_dialog.replace_signal.connect(self.on_replace) self.addDockWidget(Qt.RightDockWidgetArea, self.find_dialog) self.graph_view = GraphViewWidget(self.tabWidget, self) self.graph_view.load_signal.connect(self.on_graph_load_file) self.graph_view.goto_signal.connect(self.on_graph_goto) self.addDockWidget(Qt.RightDockWidgetArea, self.graph_view) # open the files for f in filenames: if f: self.on_load_request(os.path.normpath(f), search_text) self.readSettings() self.find_dialog.setVisible(False) self.graph_view.setVisible(False)
def __init__(self): super(CalibrationMovementsGUI, self).__init__() move_group_name = rospy.get_param('~move_group', 'manipulator') self.angle_delta = math.radians( rospy.get_param('~rotation_delta_degrees', 25)) self.translation_delta = rospy.get_param('~translation_delta_meters', 0.1) max_velocity_scaling = rospy.get_param('~max_velocity_scaling', 0.5) max_acceleration_scaling = rospy.get_param('~max_acceleration_scaling', 0.5) self.local_mover = CalibrationMovements(move_group_name, max_velocity_scaling, max_acceleration_scaling) self.current_pose = -1 self.current_plan = None self.state = CalibrationMovementsGUI.NOT_INITED_YET self.layout = QVBoxLayout() self.labels_layout = QHBoxLayout() self.buttons_layout = QHBoxLayout() self.progress_bar = QProgressBar() self.pose_number_lbl = QLabel('0/8') self.bad_plan_lbl = QLabel('No plan yet') self.guide_lbl = QLabel('Hello') self.guide_lbl.setWordWrap(True) self.check_start_pose_btn = QPushButton('Check starting pose') self.check_start_pose_btn.clicked.connect( self.handle_check_current_state) self.next_pose_btn = QPushButton('Next Pose') self.next_pose_btn.clicked.connect(self.handle_next_pose) self.plan_btn = QPushButton('Plan') self.plan_btn.clicked.connect(self.handle_plan) self.execute_btn = QPushButton('Execute') self.execute_btn.clicked.connect(self.handle_execute) self.labels_layout.addWidget(self.pose_number_lbl) self.labels_layout.addWidget(self.bad_plan_lbl) self.buttons_layout.addWidget(self.check_start_pose_btn) self.buttons_layout.addWidget(self.next_pose_btn) self.buttons_layout.addWidget(self.plan_btn) self.buttons_layout.addWidget(self.execute_btn) self.layout.addWidget(self.progress_bar) self.layout.addLayout(self.labels_layout) self.layout.addWidget(self.guide_lbl) self.layout.addLayout(self.buttons_layout) self.setLayout(self.layout) self.plan_btn.setEnabled(False) self.execute_btn.setEnabled(False) self.setWindowTitle('Local Mover') self.show()
def __init__(self, map_topic='/map', paths=['/move_base/NavFn/plan', '/move_base/TrajectoryPlannerROS/local_plan'], polygons=['/move_base/local_costmap/robot_footprint']): super(NavViewWidget, self).__init__() self._layout = QVBoxLayout() self._button_layout = QHBoxLayout() self.setAcceptDrops(True) self.setWindowTitle('Navigation Viewer') self.paths = paths self.polygons = polygons self.map = map_topic self._tf = tf.TransformListener() self._nav_view = NavView(map_topic, paths, polygons, tf = self._tf, parent = self) self._set_pose = QPushButton('Set Pose') self._set_pose.clicked.connect(self._nav_view.pose_mode) self._set_goal = QPushButton('Set Goal') self._set_goal.clicked.connect(self._nav_view.goal_mode) self._button_layout.addWidget(self._set_pose) self._button_layout.addWidget(self._set_goal) self._layout.addLayout(self._button_layout) self._layout.addWidget(self._nav_view) self.setLayout(self._layout)
def __init__(self, options, title='Exclusive Options', selected_index=None): super(ExclusiveOptionGroup, self).__init__() self.setTitle(title) self.setLayout(QVBoxLayout()) self._button_group = QButtonGroup() self._button_group.setExclusive(True) self._options = options button_id = 0 for option in self._options: button_id += 1 radio_button = QRadioButton( option.get('title', 'option %d' % button_id)) radio_button.setEnabled(option.get('enabled', True)) radio_button.setChecked( option.get('selected', False) or (button_id - 1) == selected_index) radio_button.setToolTip(option.get('tooltip', '')) widget = QWidget() widget.setLayout(QVBoxLayout()) widget.layout().addWidget(radio_button) if 'description' in option: widget.layout().addWidget(QLabel(option['description'])) self._button_group.addButton(radio_button, button_id) self.layout().addWidget(widget)
def __init__(self, context): super(GhostRobotControlPlugin, self).__init__(context) self.setObjectName('GhostRobotControlPlugin') self.joint_states_to_ghost_pub = rospy.Publisher('/joint_states_to_ghost', JointState, queue_size=10) self.ghost_joint_states_sub = rospy.Subscriber('/ghost/joint_states', JointState, self.ghost_joint_states_cb) self.real_joint_states_sub = rospy.Subscriber('/atlas/joint_states', JointState, self.real_joint_states_cb) self.ghost_joint_states = JointState() self.real_joint_states = JointState() self.move_real_robot = False self.widget = QWidget() vbox = QVBoxLayout() self.real_to_ghost_push_button = QPushButton('Set Ghost from real robot') self.real_to_ghost_push_button.clicked.connect(self.handle_set_real_to_ghost) vbox.addWidget(self.real_to_ghost_push_button) self.send_motion_plan_to_real_robot_check_box = QCheckBox('Motion GUI moves real robot') self.send_motion_plan_to_real_robot_check_box.stateChanged.connect(self.handle_send_motion_plan_to_real_robot_check_box) vbox.addWidget(self.send_motion_plan_to_real_robot_check_box) self.widget.setLayout(vbox) context.add_widget(self.widget)
def __init__(self, map_topic='/map', paths=[ '/move_base/NavfnROS/plan', '/move_base/DWAPlannerROS/local_plan' ], polygons=['/move_base/local_costmap/footprint']): super(NavViewWidget, self).__init__() self._layout = QVBoxLayout() self._button_layout = QHBoxLayout() self.setAcceptDrops(True) self.setWindowTitle('Navigation Viewer') self.paths = paths self.polygons = polygons self.map = map_topic self._tf = tf.TransformListener() self._nav_view = NavView(map_topic, paths, polygons, tf=self._tf, parent=self) self._layout.addLayout(self._button_layout) self._layout.addWidget(self._nav_view) self.setLayout(self._layout)
def __init__(self, parent=None, current_values=None): super(BlacklistDialog, self).__init__(parent) self.setWindowTitle("Blacklist") vbox = QVBoxLayout() self.setLayout(vbox) self._blacklist = Blacklist() if isinstance(current_values, list): for val in current_values: self._blacklist.append(val) vbox.addWidget(self._blacklist) controls_layout = QHBoxLayout() add_button = QPushButton(icon=QIcon.fromTheme('list-add')) rem_button = QPushButton(icon=QIcon.fromTheme('list-remove')) ok_button = QPushButton("Ok") cancel_button = QPushButton("Cancel") add_button.clicked.connect(self._add_item) rem_button.clicked.connect(self._remove_item) ok_button.clicked.connect(self.accept) cancel_button.clicked.connect(self.reject) controls_layout.addWidget(add_button) controls_layout.addWidget(rem_button) controls_layout.addStretch(0) controls_layout.addWidget(ok_button) controls_layout.addWidget(cancel_button) vbox.addLayout(controls_layout)
def add_widget(self, widget): if widget in self._embed_widgets: qWarning('PluginHandlerXEmbedClient.add_widget() widget "%s" already added' % widget.objectName()) return embed_widget = QX11EmbedWidget() layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(widget) embed_widget.setLayout(layout) # close embed widget when container is closed # TODO necessary? #embed_widget.containerClosed.connect(embed_widget.close) embed_container_window_id = self._remote_container.embed_widget(os.getpid(), widget.objectName()) embed_widget.embedInto(embed_container_window_id) signaler = WindowChangedSignaler(widget, widget) signaler.window_icon_changed_signal.connect(self._on_embed_widget_icon_changed) signaler.window_title_changed_signal.connect(self._on_embed_widget_title_changed) self._embed_widgets[widget] = embed_widget, signaler # trigger to update initial window icon and title signaler.window_icon_changed_signal.emit(widget) signaler.window_title_changed_signal.emit(widget) embed_widget.show()
def __init__(self): super(TopicSelection, self).__init__() master = rosgraph.Master('rqt_bag_recorder') self.setWindowTitle("Select the topics you want to record") self.resize(500, 700) self.topic_list = [] self.selected_topics = [] self.items_list = [] self.area = QScrollArea(self) self.main_widget = QWidget(self.area) self.ok_button = QPushButton("Record", self) self.ok_button.clicked.connect(self.onButtonClicked) self.ok_button.setEnabled(False) self.main_vlayout = QVBoxLayout(self) self.main_vlayout.addWidget(self.area) self.main_vlayout.addWidget(self.ok_button) self.setLayout(self.main_vlayout) self.selection_vlayout = QVBoxLayout(self) self.item_all = QCheckBox("All", self) self.item_all.stateChanged.connect(self.updateList) self.selection_vlayout.addWidget(self.item_all) topic_data_list = master.getPublishedTopics('') topic_data_list.sort() for topic, datatype in topic_data_list: self.addCheckBox(topic) self.main_widget.setLayout(self.selection_vlayout) self.area.setWidget(self.main_widget) self.show()
def _create_found_frame(self): self.found_files_frame = ff_frame = QGroupBox("recursive search") ff_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.found_files_vbox_layout = QVBoxLayout(ff_frame) self.found_files_vbox_layout.setSpacing(0) self.found_files_vbox_layout.setContentsMargins(0, 0, 0, 0) self.found_files_list = QListWidget(ff_frame) self.found_files_list.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.found_files_list.setFrameStyle(QFrame.StyledPanel) self.found_files_list.itemActivated.connect(self.on_itemActivated) self.found_files_list.setStyleSheet("QListWidget {" "background-color:transparent;" "}" "QListWidget::item {" "background-color:transparent;" "}" "QListWidget::item:selected {" "background-color: darkgray;" "}") self.found_files_vbox_layout.addWidget(self.found_files_list) ff_frame.setCheckable(True) ff_frame.setChecked(False) ff_frame.setFlat(True) self.found_files_list.setVisible(False) return self.found_files_frame
def _update_client_list(self, service_name): service_list = self.admin_app_info.service_list client_list = service_list[service_name]["client_list"] self._widget.client_tab_widget.clear() for k in client_list.values(): client_name = k["name"] k["index"] = self._widget.client_tab_widget.count() main_widget = QWidget() ver_layout = QVBoxLayout(main_widget) ver_layout.setContentsMargins(9, 9, 9, 9) ver_layout.setSizeConstraint(ver_layout.SetDefaultConstraint) sub_widget = QWidget() sub_widget.setAccessibleName('sub_widget') ver_layout.addWidget(sub_widget) client_context_widget = QPlainTextEdit() client_context_widget.setObjectName(client_name + '_' + 'app_context_widget') client_context_widget.setAccessibleName('app_context_widget') client_context_widget.appendPlainText("client name is " + client_name) #ap><b>uuidp_context_widget.appendHtml(k["app_context"]) ver_layout.addWidget(client_context_widget) #add tab self._widget.client_tab_widget.addTab(main_widget, client_name) pass
def setupUi(self, cmd_vel_topic_name): self._ui.setupUi(self) self._cmd_vel_topic_name = cmd_vel_topic_name self._plot_layout = QVBoxLayout(self._ui.battery_profile_group_box) self._ui.start_button.setEnabled(True) self._ui.stop_button.setEnabled(False) self.restore()
def __init__(self, tabwidget, parent=None): QDockWidget.__init__(self, "Find", parent) self.setObjectName('SearchFrame') self.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable) self._dockwidget = QFrame(self) self.vbox_layout = QVBoxLayout(self._dockwidget) self.layout().setContentsMargins(0, 0, 0, 0) self.layout().setSpacing(1) # frame with two rows for find and replace find_replace_frame = QFrame(self) find_replace_vbox_layout = QVBoxLayout(find_replace_frame) find_replace_vbox_layout.setContentsMargins(0, 0, 0, 0) find_replace_vbox_layout.setSpacing(1) # find_replace_vbox_layout.addSpacerItem(QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)) # create frame with find row find_frame = self._create_find_frame() find_replace_vbox_layout.addWidget(find_frame) rplc_frame = self._create_replace_frame() find_replace_vbox_layout.addWidget(rplc_frame) # frame for find&replace and search results self.vbox_layout.addWidget(find_replace_frame) self.vbox_layout.addWidget(self._create_found_frame()) # self.vbox_layout.addStretch(2024) self.setWidget(self._dockwidget) # intern search parameters self._tabwidget = tabwidget self.current_search_text = '' self.search_results = [] self.search_results_fileset = set() self._search_result_index = -1 self._search_recursive = False self._search_thread = None
def __init__(self, parent=None): super(MatPlot2D, self).__init__(parent) self._canvas = MatPlot2D.Canvas() self._toolbar = NavigationToolbar(self._canvas, self._canvas) vbox = QVBoxLayout() vbox.addWidget(self._toolbar) vbox.addWidget(self._canvas) self.setLayout(vbox)
def __init__(self): super(Tester, self).__init__(); vlayout = QVBoxLayout(); self.testButton = QPushButton("Exactly one row of buttons"); vlayout.addWidget(self.testButton); self.testButton.clicked.connect(self.exactlyOneRow); self.setLayout(vlayout); self.show();
def __init__(self, parent=None): super(PlotWidget, self).__init__(parent) # create widgets self.canvas = PlotCanvas() self.toolbar = NavigationToolbar(self.canvas, self.canvas) self.toolbar.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) vbox = QVBoxLayout() vbox.addWidget(self.toolbar) vbox.addWidget(self.canvas) self.setLayout(vbox)
def __init__(self, parent = None, logger = Logger()): QWidgetWithLogger.__init__(self, parent, logger) # start widget vbox = QVBoxLayout() vbox.setMargin(0) vbox.setContentsMargins(0, 0, 0, 0) # parameter action server topic selection topic_widget = QTopicWidget(self, 'vigir_footstep_planning_msgs/GetParameterSetNamesAction', True) vbox.addWidget(topic_widget) # parameter set selection self.parameter_set_selection_widget = QParameterSetSelectionWidget(self, logger) self.parameter_set_selection_widget.param_cleared_signal.connect(self.param_cleared) self.parameter_set_selection_widget.param_changed_signal.connect(self.param_changed) topic_widget.topic_changed_signal.connect(self.topic_changed) topic_widget.topic_changed_signal.connect(self.parameter_set_selection_widget.set_topic_name) vbox.addWidget(self.parameter_set_selection_widget) # end widget self.setLayout(vbox) # init widget topic_widget.emit_topic_name()
def setupUi(self): self._ui.setupUi(self) self._plot_layout = QVBoxLayout(self._ui.battery_profile_group_box) self._plot_widget = PlotWidget() self._plot_widget.setWindowTitle("Battery Profile") self._plot_widget.topic_edit.setText(self._battery_topic_name) self._plot_layout.addWidget(self._plot_widget) self._plot_widget.switch_data_plot_widget( FullSizeDataPlot(self._plot_widget)) self._ui.start_button.setEnabled(True) self._ui.stop_button.setEnabled(False)
def __init__(self, default_mcast_group, default_port, networks_count, parent=None): ''' Creates an input dialog. @param default_port: the default discovery port @type default_port: C{int} @param networks_count: the count of discovering ports @type networks_count: C{int} ''' QDialog.__init__(self, parent=parent) threading.Thread.__init__(self) self.default_port = default_port self.setObjectName('NetworkDiscoveryDialog') self.setAttribute(Qt.WA_DeleteOnClose, True) self.setWindowFlags(Qt.Window) self.setWindowTitle('Network Discovery') self.resize(728, 512) self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout.setContentsMargins(1, 1, 1, 1) self.display = QTextBrowser(self) self.display.setReadOnly(True) self.verticalLayout.addWidget(self.display) self.display_clear_signal.connect(self.display.clear) self.display_append_signal.connect(self.display.append) self.display.anchorClicked.connect(self.on_anchorClicked) self.status_label = QLabel('0 messages', self) self.verticalLayout.addWidget(self.status_label) self.status_text_signal.connect(self.status_label.setText) self._msg_counts = dict() self._networks_count = networks_count self._running = True self._received_msgs = 0 self._discovered = dict() self._hosts = dict() # resolution for hostname and address self.mutex = threading.RLock() self.sockets = [] with self.mutex: try: for p in range(networks_count): msock = DiscoverSocket(default_port + p, default_mcast_group) self.sockets.append(msock) msock.settimeout(self.TIMEOUT) except Exception as e: self.display.setText(utf8(e)) self.setDaemon(True) self.start()
def __init__(self, map_topic='/map', paths=['/move_base/SBPLLatticePlanner/plan', '/move_base/TrajectoryPlannerROS/local_plan'], polygons=['/move_base/local_costmap/robot_footprint']): super(NavViewWidget, self).__init__() self._layout = QVBoxLayout() self.setWindowTitle('Navigation Viewer') self._nav_view = NavView(map_topic, paths, polygons) self._layout.addWidget(self._nav_view) self.setLayout(self._layout)
def __init__(self, parent=None): super(PyQtGraphDataPlot, self).__init__(parent) self._plot_widget = PlotWidget() self._plot_widget.setBackground((255, 255, 255)) self._plot_widget.setXRange(0, 10, padding=0) vbox = QVBoxLayout() vbox.addWidget(self._plot_widget) self.setLayout(vbox) self._color_index = 0 self._curves = {}
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setWindowTitle('Select Binary') self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.content = QWidget() self.contentLayout = QFormLayout(self.content) self.contentLayout.setVerticalSpacing(0) self.verticalLayout.addWidget(self.content) self.packages = None package_label = QLabel("Package:", self.content) self.package_field = QComboBox(self.content) self.package_field.setInsertPolicy(QComboBox.InsertAlphabetically) self.package_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)) self.package_field.setEditable(True) self.contentLayout.addRow(package_label, self.package_field) binary_label = QLabel("Binary:", self.content) self.binary_field = QComboBox(self.content) # self.binary_field.setSizeAdjustPolicy(QComboBox.AdjustToContents) self.binary_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)) self.binary_field.setEditable(True) self.contentLayout.addRow(binary_label, self.binary_field) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.package_field.setFocus(Qt.TabFocusReason) self.package = '' self.binary = '' if self.packages is None: self.package_field.addItems(['packages searching...']) self.package_field.setCurrentIndex(0) self._fill_packages_thread = PackagesThread() self._fill_packages_thread.packages.connect(self._fill_packages) self._fill_packages_thread.start() self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) QMetaObject.connectSlotsByName(self) self.package_field.activated[str].connect(self.on_package_selected) if hasattr(self.package_field, "textChanged"): # qt compatibility self.package_field.textChanged.connect(self.on_package_selected) self.binary_field.textChanged.connect(self.on_binary_selected) else: self.package_field.editTextChanged.connect(self.on_package_selected) self.binary_field.editTextChanged.connect(self.on_binary_selected)
def __init__(self, parent=None): super(MatDataPlot, self).__init__(parent) self._canvas = MatDataPlot.Canvas() self._toolbar = NavigationToolbar(self._canvas, self._canvas) vbox = QVBoxLayout() vbox.addWidget(self._toolbar) vbox.addWidget(self._canvas) self.setLayout(vbox) self._curves = {} self._current_vline = None self._canvas.mpl_connect('button_release_event', self._limits_changed)
class PingGUI(Plugin): def __init__(self, context): super(PingGUI, self).__init__(context) # Give QObjects reasonable names self.setObjectName('PingGUI') self.msg = None # Create a container widget and give it a layout self._container = QWidget() self._layout = QVBoxLayout() self._container.setLayout(self._layout) self._label = QLabel("xx ms latency") p = self._label.palette() p.setColor(self._label.backgroundRole(), Qt.red) self._label.setPalette(p) self._layout.addWidget(self._label) self.set_bg_color(100, 100, 100) rospy.Subscriber("/ping/delay", Float64, self.ping_cb) context.add_widget(self._container) self._update_plot_timer = QTimer(self) self._update_plot_timer.timeout.connect(self.update_gui) self._update_plot_timer.start(1) def update_gui(self): if not self.msg: return msg = self.msg # msec # 100 -> green, 1000 -> red # normalize within 1000 ~ 100 orig_latency = msg.data msg_data = orig_latency if msg.data > 1000: msg_data = 1000 elif msg.data < 100: msg_data = 100 ratio = (msg_data - 100) / (1000 - 100) color_r = ratio * 255.0 color_g = (1 - ratio) * 255.0 # devnull = open(os.devnull, "w") # with RedirectStdStreams(stdout=devnull, stderr=devnull): self.set_bg_color(color_r, color_g, 0) self._label.setText("%d ms latency" % (orig_latency)) def set_bg_color(self, r, g, b): self._label.setStyleSheet("QLabel { display: block; background-color: rgba(%d, %d, %d, 255); text-align: center; font-size: 30px;}" % (r, g, b)) def ping_cb(self, msg): self.msg = msg def shutdown_plugin(self): pass def save_settings(self, plugin_settings, instance_settings): pass def restore_settings(self, plugin_settings, instance_settings): pass
def __init__(self): super(CalibrationMovementsGUI, self).__init__() self.handeye_client = HandeyeClient() self.current_target_pose = -1 # -1 is home self.target_poses = None self.plan_was_successful = None self.state = CalibrationMovementsGUI.NOT_INITED_YET self.layout = QVBoxLayout() self.labels_layout = QHBoxLayout() self.buttons_layout = QHBoxLayout() self.progress_bar = QProgressBar() self.pose_number_lbl = QLabel('0/0') self.bad_plan_lbl = QLabel('No plan yet') self.bad_plan_lbl.setAlignment(Qt.AlignCenter) self.guide_lbl = QLabel('Hello') self.guide_lbl.setWordWrap(True) self.check_start_pose_btn = QPushButton('Check starting pose') self.check_start_pose_btn.clicked.connect( self.handle_check_current_state) self.next_pose_btn = QPushButton('Next Pose') self.next_pose_btn.clicked.connect(self.handle_next_pose) self.plan_btn = QPushButton('Plan') self.plan_btn.clicked.connect(self.handle_plan) self.execute_btn = QPushButton('Execute') self.execute_btn.clicked.connect(self.handle_execute) self.labels_layout.addWidget(self.pose_number_lbl) self.labels_layout.addWidget(self.bad_plan_lbl) self.buttons_layout.addWidget(self.check_start_pose_btn) self.buttons_layout.addWidget(self.next_pose_btn) self.buttons_layout.addWidget(self.plan_btn) self.buttons_layout.addWidget(self.execute_btn) self.layout.addWidget(self.progress_bar) self.layout.addLayout(self.labels_layout) self.layout.addWidget(self.guide_lbl) self.layout.addLayout(self.buttons_layout) self.setLayout(self.layout) self.plan_btn.setEnabled(False) self.execute_btn.setEnabled(False) self.setWindowTitle('Local Mover') self.show()
def __init__(self, parent=None): super(PyQtGraphDataPlot, self).__init__(parent) self._plot_widget = PlotWidget() self._plot_widget.getPlotItem().addLegend() self._plot_widget.setBackground((255, 255, 255)) self._plot_widget.setXRange(0, 10, padding=0) vbox = QVBoxLayout() vbox.addWidget(self._plot_widget) self.setLayout(vbox) self._plot_widget.getPlotItem().sigRangeChanged.connect(self.limits_changed) self._curves = {} self._current_vline = None
def __init__(self, context): super(ImageSnapShotGUI, self).__init__(context) # Give QObjects reasonable names self.setObjectName('ImageSnapShotGUI') # Process standalone plugin command-line arguments from argparse import ArgumentParser parser = ArgumentParser() # Add argument(s) to the parser. parser.add_argument("-q", "--quiet", action="store_true", dest="quiet", help="Put plugin in silent mode") args, unknowns = parser.parse_known_args(context.argv()) self._toolbar = QToolBar() self._toolbar.addWidget(QLabel('ImageSnapShot')) # Create a container widget and give it a layout self._container = QWidget() self._layout = QVBoxLayout() self._container.setLayout(self._layout) self._layout.addWidget(self._toolbar) # Add a button for .... self._go_button = QPushButton('Head') self._go_button.clicked.connect(self._head) self._layout.addWidget(self._go_button) self._clear_button = QPushButton('Larm') self._clear_button.clicked.connect(self._larm) self._layout.addWidget(self._clear_button) self._clear_button = QPushButton('Rarm') self._clear_button.clicked.connect(self._rarm) self._layout.addWidget(self._clear_button) self._clear_button = QPushButton('L FishEye') self._clear_button.clicked.connect(self._lfisheye) self._layout.addWidget(self._clear_button) self._clear_button = QPushButton('R FishEye') self._clear_button.clicked.connect(self._rfisheye) self._layout.addWidget(self._clear_button) # self._step_run_button.setStyleSheet('QPushButton {color: black}') context.add_widget(self._container) self._head_pub = rospy.Publisher('/head_snap/snapshot', std_msgs.msg.Empty) self._lhand_pub = rospy.Publisher('/lhand_snap/snapshot', std_msgs.msg.Empty) self._rhand_pub = rospy.Publisher('/rhand_snap/snapshot', std_msgs.msg.Empty) self._lfisheye_pub = rospy.Publisher('/lfisheye_snap/snapshot', std_msgs.msg.Empty) self._rfisheye_pub = rospy.Publisher('/rfisheye_snap/snapshot', std_msgs.msg.Empty)
def setupUi(self): self._ui.setupUi(self) self._plot_layout = QVBoxLayout(self._ui.scan_angle_group_box) self._plot_widget = PlotWidget() self._plot_widget.setWindowTitle("Error") self._plot_layout.addWidget(self._plot_widget) self._plot_widget.switch_data_plot_widget(FullSizeDataPlot(self._plot_widget)) self._plot_widget.data_plot.dynamic_range = True self._plot_widget_live = PlotWidget() self._plot_widget_live.setWindowTitle("Live Graphs") self._plot_widget_live.switch_data_plot_widget(MatDataPlot(self._plot_widget_live)) self._plot_layout.addWidget(self._plot_widget_live) self._ui.start_button.setEnabled(True) self._ui.stop_button.setEnabled(False)
def __init__(self, ): super(LocalNavGUI, self).__init__() self.setObjectName("LocalNavGUI") self._widget = QWidget() ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'localnav_gui.ui') loadUi(ui_file, self._widget) l = QVBoxLayout(self) l.addWidget(self._widget) # set ROS subscriber #rospy.Subscriber("/SLAM/current_pose", Pose2D, self.currentPoseCallback) rospy.Subscriber("/localnav/sensor_data", PointCloud, self.sensorDataCallback) rospy.Subscriber("/localnav/objects", Object, self.objectCallback) # set UI stuff self._widget.map.setScene(QtGui.QGraphicsScene(self)) self.viewRect = self._widget.map.rect() self.mapHeight = self.viewRect.height() self.mapWidth = self.viewRect.width() self._widget.map.setSceneRect(QtCore.QRectF(self.viewRect)) self.scene = self._widget.map.scene() # link buttons to functions self._widget.buttonClear.clicked.connect(self.buttonClear) self._widget.checkGrid.stateChanged.connect(self.filterGrid) self._widget.checkAxis.stateChanged.connect(self.filterAxis) self._widget.checkRobot.stateChanged.connect(self.filterRobot) self._widget.checkOrientation.stateChanged.connect( self.filterOrientation) self._widget.checkPath.stateChanged.connect(self.filterPath) self._widget.checkSensorData.stateChanged.connect( self.filterSensorData) self._widget.checkObjects.stateChanged.connect(self.filterObjects) self._widget.checkObstacles.stateChanged.connect(self.filterObstacles) # subscribe to signals self.sigRedraw.connect(self.sigRedrawHandler) # launch thread that redraws the map at a set rate t_redraw = threading.Thread(target=self.threadRedraw) t_redraw.daemon = True t_redraw.start()
def setupUi(self, cmd_vel_topic_name): self._ui.setupUi(self) self._cmd_vel_topic_name = cmd_vel_topic_name self._plot_layout = QVBoxLayout(self._ui.battery_profile_group_box) self._plot_widget = PlotWidget() self._plot_widget.setWindowTitle("Battery Profile") self._plot_widget.topic_edit.setText(self._battery_topic_name) self._plot_layout.addWidget(self._plot_widget) self._data_plot = DataPlot(self._plot_widget) self._data_plot.set_autoscale(y=False) self._data_plot.set_ylim([0, 180]) self._plot_widget.switch_data_plot_widget(self._data_plot) self._ui.start_button.setEnabled(True) self._ui.stop_button.setEnabled(False)
def __init__(self, rospack): """""" super(ParameditWidget, self).__init__() ui_file = os.path.join(rospack.get_path('rqt_reconfigure'), 'resource', 'paramedit_pane.ui') loadUi(ui_file, self, {'ParameditWidget': ParameditWidget}) self._dynreconf_clients = OrderedDict() # Adding the list of Items self.vlayout = QVBoxLayout(self.scrollarea_holder_widget) #self._set_index_widgets(self.listview, paramitems_dict) # causes error self.destroyed.connect(self.close)
def __init__(self, context): super(LevelSelectorPlugin, self).__init__(context) # Give QObjects reasonable names self.setObjectName('LevelSelectorPlugin') # Create QWidget self._widget = QWidget() # self._widget.setFont(QFont("Times", 15, QFont.Bold)) self._button_layout = QVBoxLayout(self._widget) self.buttons = [] self.text_label = QLabel("Waiting for MultiLevelMapData...", self._widget) self._button_layout.addWidget(self.text_label) self._widget.setObjectName('LevelSelectorPluginUI') if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number())) context.add_widget(self._widget) self.connect(self._widget, SIGNAL("update_buttons"), self.update_buttons) self.connect(self._widget, SIGNAL("update_button_status"), self.update_button_status) # Subcribe to the multi level map data to get information about all the maps. self.multimap_subscriber = rospy.Subscriber("map_metadata", MultiLevelMapData, self.process_multimap) self.levels = [] self.current_level = None # Subscribe to the current level we are on. self.status_subscriber = None # Create a service proxy to change the current level. self.level_selector_proxy = rospy.ServiceProxy("level_mux/change_current_level", ChangeCurrentLevel) self.level_selector_proxy.wait_for_service()
def __init__(self, context): super(TriangleGUI, self).__init__(context) # Give QObjects reasonable names self.setObjectName('TriangleGUI') # Process standalone plugin command-line arguments from argparse import ArgumentParser parser = ArgumentParser() # Add argument(s) to the parser. parser.add_argument("-q", "--quiet", action="store_true", dest="quiet", help="Put plugin in silent mode") args, unknowns = parser.parse_known_args(context.argv()) self._toolbar = QToolBar() self._toolbar.addWidget(QLabel('Triangle')) # Create a container widget and give it a layout self._container = QWidget() self._layout = QVBoxLayout() self._container.setLayout(self._layout) self._layout.addWidget(self._toolbar) # Add a button for killing nodes self._go_button = QPushButton('Go') self._go_button.clicked.connect(self._go) self._layout.addWidget(self._go_button) self._clear_button = QPushButton('Clear') self._clear_button.clicked.connect(self._clear) self._layout.addWidget(self._clear_button) # self._step_run_button.setStyleSheet('QPushButton {color: black}') context.add_widget(self._container)
def __init__(self, camera_topic='/image_raw', name='camera'): super(CameraViewWidget, self).__init__() self._layout = QVBoxLayout() self.name = name self._colors = [(238, 34, 116), (68, 134, 252), (236, 228, 46), (102, 224, 18), (242, 156, 6), (240, 64, 10), (196, 30, 250)] self.setWindowTitle('Camera \'' + name + '\' Viewer') self._cam_view = CameraView(camera_topic) self._layout.addWidget(self._cam_view) self.setLayout(self._layout)
def __init__(self, parent=None, buffer_length=100, use_poly=True, no_legend=False): super(MatDataPlot3D, self).__init__(parent) self._canvas = MatDataPlot3D.Canvas() self._use_poly = use_poly self._buffer_length = buffer_length self._toolbar = NavigationToolbar(self._canvas, self._canvas) vbox = QVBoxLayout() vbox.addWidget(self._toolbar) vbox.addWidget(self._canvas) self.setLayout(vbox) self._curves_verts = {} self._color_index = 0 self._curves = {} self._no_legend = no_legend self._autoscroll = False
def __init__(self, context): super(MultiRobotPasserGUIPlugin, self).__init__(context) # Give QObjects reasonable names self.setObjectName('MultiRobotPasserGUIPlugin') # Create QWidget self.widget = QWidget() self.master_layout = QVBoxLayout(self.widget) self.buttons = {} self.button_layout = QHBoxLayout() self.master_layout.addLayout(self.button_layout) for button_text in ["Enable", "Disable"]: button = QPushButton(button_text, self.widget) button.clicked[bool].connect(self.handle_button) button.setCheckable(True) self.button_layout.addWidget(button) self.buttons[button_text] = button self.widget.setObjectName('MultiRobotPasserGUIPluginUI') if context.serial_number() > 1: self.widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number())) context.add_widget(self.widget) self.status_subscriber = rospy.Subscriber("status", Bool, self.status_callback) self.enable = rospy.ServiceProxy("enable", Empty) self.disable = rospy.ServiceProxy("disable", Empty) self.enabled = False self.connect(self.widget, SIGNAL("update"), self.update)
def __init__(self, options, title='Checkboxes', selected_indexes=[], parent=None): super(CheckBoxGroup, self).__init__() self.setTitle(title) self.setLayout(QVBoxLayout()) self._button_group = QButtonGroup() self._button_group.setExclusive(False) self._options = options if parent == None: parent = self for (button_id, option) in enumerate(self._options): checkbox = QCheckBox(option.get('title', 'option %d' % button_id)) checkbox.setEnabled(option.get('enabled', True)) checkbox.setChecked(button_id in selected_indexes) checkbox.setToolTip(option.get('tooltip', '')) self._button_group.addButton(checkbox, button_id) parent.layout().addWidget(checkbox) if 'description' in option: parent.layout().addWidget(QLabel(option['description']))
def __init__(self, popup_name): super(TopicPopupWidget, self).__init__() layout = QVBoxLayout() self.setLayout(layout) self.resize(640, 480) self.setObjectName(popup_name) self.setWindowTitle(popup_name)
def __init__(self, filenames, search_text='', parent=None): ''' @param filenames: a list with filenames. The last one will be activated. @type filenames: C{[str, ...]} @param search_text: if not empty, searches in new document for first occurrence of the given text @type search_text: C{str} (Default: C{Empty String}) ''' QMainWindow.__init__(self, parent) self.setObjectName('Editor - %s' % utf8(filenames)) self.setAttribute(Qt.WA_DeleteOnClose, True) self.setWindowFlags(Qt.Window) self.mIcon = QIcon(":/icons/crystal_clear_edit_launch.png") self._error_icon = QIcon(":/icons/crystal_clear_warning.png") self._empty_icon = QIcon() self.setWindowIcon(self.mIcon) window_title = "ROSLaunch Editor" if filenames: window_title = self.__getTabName(filenames[0]) self.setWindowTitle(window_title) self.init_filenames = list(filenames) self._search_thread = None # list with all open files self.files = [] # create tabs for files self.main_widget = QWidget(self) self.verticalLayout = QVBoxLayout(self.main_widget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setSpacing(1) self.verticalLayout.setObjectName("verticalLayout") self.tabWidget = EditorTabWidget(self) self.tabWidget.setTabPosition(QTabWidget.North) self.tabWidget.setDocumentMode(True) self.tabWidget.setTabsClosable(True) self.tabWidget.setMovable(False) self.tabWidget.setObjectName("tabWidget") self.tabWidget.tabCloseRequested.connect(self.on_close_tab) self.tabWidget.currentChanged.connect(self.on_tab_changed) self.verticalLayout.addWidget(self.tabWidget) self.buttons = self._create_buttons() self.verticalLayout.addWidget(self.buttons) self.setCentralWidget(self.main_widget) self.find_dialog = TextSearchFrame(self.tabWidget, self) self.find_dialog.search_result_signal.connect(self.on_search_result) self.find_dialog.replace_signal.connect(self.on_replace) self.addDockWidget(Qt.RightDockWidgetArea, self.find_dialog) self.graph_view = GraphViewWidget(self.tabWidget, self) self.graph_view.load_signal.connect(self.on_graph_load_file) self.graph_view.goto_signal.connect(self.on_graph_goto) self.addDockWidget(Qt.RightDockWidgetArea, self.graph_view) # open the files for f in filenames: if f: self.on_load_request(os.path.normpath(f), search_text) self.readSettings() self.find_dialog.setVisible(False) self.graph_view.setVisible(False)
def __init__(self, context): super(QuestionDialogPlugin, self).__init__(context) # Give QObjects reasonable names self.setObjectName('QuestionDialogPlugin') # Create QWidget self._widget = QWidget() self._widget.setFont(QFont("Times", 14, QFont.Bold)) self._layout = QVBoxLayout(self._widget) self._text_browser = QTextBrowser(self._widget) self._layout.addWidget(self._text_browser) self._button_layout = QHBoxLayout() self._layout.addLayout(self._button_layout) # layout = QVBoxLayout(self._widget) # layout.addWidget(self.button) self._widget.setObjectName('QuestionDialogPluginUI') if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number())) context.add_widget(self._widget) # Setup service provider self.service = rospy.Service('question_dialog', QuestionDialog, self.service_callback) self.response_ready = False self.response = None self.buttons = [] self.text_label = None self.text_input = None self.connect(self._widget, SIGNAL("update"), self.update) self.connect(self._widget, SIGNAL("timeout"), self.timeout)
def __init__(self, options, title='Exclusive Options', selected_index=None, parent=None): super(ExclusiveOptionGroup, self).__init__() self.setTitle(title) self.setLayout(QVBoxLayout()) self._button_group = QButtonGroup() self._button_group.setExclusive(True) self._options = options if parent == None: parent = self for (button_id, option) in enumerate(self._options): radio_button = QRadioButton( option.get('title', 'option %d' % button_id)) radio_button.setEnabled(option.get('enabled', True)) radio_button.setChecked( option.get('selected', False) or button_id == selected_index) radio_button.setToolTip(option.get('tooltip', '')) self._button_group.addButton(radio_button, button_id) parent.layout().addWidget(radio_button) if 'description' in option: parent.layout().addWidget(QLabel(option['description']))
def __init__(self,): super(LocalNavGUI, self).__init__() self.setObjectName("LocalNavGUI") self._widget = QWidget() ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'localnav_gui.ui') loadUi(ui_file, self._widget) l = QVBoxLayout(self) l.addWidget(self._widget) # set ROS subscriber #rospy.Subscriber("/SLAM/current_pose", Pose2D, self.currentPoseCallback) rospy.Subscriber("/localnav/sensor_data", PointCloud, self.sensorDataCallback) rospy.Subscriber("/localnav/objects", Object, self.objectCallback) # set UI stuff self._widget.map.setScene(QtGui.QGraphicsScene(self)) self.viewRect = self._widget.map.rect() self.mapHeight = self.viewRect.height() self.mapWidth = self.viewRect.width() self._widget.map.setSceneRect(QtCore.QRectF(self.viewRect)) self.scene = self._widget.map.scene() # link buttons to functions self._widget.buttonClear.clicked.connect(self.buttonClear) self._widget.checkGrid.stateChanged.connect(self.filterGrid) self._widget.checkAxis.stateChanged.connect(self.filterAxis) self._widget.checkRobot.stateChanged.connect(self.filterRobot) self._widget.checkOrientation.stateChanged.connect(self.filterOrientation) self._widget.checkPath.stateChanged.connect(self.filterPath) self._widget.checkSensorData.stateChanged.connect(self.filterSensorData) self._widget.checkObjects.stateChanged.connect(self.filterObjects) self._widget.checkObstacles.stateChanged.connect(self.filterObstacles) # subscribe to signals self.sigRedraw.connect(self.sigRedrawHandler) # launch thread that redraws the map at a set rate t_redraw = threading.Thread(target=self.threadRedraw) t_redraw.daemon = True t_redraw.start()
def __init__(self, context): super(RescueControlDialog, self).__init__(context) self.setObjectName('RescueControlDialog') self.joint_states_pub={} self._widget = QWidget() vbox = QVBoxLayout() #Add a Pushbutton for resetting the system state resetPushButton = QPushButton("Reset State") resetPushButton.pressed.connect(self.handleReset) self._syscommand_pub = rospy.Publisher('syscommand', String) vbox.addWidget(resetPushButton) #Add a Pushbutton for adding a victim in front of the robot and projecting it against the wall addVictimInFrontOfRobotPushButton = QPushButton("Add victim in front of robot") addVictimInFrontOfRobotPushButton.pressed.connect(self.on_add_victim_in_front_of_robot_pressed) vbox.addWidget(addVictimInFrontOfRobotPushButton) #add stretch at end so all GUI elements are at top of dialog vbox.addStretch(1) self._widget.setLayout(vbox) context.add_widget(self._widget)
def __init__(self, topic): super(RobotMonitor, self).__init__() self.setObjectName('Robot Monitor') self.top_items = [] layout = QVBoxLayout() self.err = QTreeWidget() self.err.setHeaderLabel("Errors") self.warn = QTreeWidget() self.warn.setHeaderLabel("Warnings") self.sig_clear.connect(self.clear) self.sig_err.connect(self.disp_err) self.sig_warn.connect(self.disp_warn) self.comp = QTreeWidget() self.comp.setHeaderLabel("All") self.comp.itemDoubleClicked.connect(self.tree_clicked) self.time = TimelineWidget(self) layout.addWidget(self.err) layout.addWidget(self.warn) layout.addWidget(self.comp, 1) layout.addWidget(self.time, 0) self.setLayout(layout) self.paused = False self.topic = topic self.sub = rospy.Subscriber(self.topic, DiagnosticArray, self.cb) self.setWindowTitle('Robot Monitor')
def __init__(self, context): super(BiasCalibrationDialog, self).__init__(context) self.setObjectName('BiasCalibrationDialog') self._widget = QWidget() vbox = QVBoxLayout() controller_widget = QWidget() hbox = QHBoxLayout() # Left to right layout self.joint_control = JointBias(self, roslib.packages.get_pkg_dir('vigir_rqt_bias_calibration') + '/launch/joints.txt',hbox) controller_widget.setLayout(hbox) self.marker = Marker() self.marker.header.frame_id = "/world" self.marker.type = self.marker.CUBE self.marker.action = self.marker.ADD self.marker.scale.x = 14.0 self.marker.scale.y = 14.0 self.marker.scale.z = 0.02 self.marker.color.a = 0.25 self.marker.color.r = 1.0 self.marker.color.g = 1.0 self.marker.color.b = 0.0 #self.marker.points = [[0.0, 0.0, 0.0], [7.0, -4.0, 0.0], [7.0, 4.0, 0.0]] self.marker.pose.orientation.w = 1.0 self.marker.pose.position.x = 0.0 self.marker.pose.position.y = 0.0 self.marker.pose.position.z = 0.0 self.bias_pub = rospy.Publisher('/flor/controller/atlas_biases', JointState, queue_size=10) self.flor_marker_pub = rospy.Publisher('/flor_plane_marker', Marker, queue_size=10) self.feet_state_sub = rospy.Subscriber('/atlas/atlas_sim_interface_state', AtlasSimInterfaceState, self.stateCallbackFnc) vbox.addWidget(controller_widget) self.save_button = QPushButton("Save Biases") self.save_button.pressed.connect(self.on_savePressed) vbox.addWidget(self.save_button) self._widget.setLayout(vbox) context.add_widget(self._widget)
def __init__(self, context): super(MotionEditorPlugin, self).__init__(context) self.setObjectName('MotionEditorPlugin') config_loader = RobotConfigLoader() try: robot_config_name = rospy.get_param('/motion_editor/robot_config') except KeyError: rospy.logwarn('Could not find robot config param in /motion_editor/robot_config. Using default config for ' 'Thor Mang.') robot_config_name = 'thor' config_loader.load_xml_by_name(robot_config_name + '_config.xml') motion_publishers = {} for target in config_loader.targets: motion_publishers[target.name] = MotionPublisher(config_loader.robot_config, target.joint_state_topic, target.publisher_prefix) input_output_selector = InputOutputSelectorWidget(motion_publishers) self._motion_editor = MotionEditorWidget(input_output_selector, config_loader.robot_config) position_editor = PositionEditorWidget(input_output_selector, config_loader.robot_config) position_editor.position_list_updated.connect(self._motion_editor.update_positions_lists) position_editor.position_list_updated.emit(position_editor._position_data) self._motion_editor.position_renamed.connect(position_editor.on_position_renamed) layout = QVBoxLayout() layout.addWidget(input_output_selector) layout.addWidget(position_editor) layout.addWidget(self._motion_editor) self._widget = QWidget() self._widget.setLayout(layout) context.add_widget(self._widget)
def beginGui(self, obj): self.parent = QScrollArea() self.frame = QFrame(self.parent) if obj.layout == "vertical": self.tl = QVBoxLayout() else: self.tl = QHBoxLayout() self.__increase_nesting_level(self.frame, self.tl)
def __init__(self, context): super(StableStepDialog, self).__init__(context) self.setObjectName('StableStepDialog') self.bdi_state_msg = AtlasSimInterfaceState() self.footstep_plan = rospy.Publisher('/flor/controller/footstep_plan',AtlasFootstepPlan, None, False, True, None, queue_size=10) self.bdi_state_sub = rospy.Subscriber("/atlas/atlas_sim_interface_state", AtlasSimInterfaceState, self.simStateCallback) self._widget = QWidget() vbox = QVBoxLayout() apply_command = QPushButton("Re-Center Steps") apply_command.clicked.connect(self.apply_command_callback) vbox.addWidget(apply_command) vbox.addStretch(1) self._widget.setLayout(vbox) context.add_widget(self._widget)
def setupUi(self): self._ui.setupUi(self) self._plot_layout = QVBoxLayout(self._ui.battery_profile_group_box) self._plot_widget = PlotWidget() self._plot_widget.setWindowTitle("Battery Profile") self._plot_widget.topic_edit.setText(self._battery_topic_name) self._plot_layout.addWidget(self._plot_widget) self._plot_widget.switch_data_plot_widget(FullSizeDataPlot(self._plot_widget)) self._ui.start_button.setEnabled(True) self._ui.stop_button.setEnabled(False)
class CameraViewWidget(QWidget): def __init__(self, camera_topic='/image_raw', name='camera'): super(CameraViewWidget,self).__init__() self._layout = QVBoxLayout() self.name = name self._colors = [(238, 34, 116), (68, 134, 252), (236, 228, 46), (102, 224, 18), (242, 156, 6), (240, 64, 10), (196, 30, 250)] self.setWindowTitle('Camera \''+name+'\' Viewer') self._cam_view = CameraView(camera_topic) self._layout.addWidget(self._cam_view) self.setLayout(self._layout) def close(self): if self._cam_view: self._cam_view.close()
def __init__(self): super(DataDialog, self).__init__() rp = rospkg.RosPack() uiFile = os.path.join(rp.get_path('my_topic_viewer'), 'resource', 'TopicViewer.ui') loadUi(uiFile, self) self._displayedData = None self._displayedName = None self._groupBox = QGroupBox() self._layout = QFormLayout() self._mainLayout = QVBoxLayout(); self._mainLayout.addWidget(self._groupBox)