Пример #1
0
    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):
        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()
Пример #3
0
    def restore_settings(self, settings):
        serial_number = settings.value('parent', None)
        #print 'DockWidget.restore_settings()', 'parent', serial_number, 'settings group', settings._group
        if serial_number is not None:
            serial_number = int(serial_number)
        if self._parent_container_serial_number(
        ) != serial_number and self._container_manager is not None:
            floating = self.isFloating()
            pos = self.pos()
            new_container = self._container_manager.get_container(
                serial_number)
            if new_container is not None:
                new_parent = new_container.main_window
            else:
                new_parent = self._container_manager.get_root_main_window()
            area = self.parent().dockWidgetArea(self)
            new_parent.addDockWidget(area, self)
            if floating:
                self.setFloating(floating)
                self.move(pos)

        title_bar = self.titleBarWidget()
        title_bar.restore_settings(settings)
        if title_bar.hide_title_bar and not self.features() & DockWidget.DockWidgetFloatable and \
                not self.features() & DockWidget.DockWidgetMovable:
            self._title_bar_backup = title_bar
            title_widget = QWidget(self)
            layout = QHBoxLayout(title_widget)
            layout.setContentsMargins(0, 0, 0, 0)
            title_widget.setLayout(layout)
            self.setTitleBarWidget(title_widget)
Пример #4
0
    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)
Пример #5
0
    def __init__(self, host, masteruri=None, parent=None):
        PackageDialog.__init__(self, parent)
        self.host = host
        self.setWindowTitle('Run')

        ns_name_label = QLabel("NS/Name:", self.content)
        self.ns_field = QComboBox(self.content)
        self.ns_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
        self.ns_field.setEditable(True)
        ns_history = nm.history().cachedParamValues('run_dialog/NS')
        ns_history.insert(0, '/')
        self.ns_field.addItems(ns_history)
        self.name_field = QLineEdit(self.content)
        self.name_field.setEnabled(False)
        horizontalLayout = QHBoxLayout()
        horizontalLayout.addWidget(self.ns_field)
        horizontalLayout.addWidget(self.name_field)
        self.contentLayout.addRow(ns_name_label, horizontalLayout)
        args_label = QLabel("Args:", self.content)
        self.args_field = QComboBox(self.content)
        self.args_field.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)
        self.args_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
        self.args_field.setEditable(True)
        self.contentLayout.addRow(args_label, self.args_field)
        args_history = nm.history().cachedParamValues('run_dialog/Args')
        args_history.insert(0, '')
        self.args_field.addItems(args_history)

        host_label = QLabel("Host:", self.content)
        self.host_field = QComboBox(self.content)
#    self.host_field.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        self.host_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
        self.host_field.setEditable(True)
        host_label.setBuddy(self.host_field)
        self.contentLayout.addRow(host_label, self.host_field)
        self.host_history = host_history = nm.history().cachedParamValues('/Host')
        if self.host in host_history:
            host_history.remove(self.host)
        host_history.insert(0, self.host)
        self.host_field.addItems(host_history)

        master_label = QLabel("ROS Master URI:", self.content)
        self.master_field = QComboBox(self.content)
        self.master_field.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
        self.master_field.setEditable(True)
        master_label.setBuddy(self.host_field)
        self.contentLayout.addRow(master_label, self.master_field)
        self.master_history = master_history = nm.history().cachedParamValues('/Optional Parameter/ROS Master URI')
        self.masteruri = "ROS_MASTER_URI" if masteruri is None else masteruri
        if self.masteruri in master_history:
            master_history.remove(self.masteruri)
        master_history.insert(0, self.masteruri)
        self.master_field.addItems(master_history)

#    self.package_field.setFocus(QtCore.Qt.TabFocusReason)
        if hasattr(self.package_field, "textChanged"):  # qt compatibility
            self.package_field.textChanged.connect(self.on_package_selected)
        else:
            self.package_field.editTextChanged.connect(self.on_package_selected)
        self.binary_field.activated[str].connect(self.on_binary_selected)
