def __init__(self, parent): super(NodeSelection, self).__init__() self.parent_widget = parent self.selected_nodes = [] self.setWindowTitle("Select the nodes you want to record") self.resize(300, 300) self.area = QScrollArea(self) self.main_widget = QWidget(self.area) self.ok_button = QPushButton("Done", 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.node_list = rosnode.get_node_names() self.node_list.sort() for node in self.node_list: # add planner node by choosing agent number if "planner" not in node: self.addCheckBox(node) self.main_widget.setLayout(self.selection_vlayout) self.area.setWidget(self.main_widget) self.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 __init__(self): super(GroundStationWidget, self).__init__() self._principle_layout = QBoxLayout(0) # main layout is horizontal (0) self._principle_layout = QSplitter(Qt.Horizontal) self._map_layout = QVBoxLayout() map_widget = QWidget() map_widget.setLayout(self._map_layout) self._principle_layout.addWidget(map_widget) self._control_layout = QVBoxLayout() control_widget = QWidget() control_widget.setLayout(self._control_layout) self._principle_layout.addWidget(control_widget) self.setAcceptDrops(False) # Dragging and Dropping not permitted self.setWindowTitle('ROSplane Ground Station') #============================= self._mw = MapWindow() self._map_layout.addWidget(self._mw) self._tv = PlotWidget() self._data_plot = DataPlot(self._tv) self._data_plot.set_autoscale(x=False) self._data_plot.set_autoscale(y=DataPlot.SCALE_EXTEND | DataPlot.SCALE_VISIBLE) self._data_plot.set_xlim([0, 10.0]) self._tv.switch_data_plot_widget(self._data_plot) self._control_layout.addWidget( self._tv, 1) # ratio of these numbers determines window proportions self._ah = ArtificialHorizon() self._control_layout.addWidget(self._ah, 1) #============================= print('fake init') total_layout = QBoxLayout(QBoxLayout.TopToBottom) self._principle_layout.setHandleWidth(8) total_layout.addWidget(self._principle_layout) self.setLayout(total_layout) # Global timer for marble_map and artificial_horizon self.interval = 100 # in milliseconds, period of regular update self.timer = QTimer(self) self.timer.setInterval(self.interval) self.timer.timeout.connect(self._mw._marble_map.update) self.timer.timeout.connect(self._ah.update) self.timer.start()
def __init__(self): super(StringLabelWidget, self).__init__() self.lock = Lock() vbox = QVBoxLayout(self) self.label = QLabel() self.label.setAlignment(Qt.AlignLeft) self.label.setSizePolicy( QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)) font = QFont("Helvetica", 14) self.label.setFont(font) self.label.setWordWrap(True) vbox.addWidget(self.label) self.string_sub = None self._string_topics = [] self._update_topic_timer = QTimer(self) self._update_topic_timer.timeout.connect(self.updateTopics) self._update_topic_timer.start(1000) self._active_topic = None # to update label visualization self._dialog = LineEditDialog() self._rosdata = None self._start_time = rospy.get_time() self._update_label_timer = QTimer(self) self._update_label_timer.timeout.connect(self.updateLabel) self._update_label_timer.start(40)
def __init__(self, context, pub, human_pub, pub_processed_inputs, record_pub, pub_end_motion): super(MainWindow, self).__init__() rp = rospkg.RosPack() ui_file = os.path.join(rp.get_path('rqt_franka'), 'resource', 'main.ui') loadUi(ui_file, self) self.pub = pub self.human_pub = human_pub self.pub_processed_inputs = pub_processed_inputs self.record_pub = record_pub self.pub_end_motion = pub_end_motion self.active = False self.kb_interface = RdfManager() self.add_skill() self.windows.setCurrentIndex(0) btn = Button("Send command", self.handle_send_command_clicked) vbox = QVBoxLayout() vbox.addWidget(btn) self.command_actions.setLayout(vbox) self.teach_button.clicked.connect(self.handle_teach_clicked) self.step_done_button.clicked.connect(self.handle_done_clicked) self.execute_button.clicked.connect(lambda: self.handle_execute_clicked("Assemble", "Tool")) self.skill_tree.clicked.connect(self.handle_action_clicked)
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): super(ImageView2Widget, self).__init__() self.left_button_clicked = False self.repaint_trigger.connect(self.redraw) self.lock = Lock() self.need_to_rewrite = False self.bridge = CvBridge() self.image_sub = None self.event_pub = None self.label = ScaledLabel() self.label.setAlignment(Qt.AlignCenter) self.label.setSizePolicy( QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)) # self.label.installEventFilter(self) vbox = QVBoxLayout(self) vbox.addWidget(self.label) self.setLayout(vbox) self._image_topics = [] self._update_topic_thread = Thread(target=self.updateTopics) self._update_topic_thread.start() self._active_topic = None self.setMouseTracking(True) self.label.setMouseTracking(True) self._dialog = ComboBoxDialog() self.show()
def __init__(self, updater, config, nodename): """ :param config: :type config: Dictionary? defined in dynamic_reconfigure.client.Client :type nodename: str """ super(GroupWidget, self).__init__() self.state = config['state'] self.param_name = config['name'] self._toplevel_treenode_name = nodename # TODO: .ui file needs to be back into usage in later phase. # ui_file = os.path.join(rp.get_path('rqt_reconfigure'), # 'resource', 'singlenode_parameditor.ui') # loadUi(ui_file, self) verticalLayout = QVBoxLayout(self) verticalLayout.setContentsMargins(QMargins(0, 0, 0, 0)) _widget_nodeheader = QWidget() _h_layout_nodeheader = QHBoxLayout(_widget_nodeheader) _h_layout_nodeheader.setContentsMargins(QMargins(0, 0, 0, 0)) self.nodename_qlabel = QLabel(self) font = QFont('Trebuchet MS, Bold') font.setUnderline(True) font.setBold(True) # Button to close a node. _icon_disable_node = QIcon.fromTheme('window-close') _bt_disable_node = QPushButton(_icon_disable_node, '', self) _bt_disable_node.setToolTip('Hide this node') _bt_disable_node_size = QSize(36, 24) _bt_disable_node.setFixedSize(_bt_disable_node_size) _bt_disable_node.pressed.connect(self._node_disable_bt_clicked) _h_layout_nodeheader.addWidget(self.nodename_qlabel) _h_layout_nodeheader.addWidget(_bt_disable_node) self.nodename_qlabel.setAlignment(Qt.AlignCenter) font.setPointSize(10) self.nodename_qlabel.setFont(font) grid_widget = QWidget(self) self.grid = QFormLayout(grid_widget) verticalLayout.addWidget(_widget_nodeheader) verticalLayout.addWidget(grid_widget, 1) # Again, these UI operation above needs to happen in .ui file. self.tab_bar = None # Every group can have one tab bar self.tab_bar_shown = False self.updater = updater self.editor_widgets = [] self._param_names = [] self._create_node_widgets(config) logging.debug('Groups node name={}'.format(nodename)) self.nodename_qlabel.setText(nodename)
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 __init__(self, parent=None): super(PlotWidget, self).__init__(parent) # create widgets self.canvas = PlotCanvas() vbox = QVBoxLayout() vbox.addWidget(self.canvas) self.setLayout(vbox)
def __init__(self, map_topic='/map', paths=None, polygons=None): super(NavViewWidget, self).__init__() if paths is None: paths = [ '/move_base/NavFn/plan', '/move_base/TrajectoryPlannerROS/local_plan' ] if polygons is None: polygons = ['/move_base/local_costmap/robot_footprint'] self._layout = QVBoxLayout() self._button_layout = QHBoxLayout() self.setAcceptDrops(True) self.setWindowTitle('Navigation Viewer') self.paths = paths self.polygons = polygons self.map_topic = map_topic self._tf = tf.TransformListener() self._set_pose = QPushButton('Set Pose') self._set_goal = QPushButton('Set Goal') self._button_layout.addWidget(self._set_pose) self._button_layout.addWidget(self._set_goal) self._layout.addLayout(self._button_layout) self._nav_view = None self.setLayout(self._layout)
def __init__(self, context): ''' Initialie the PID tuner Parameters: N/A Returns: N/A ''' #Initialize with qt_gui plugin for ros super(PID_Tuner, self).__init__(context) self.layout = QVBoxLayout() self._widget = QWidget() self._widget.setLayout(self.layout) #Import a generic pid tunning widget for each pid controller self.velocity_pid_tuner_widget = PID_Tuner_Generic_Widget() self.steering_pid_tuner_widget = PID_Tuner_Generic_Widget() self.pid_tuner_widgets = [ self.velocity_pid_tuner_widget, self.steering_pid_tuner_widget ] #Add button for sending the gains self.update_gains_btn = QPushButton("Update Gains") self.update_gains_btn.clicked.connect(self._update_gains) #Add the pid tuners to a layout for pid_tuner_widget in self.pid_tuner_widgets: self.layout.addWidget(pid_tuner_widget) self.layout.addWidget(self.update_gains_btn) context.add_widget(self._widget)
def __init__(self, aircraft_id): super(ChecklistWindow, self).__init__() # Set properties of the window self.setWindowTitle("BTO and BPO Checklist") self.resize(500, 700) self.move(200,100) self.checklist_state = 0 # Relative path for the default BPO and BTO checklist BPO_checklist_file = os.path.join(rospkg.RosPack().get_path('yonah_rqt'), 'src/yonah_rqt', 'BPO_checklist.csv') BTO_checklist_file = os.path.join(rospkg.RosPack().get_path('yonah_rqt'), 'src/yonah_rqt', 'BTO_checklist.csv') # Check whether checklist is present, if not print a error message to terminal try: # If checklist is present, parse it and pass it to its respective variable self.BPO_checklist = self.excel_parser(BPO_checklist_file) self.BTO_checklist = self.excel_parser(BTO_checklist_file) except: rospy.logerr("Checklist files are missing or named wrongly. Please follow the original directory and naming") exit() # Create the layout self.main_layout = QVBoxLayout() self.buttons_layout = QHBoxLayout() self.tree_widget_layout = QHBoxLayout() # Create the widgets self.create_widget() self.has_message_opened = 0 # Add the widgets into the layouts self.main_layout.addLayout(self.tree_widget_layout) self.main_layout.addLayout(self.buttons_layout) self.setLayout(self.main_layout)
def __init__(self, node): super(Network, self).__init__() layout = QVBoxLayout(self) self.static_canvas = FigureCanvas(Figure(figsize=(5, 3))) layout.addWidget(self.static_canvas) self.ax = self.static_canvas.figure.subplots() self.ax.axis('off') # t = np.linspace(0, 10, 501) # self.ax.plot(t, np.sin(t), ".") # # Create QWidget # # ui_file = os.path.join(rospkg.RosPack().get_path('rqt_dot'), 'resource', 'rqt_dot.ui') # _, package_path = get_resource('packages', 'rqt_dot') # ui_file = os.path.join(package_path, 'share', 'rqt_dot', 'resource', 'rqt_dot.ui') # loadUi(ui_file, self, {'DotWidget':DotWidget}) # self.setObjectName('ROSDot') # # self.refreshButton.clicked[bool].connect(self._handle_refresh_clicked) # self.saveButton.clicked[bool].connect(self._handle_save_button_clicked) # # # flag used to zoom out to fit graph the first time it's received # self.first_time_graph_received = True # # to store the graph msg received in callback, later on is used to save the graph if needed # self.graph = None self.topic_name = 'graph_string' self._node = node self._node.create_subscription(String, self.topic_name, self.ReceivedCallback, 10)
def add_config(self, title, choices, single_choice=True): ''' create a UI element for selecting options for one variation and put it in a scrollArea ''' scroll = QScrollArea() group_box = QGroupBox(title) group_box.setFlat(True) layout = QVBoxLayout() if len(choices) > 5 and single_choice: combo_box = QComboBox(group_box) for obj in choices: combo_box.addItem(obj) layout.addWidget(combo_box) else: for obj in choices: if single_choice: layout.addWidget(QRadioButton(obj, group_box)) else: layout.addWidget(QCheckBox(obj, group_box)) layout.addStretch(1) group_box.setLayout(layout) scroll.setWidget(group_box) scroll.setWidgetResizable(True) return group_box, scroll
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 motor_controller(self): ''' Sets up the GUI in the middle of the Screen to control the motors. Uses self._motorValues to determine which motors are present. ''' i = 0 for k, v in sorted(self._currentGoals.items()): group = QGroupBox() slider = QSlider(Qt.Horizontal) slider.setTickInterval(1) slider.setMinimum(-181) slider.setMaximum(181) slider.valueChanged.connect(self.slider_update) self._sliders[k] = slider textfield = QLineEdit() textfield.setText('0') textfield.textEdited.connect(self.textfield_update) self._textFields[k] = textfield label = QLabel() label.setText(k) layout = QVBoxLayout() layout.addWidget(label) layout.addWidget(self._sliders[k]) layout.addWidget(self._textFields[k]) group.setLayout(layout) self._widget.motorControlLayout.addWidget(group, i / 5, i % 5) i = i+1
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, 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 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(SpectrogramPlugin, self).__init__(context) self.setObjectName('Spectrogram') sns.set(style="whitegrid", palette="bright", color_codes=True) self._widget = QWidget() layout = QVBoxLayout() self._widget.setLayout(layout) layout_ = QHBoxLayout() self.lbl_topic = QLabel('Topic:') layout_.addWidget(self.lbl_topic) self.le_topic = QLineEdit() layout_.addWidget(self.le_topic) self.apply_topic = QPushButton("Apply") self.apply_topic.clicked.connect(self.apply_clicked_topic) layout_.addWidget(self.apply_topic) layout.addLayout(layout_) layout_ = QHBoxLayout() self.lbl_lcf = QLabel('Low-cut Freq.[Hz]:') layout_.addWidget(self.lbl_lcf) self.spb_lcf = QSpinBox() self.spb_lcf.setRange(0, 50) self.spb_lcf.setValue(0) layout_.addWidget(self.spb_lcf) self.apply_lcf = QPushButton("Apply") self.apply_lcf.clicked.connect(self.apply_clicked_lcf) layout_.addWidget(self.apply_lcf) layout.addLayout(layout_) layout_ = QHBoxLayout() self.lbl_hcf = QLabel('High-cut Freq.[Hz]:') layout_.addWidget(self.lbl_hcf) self.spb_hcf = QSpinBox() self.spb_hcf.setRange(50, self.vib_freq / 2) self.spb_hcf.setValue(self.vib_freq / 2) layout_.addWidget(self.spb_hcf) self.apply_hcf = QPushButton("Apply") self.apply_hcf.clicked.connect(self.apply_clicked_hcf) layout_.addWidget(self.apply_hcf) layout.addLayout(layout_) #self.fig, self.axes = plt.subplots(2, 1, sharex=True) self.fig = plt.figure() self.ax = self.fig.add_subplot(1, 1, 1) self.canvas = FigureCanvas(self.fig) 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('spectrum')
def __init__(self, parent=None): super(OperationSelectorWidget, self).__init__() self.parent = parent self.setTitle('Select Value') self.layout = QVBoxLayout() self.initRadioButtons() self._currentSelected = '' self.setLayout(self.layout)
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 __init__(self, parent=None): super(ComboBoxDialog, self).__init__() self.number = 0 vbox = QVBoxLayout(self) self.combo_box = QComboBox(self) self.combo_box.activated.connect(self.onActivated) vbox.addWidget(self.combo_box) button = QPushButton() button.setText("Done") button.clicked.connect(self.buttonCallback) vbox.addWidget(button) self.setLayout(vbox)
def __init__(self, popup_name, timeline, viewer_type, topic): super(TopicPopupWidget, self).__init__() self.setObjectName(popup_name) self.setWindowTitle(popup_name) layout = QVBoxLayout() self.setLayout(layout) self._timeline = timeline self._viewer_type = viewer_type self._topic = topic self._viewer = None
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)
def __init__(self, parent=None): super(ThresholdSetter, self).__init__() self.parent = parent self.setTitle('Select IoU Threshold ') self.layout = QVBoxLayout() self.spinBox = QDoubleSpinBox() self.spinBox.setDecimals(2) self.spinBox.setMaximum(1.0) self.spinBox.setSingleStep(0.1) self.spinBox.setValue(0.5) self.layout.addWidget(self.spinBox) self.setLayout(self.layout)
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(PyConsole, self).__init__(context) self.setObjectName('PyConsole') self._context = context self._use_spyderlib = _has_spyderlib self._console_widget = None self._widget = QWidget() self._widget.setLayout(QVBoxLayout()) self._widget.layout().setContentsMargins(0, 0, 0, 0) if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number())) self._context.add_widget(self._widget)
def __init__(self, parent=None): super(BagWidget, self).__init__() self.parent = parent # create elements self.bagSelector1 = BagSelector('ground truth bag file') self.bagSelector2 = BagSelector('camera data bag file') # layout layout = QVBoxLayout() layout.addWidget(self.bagSelector1) layout.addWidget(self.bagSelector2) self.setLayout(layout)