Пример #6
0
    def __init__(self, context):
        super(SpectrogramPlugin, self).__init__(context)
        self.setObjectName('Spectrogram')

        self._widget = QWidget()
        layout = QVBoxLayout()
        self._widget.setLayout(layout)

        layout_ = QHBoxLayout()
        self.line_edit = QLineEdit()
        layout_.addWidget(self.line_edit)
        self.apply_btn = QPushButton("Apply")
        self.apply_btn.clicked.connect(self.apply_clicked)
        layout_.addWidget(self.apply_btn)
        layout.addLayout(layout_)

        self.fig = Figure((5, 4), dpi=100)
        self.canvas = FigureCanvas(self.fig)
        self.axes = self.fig.add_subplot(111)
        self.fig.tight_layout()

        layout.addWidget(self.canvas)

        context.add_widget(self._widget)

        self.update_signal.connect(self.update_spectrogram)
        self.subscriber_signal.connect(self.update_subscriber)

        self.subscriber_signal.emit('spec')
Пример #7
0
    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)
Пример #8
0
    def __init__(self, parent=None):
        """Create a new, empty DataPlot

        This will raise a RuntimeError if none of the supported plotting
        backends can be found
        """
        super(DataPlot, self).__init__(parent)
        self._plot_index = 0
        self._color_index = 0
        self._markers_on = False
        self._autoscroll = True

        self._autoscale_x = True
        self._autoscale_y = DataPlot.SCALE_ALL

        # the backend widget that we're trying to hide/abstract
        self._data_plot_widget = None
        self._curves = {}
        self._vline = None
        self._redraw.connect(self._do_redraw)

        self._layout = QHBoxLayout()
        self.setLayout(self._layout)

        enabled_plot_types = [pt for pt in self.plot_types if pt['enabled']]
        if not enabled_plot_types:
            version_info = ' and PySide > 1.1.0' if QT_BINDING == 'pyside' else ''
            raise RuntimeError('No usable plot type found. Install at least one of: PyQtGraph, MatPlotLib (at least 1.1.0%s) or Python-Qwt5.' % version_info)

        self._switch_data_plot_widget(self._plot_index)

        self.show()
Пример #9
0
    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)
Пример #10
0
    def __init__(self, context, node=None):
        """
        This class is intended to be called by rqt plugin framework class.
        Currently (12/12/2012) the whole widget is splitted into 2 panes:
        one on left allows you to choose the node(s) you work on. Right side 
        pane lets you work with the parameters associated with the node(s) you
        select on the left.  
        """
        #TODO(Isaac) .ui file needs to replace the GUI components declaration
        #            below.

        super(ParamWidget, self).__init__()
        self.setObjectName(self._TITLE_PLUGIN)

        _hlayout_top = QHBoxLayout(self)
        self._splitter = QSplitter(self)
        _hlayout_top.addWidget(self._splitter)

        nodesel = NodeSelectorWidget()
        reconf_widget = ParameditWidget()

        self._splitter.insertWidget(0, nodesel)
        self._splitter.insertWidget(1, reconf_widget)

        nodesel.sig_node_selected.connect(reconf_widget.show_reconf)

        if node is not None:
            title = self._TITLE_PLUGIN + ' %s' % node
        else:
            title = self._TITLE_PLUGIN
        self.setObjectName(title)
    def __init__(self, parent=None, logger=Logger()):
        QWidgetWithLogger.__init__(self, parent, logger)

        # start widget
        hbox = QHBoxLayout()
        hbox.setMargin(0)
        hbox.setContentsMargins(0, 0, 0, 0)

        # get system icon
        icon = QIcon.fromTheme("view-refresh")
        size = icon.actualSize(QSize(32, 32))

        # add combo box
        self.parameter_set_names_combo_box = QComboBox()
        self.parameter_set_names_combo_box.currentIndexChanged[str].connect(
            self.param_changed)
        hbox.addWidget(self.parameter_set_names_combo_box)

        # add refresh button
        self.get_all_parameter_set_names_button = QPushButton()
        self.get_all_parameter_set_names_button.clicked.connect(
            self._get_all_parameter_set_names)

        self.get_all_parameter_set_names_button.setIcon(icon)
        self.get_all_parameter_set_names_button.setFixedSize(
            size.width() + 2,
            size.height() + 2)

        hbox.addWidget(self.get_all_parameter_set_names_button)

        # end widget
        self.setLayout(hbox)

        # init widget
        self.reset_parameter_set_selection()
Пример #12
0
 def _create_log_bar(self):
     self.log_dock = QDockWidget(self)
     self.log_dock.setObjectName('LogFrame')
     self.log_dock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable)
     self.log_bar = QWidget(self)
     self.horizontal_layout_log_bar = QHBoxLayout(self.log_bar)
     self.horizontal_layout_log_bar.setContentsMargins(2, 0, 2, 0)
     self.horizontal_layout_log_bar.setObjectName("horizontal_layout_log_bar")
     # add info label
     self._log_warning_count = 0
     self.log_browser = QTextEdit()
     self.log_browser.setObjectName("log_browser")
     self.log_browser.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     self.log_browser.setLineWrapMode(QTextEdit.NoWrap)
     # self.log_browser.setMaximumHeight(120)
     color = QColor(255, 255, 235)
     bg_style = "QTextEdit#log_browser { background-color: %s;}" % color.name()
     self.log_bar.setStyleSheet("%s" % (bg_style))
     self.horizontal_layout_log_bar.addWidget(self.log_browser)
     # add hide button
     self.clear_log_button = QPushButton("clear", self)
     self.clear_log_button.setObjectName("clear_log_button")
     self.clear_log_button.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum)
     self.clear_log_button.clicked.connect(self.on_clear_log_button_clicked)
     self.clear_log_button.setFlat(True)
     self.horizontal_layout_log_bar.addWidget(self.clear_log_button)
     self.log_dock.setWidget(self.log_bar)
     return self.log_dock
Пример #13
0
    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)
Пример #14
0
 def _create_buttons(self):
     # create the buttons line
     self.buttons = QWidget(self)
     self.horizontalLayout = QHBoxLayout(self.buttons)
     self.horizontalLayout.setContentsMargins(4, 0, 4, 0)
     self.horizontalLayout.setObjectName("horizontalLayout")
     # add the search button
     self.searchButton = QPushButton(self)
     self.searchButton.setObjectName("searchButton")
     #        self.searchButton.clicked.connect(self.on_shortcut_find)
     self.searchButton.toggled.connect(self.on_toggled_find)
     self.searchButton.setText(self._translate("&Find"))
     self.searchButton.setToolTip('Open a search dialog (Ctrl+F)')
     self.searchButton.setFlat(True)
     self.searchButton.setCheckable(True)
     self.horizontalLayout.addWidget(self.searchButton)
     # add the replace button
     self.replaceButton = QPushButton(self)
     self.replaceButton.setObjectName("replaceButton")
     #        self.replaceButton.clicked.connect(self.on_shortcut_replace)
     self.replaceButton.toggled.connect(self.on_toggled_replace)
     self.replaceButton.setText(self._translate("&Replace"))
     self.replaceButton.setToolTip('Open a search&replace dialog (Ctrl+R)')
     self.replaceButton.setFlat(True)
     self.replaceButton.setCheckable(True)
     self.horizontalLayout.addWidget(self.replaceButton)
     # add the goto button
     self.gotoButton = QPushButton(self)
     self.gotoButton.setObjectName("gotoButton")
     self.gotoButton.clicked.connect(self.on_shortcut_goto)
     self.gotoButton.setText(self._translate("&Goto line"))
     self.gotoButton.setShortcut("Ctrl+G")
     self.gotoButton.setToolTip('Open a goto dialog (Ctrl+G)')
     self.gotoButton.setFlat(True)
     self.horizontalLayout.addWidget(self.gotoButton)
     # add a tag button
     self.tagButton = self._create_tag_button(self)
     self.horizontalLayout.addWidget(self.tagButton)
     # add spacer
     spacerItem = QSpacerItem(515, 20, QSizePolicy.Expanding,
                              QSizePolicy.Minimum)
     self.horizontalLayout.addItem(spacerItem)
     # add line number label
     self.pos_label = QLabel()
     self.horizontalLayout.addWidget(self.pos_label)
     # add spacer
     spacerItem = QSpacerItem(515, 20, QSizePolicy.Expanding,
                              QSizePolicy.Minimum)
     self.horizontalLayout.addItem(spacerItem)
     # add save button
     self.saveButton = QPushButton(self)
     self.saveButton.setObjectName("saveButton")
     self.saveButton.clicked.connect(self.on_saveButton_clicked)
     self.saveButton.setText(self._translate("&Save"))
     self.saveButton.setShortcut("Ctrl+S")
     self.saveButton.setToolTip('Save the changes to the file (Ctrl+S)')
     self.saveButton.setFlat(True)
     self.horizontalLayout.addWidget(self.saveButton)
     return self.buttons
Пример #15
0
    def __init__(self, masteruri, cfg, ns, nodes, parent=None):
        QFrame.__init__(self, parent)
        self._masteruri = masteruri
        self._nodes = {cfg: {ns: nodes}}
        frame_layout = QVBoxLayout(self)
        frame_layout.setContentsMargins(0, 0, 0, 0)
        # create frame for warning label
        self.warning_frame = warning_frame = QFrame(self)
        warning_layout = QHBoxLayout(warning_frame)
        warning_layout.setContentsMargins(0, 0, 0, 0)
        warning_layout.addItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
        self.warning_label = QLabel()
        icon = nm.settings().icon('crystal_clear_warning.png')
        self.warning_label.setPixmap(icon.pixmap(QSize(40, 40)))
        self.warning_label.setToolTip(
            'Multiple configuration for same node found!\nA first one will be selected for the start a node!'
        )
        warning_layout.addWidget(self.warning_label)
        warning_layout.addItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
        frame_layout.addItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
        frame_layout.addWidget(warning_frame)
        # create frame for start/stop buttons
        buttons_frame = QFrame()
        buttons_layout = QHBoxLayout(buttons_frame)
        buttons_layout.setContentsMargins(0, 0, 0, 0)
        buttons_layout.addItem(QSpacerItem(20, 20))
        self.on_button = QPushButton()
        self.on_button.setFlat(False)
        self.on_button.setText("On")
        self.on_button.clicked.connect(self.on_on_clicked)
        buttons_layout.addWidget(self.on_button)

        self.off_button = QPushButton()
        self.off_button.setFlat(True)
        self.off_button.setText("Off")
        self.off_button.clicked.connect(self.on_off_clicked)
        buttons_layout.addWidget(self.off_button)
        buttons_layout.addItem(QSpacerItem(20, 20))
        frame_layout.addWidget(buttons_frame)
        frame_layout.addItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
        self.warning_frame.setVisible(False)
Пример #16
0
    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 initUI(self):
        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.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, subscribe=False):
        QWidget.__init__(self, parent)

        # start widget
        vbox = QVBoxLayout()
        vbox.setMargin(0)
        vbox.setContentsMargins(0, 0, 0, 0)

        # add error status text edit
        self.error_status_text_box = QErrorStatusTextBox()
        self.error_status_text_box_layout = QHBoxLayout()
        self.error_status_text_box_layout.addWidget(self.error_status_text_box)
        vbox.addLayout(self.error_status_text_box_layout)

        # add panel
        hbox = QHBoxLayout()

        # clear push button
        self.execute_command = QPushButton("Clear")
        self.execute_command.clicked.connect(self.error_status_text_box.clear)
        hbox.addWidget(self.execute_command)

        hbox.addStretch()

        # hide window checkbox
        hide_window_check_box = QCheckBox("Hide")
        hide_window_check_box.stateChanged.connect(self.state_changed)
        hbox.addWidget(hide_window_check_box)

        # end panel
        vbox.addLayout(hbox)

        # end widget
        self.setLayout(vbox)
        #self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)

        # subscriber
        if subscribe:
            self.error_status_sub = rospy.Subscriber("error_status", ErrorStatus, self.error_status_callback)
        self.subscribed = subscribe

        # connect signal slot internally to prevent crash by subscriber
        self.error_status_signal.connect(self.append_error_status)
Пример #19
0
    def beginGroup(self, obj):
        parent, layout = self.__get_immediate_parent()
        panel = QGroupBox(obj.name, parent)
        if obj.layout == "grid":
            l = QGridLayout()
        elif obj.layout == "vertical":
            l = QVBoxLayout()
        else:
            l = QHBoxLayout()

        self.__increase_nesting_level(panel, l)
def add_widget_with_frame(parent, widget, text=""):
    box_layout = QHBoxLayout()
    box_layout.addWidget(widget)

    group_box = QGroupBox()

    group_box.setStyleSheet(
        "QGroupBox { border: 1px solid gray; border-radius: 4px; margin-top: 0.5em; } QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; }"
    )
    group_box.setTitle(text)
    group_box.setLayout(box_layout)

    parent.addWidget(group_box)
Пример #21
0
def create_label_textedit_pair(key, value):

    param_layout = QHBoxLayout()

    name_widget = QLabel(key)
    textedit_widget = QTextEdit()
    textedit_widget.setSizePolicy(QSizePolicy.MinimumExpanding,
                                  QSizePolicy.Ignored)
    textedit_widget.setMinimumSize(0, 30)
    textedit_widget.append(str(value))

    param_layout.addWidget(name_widget)
    param_layout.addWidget(textedit_widget)

    return param_layout
Пример #22
0
 def __init__(self, path, parent=None):
     QWidget.__init__(self, parent)
     self.path = path
     self._layout = QHBoxLayout(self)
     self._layout.setContentsMargins(0, 0, 0, 0)
     self._layout.setSpacing(0)
     self._button = QPushButton('...')
     self._button.setMaximumSize(QSize(24, 20))
     self._button.clicked.connect(self._on_path_select_clicked)
     self._layout.addWidget(self._button)
     self._lineedit = QLineEdit(path)
     self._lineedit.returnPressed.connect(self._on_editing_finished)
     self._layout.addWidget(self._lineedit)
     self.setLayout(self._layout)
     self.setFocusProxy(self._button)
     self.setAutoFillBackground(True)
Пример #23
0
 def __init__(self,
              nodename,
              masteruri,
              loggername,
              level='INFO',
              parent=None):
     '''
     Creates a new item.
     '''
     QFrame.__init__(self, parent)
     self.setObjectName("LoggerItem")
     self.nodename = nodename
     self.masteruri = masteruri
     self.loggername = loggername
     self.current_level = None
     layout = QHBoxLayout(self)
     layout.setContentsMargins(1, 1, 1, 1)
     self.debug = QRadioButton()
     self.debug.setStyleSheet(
         "QRadioButton{ background-color: #39B54A;}")  # QColor(57, 181, 74)
     self.debug.toggled.connect(self.toggled_debug)
     layout.addWidget(self.debug)
     self.info = QRadioButton()
     self.info.setStyleSheet("QRadioButton{ background-color: #FFFAFA;}")
     self.info.toggled.connect(self.toggled_info)
     layout.addWidget(self.info)
     self.warn = QRadioButton()
     self.warn.setStyleSheet(
         "QRadioButton{ background-color: #FFC706;}")  # QColor(255, 199, 6)
     self.warn.toggled.connect(self.toggled_warn)
     layout.addWidget(self.warn)
     self.error = QRadioButton()
     self.error.setStyleSheet(
         "QRadioButton{ background-color: #DE382B;}")  # QColor(222, 56, 43)
     self.error.toggled.connect(self.toggled_error)
     layout.addWidget(self.error)
     self.fatal = QRadioButton()
     self.fatal.setStyleSheet("QRadioButton{ background-color: #FF0000;}")
     self.fatal.toggled.connect(self.toggled_fatal)
     layout.addWidget(self.fatal)
     self.label = QLabel(loggername)
     layout.addWidget(self.label)
     layout.addStretch()
     self._callback = None  # used to set all logger
     self.success_signal.connect(self.on_succes_update)
     self.error_signal.connect(self.on_error_update)
     self.set_level(level)
    def __init__(self, editor, *args):
        QFrame.__init__(self, *args)

        self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
        self.edit = editor

        self.number_bar = self.NumberBar()
        self.number_bar.set_text_edit(self.edit)

        hbox = QHBoxLayout(self)
        hbox.setSpacing(0)
        # hbox.setMargin(0) # removed: it is not supported by Qt5
        hbox.addWidget(self.number_bar)
        hbox.addWidget(self.edit)

        self.edit.installEventFilter(self)
        self.edit.viewport().installEventFilter(self)
 def _create_replace_frame(self):
     # create frame with replace row
     self.rplc_frame = rplc_frame = QFrame(self)
     rplc_hbox_layout = QHBoxLayout(rplc_frame)
     rplc_hbox_layout.setContentsMargins(0, 0, 0, 0)
     rplc_hbox_layout.setSpacing(1)
     self.replace_field = EnchancedLineEdit(rplc_frame)
     self.replace_field.setPlaceholderText('replace text')
     self.replace_field.returnPressed.connect(self.on_replace)
     rplc_hbox_layout.addWidget(self.replace_field)
     self.replace_result_label = QLabel(rplc_frame)
     self.replace_result_label.setText(' ')
     rplc_hbox_layout.addWidget(self.replace_result_label)
     self.replace_button = replace_button = QPushButton("> &Replace >")
     replace_button.setFixedWidth(90)
     replace_button.clicked.connect(self.on_replace_click)
     rplc_hbox_layout.addWidget(replace_button)
     rplc_frame.setVisible(False)
     return rplc_frame
    def __init__(self, parent=None, topic_type=str(), is_action_topic=False):
        QWidget.__init__(self, parent)

        if is_action_topic:
            self.topic_type = topic_type + "Goal"
        else:
            self.topic_type = topic_type
        self.is_action_topic = is_action_topic

        # start widget
        hbox = QHBoxLayout()
        hbox.setMargin(0)
        hbox.setContentsMargins(0, 0, 0, 0)

        # topic combo box
        self.topic_combo_box = QComboBox()
        self.topic_combo_box.setEnabled(False)
        self.topic_combo_box.blockSignals(True)
        self.topic_combo_box.setValidator(
            QRegExpValidator(QRegExp('((\d|\w|/)(?!//))*'), self))
        self.topic_combo_box.currentIndexChanged[str].connect(
            self.topic_changed)
        hbox.addWidget(self.topic_combo_box)

        # get system icon
        icon = QIcon.fromTheme("view-refresh")
        size = icon.actualSize(QSize(32, 32))

        # add refresh button
        refresh_topics_button = QPushButton()
        refresh_topics_button.clicked.connect(self.update_topic_list)
        refresh_topics_button.setIcon(icon)
        refresh_topics_button.setFixedSize(size.width() + 2, size.height() + 2)
        hbox.addWidget(refresh_topics_button)

        # end widget
        self.setLayout(hbox)

        # init widget
        self.update_topic_list()
Пример #27
0
    def _update_item(self):
        widget_layout = self.arg_ver_layout
        item_list = self.params_list

        widget_list = widget_layout.parentWidget().children()
        while len(widget_list) > 2:
            added_arg_widget = widget_list.pop()
            widget_layout.removeWidget(added_arg_widget)
            added_arg_widget.setParent(None)
            added_arg_widget.deleteLater()

        #resize
        dialog_widget = widget_layout.parentWidget().parentWidget()
        dialog_widget.resize(dialog_widget.minimumSize())
        for l in item_list:
            params_hor_sub_widget = QWidget()
            params_hor_layout = QHBoxLayout(params_hor_sub_widget)
            for k in l:
                param_name = k[0]
                param_type = k[2]
                name_widget = QLabel(param_name + ": ")
                if param_type == 'string' or param_type == 'int':
                    k[1] = QTextEdit()
                    k[1].setSizePolicy(QSizePolicy.MinimumExpanding,
                                       QSizePolicy.Ignored)
                    k[1].setMinimumSize(0, 30)
                    k[1].append("")
                elif param_type == 'bool':
                    k[1] = QTextEdit()
                    k[1] = QComboBox()
                    k[1].setSizePolicy(QSizePolicy.MinimumExpanding,
                                       QSizePolicy.Ignored)
                    k[1].setMinimumSize(0, 30)

                    k[1].addItem("True", True)
                    k[1].addItem("False", False)

                params_hor_layout.addWidget(name_widget)
                params_hor_layout.addWidget(k[1])
            widget_layout.addWidget(params_hor_sub_widget)
Пример #28
0
    def _create_layout(self):
        name_hor_sub_widget = QWidget()
        name_hor_layout = QHBoxLayout(name_hor_sub_widget)

        name_widget = QLabel(self.name + ": ")
        name_hor_layout.addWidget(name_widget)
        if self.add == True:
            btn_add = QPushButton("+", name_hor_sub_widget)

            btn_add.clicked.connect(self._push_param)
            btn_add.clicked.connect(self._update_item)
            name_hor_layout.addWidget(btn_add)

            btn_subtract = QPushButton("-", name_hor_sub_widget)
            btn_subtract.clicked.connect(self._pop_param)
            btn_subtract.clicked.connect(self._update_item)
            name_hor_layout.addWidget(btn_subtract)
            pass

        self.arg_ver_layout.addWidget(name_hor_sub_widget)
        self.dlg_layout.addWidget(self.arg_ver_sub_widget)
        self._update_item()
 def _create_find_frame(self):
     find_frame = QFrame(self)
     find_hbox_layout = QHBoxLayout(find_frame)
     find_hbox_layout.setContentsMargins(0, 0, 0, 0)
     find_hbox_layout.setSpacing(1)
     self.search_field = EnchancedLineEdit(find_frame)
     self.search_field.setPlaceholderText('search text')
     self.search_field.textChanged.connect(self.on_search_text_changed)
     self.search_field.returnPressed.connect(self.on_search)
     find_hbox_layout.addWidget(self.search_field)
     self.search_result_label = QLabel(find_frame)
     self.search_result_label.setText(' ')
     find_hbox_layout.addWidget(self.search_result_label)
     self.find_button_back = QPushButton("<")
     self.find_button_back.setFixedWidth(44)
     self.find_button_back.clicked.connect(self.on_search_back)
     find_hbox_layout.addWidget(self.find_button_back)
     self.find_button = QPushButton(">")
     self.find_button.setDefault(True)
     # self.find_button.setFlat(True)
     self.find_button.setFixedWidth(44)
     self.find_button.clicked.connect(self.on_search)
     find_hbox_layout.addWidget(self.find_button)
     return find_frame
    def __init__(self, parent=None):
        super(VisualizerWidget, self).__init__(parent)
        self.setWindowTitle('Graph Profiler Visualizer')
        vbox = QVBoxLayout()
        self.setLayout(vbox)

        toolbar_layout = QHBoxLayout()
        refresh_button = QPushButton()
        refresh_button.setIcon(QIcon.fromTheme('view-refresh'))
        auto_refresh_checkbox = QCheckBox("Auto Refresh")
        hide_disconnected_topics = QCheckBox("Hide Disconnected Topics")
        topic_blacklist_button = QPushButton("Topic Blacklist")
        node_blacklist_button = QPushButton("Node Blacklist")

        refresh_button.clicked.connect(self._refresh)
        topic_blacklist_button.clicked.connect(self._edit_topic_blacklist)
        node_blacklist_button.clicked.connect(self._edit_node_blacklist)
        auto_refresh_checkbox.setCheckState(2)
        auto_refresh_checkbox.stateChanged.connect(self._autorefresh_changed)
        hide_disconnected_topics.setCheckState(2)
        hide_disconnected_topics.stateChanged.connect(self._hidedisconnectedtopics_changed)

        toolbar_layout.addWidget(refresh_button)
        toolbar_layout.addWidget(auto_refresh_checkbox)
        toolbar_layout.addStretch(0)
        toolbar_layout.addWidget(hide_disconnected_topics)
        toolbar_layout.addWidget(topic_blacklist_button)
        toolbar_layout.addWidget(node_blacklist_button)
        vbox.addLayout(toolbar_layout)

        # Initialize the Visualizer
        self._view = qt_view.QtView()
        self._adapter = rosprofiler_adapter.ROSProfileAdapter(self._view)
        self._adapter.set_topic_quiet_list(TOPIC_BLACKLIST)
        self._adapter.set_node_quiet_list(NODE_BLACKLIST)
        vbox.addWidget(self._view)