Ejemplo n.º 1
0
 def __init__(self):
     super(CenteredCheckBox, self).__init__()
     checkbox = QtWidgets.QCheckBox()
     layout = QtWidgets.QHBoxLayout(self)
     layout.addWidget(checkbox)
     layout.setAlignment(QtCore.Qt.AlignCenter)
     layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(layout)
Ejemplo n.º 2
0
 def __init__(self,
              topic_name,
              attributes,
              array_index,
              publisher,
              parent,
              label_text=None):
     super(ValueWidget, self).__init__(topic_name, publisher, parent=parent)
     self._parent = parent
     self._attributes = attributes
     self._array_index = array_index
     self._text = ez_model.make_text(topic_name, attributes, array_index)
     self._horizontal_layout = QtWidgets.QHBoxLayout()
     if label_text is None:
         self._topic_label = QtWidgets.QLabel(self._text)
     else:
         self._topic_label = QtWidgets.QLabel(label_text)
     self.close_button = QtWidgets.QPushButton()
     self.close_button.setMaximumWidth(30)
     self.close_button.setIcon(self.style().standardIcon(
         QtWidgets.QStyle.SP_TitleBarCloseButton))
     self.up_button = QtWidgets.QPushButton()
     self.up_button.setIcon(self.style().standardIcon(
         QtWidgets.QStyle.SP_ArrowUp))
     self.up_button.setMaximumWidth(30)
     self.down_button = QtWidgets.QPushButton()
     self.down_button.setMaximumWidth(30)
     self.down_button.setIcon(self.style().standardIcon(
         QtWidgets.QStyle.SP_ArrowDown))
     repeat_label = QtWidgets.QLabel('repeat')
     self._repeat_box = QtWidgets.QCheckBox()
     self._repeat_box.stateChanged.connect(self.repeat_changed)
     self._repeat_box.setChecked(publisher.is_repeating())
     self._publish_button = QtWidgets.QPushButton('Publish')
     self._publish_button.clicked.connect(publisher.publish)
     self._horizontal_layout.addWidget(self._topic_label)
     self._horizontal_layout.addWidget(self.close_button)
     self._horizontal_layout.addWidget(self.up_button)
     self._horizontal_layout.addWidget(self.down_button)
     if self._array_index is not None:
         self.add_button = QtWidgets.QPushButton('+')
         self.add_button.setMaximumWidth(30)
         self._horizontal_layout.addWidget(self.add_button)
     else:
         self.add_button = None
     self.close_button.clicked.connect(
         lambda x: self._parent.close_slider(self))
     self.up_button.clicked.connect(
         lambda x: self._parent.move_up_widget(self))
     self.down_button.clicked.connect(
         lambda x: self._parent.move_down_widget(self))
     self.setup_ui(self._text)
     self._horizontal_layout.addWidget(self._publish_button)
     self._horizontal_layout.addWidget(repeat_label)
     self._horizontal_layout.addWidget(self._repeat_box)
Ejemplo n.º 3
0
    def __init__(self, guimgr):
        super(AwRosbagSimulatorWidget, self).__init__()
        self.rosbag_mode_proc = QtCore.QProcess(self)
        self.rosbag_info_proc = QtCore.QProcess(self)
        self.rosbag_play_proc = QtCore.QProcess(self)

        self.rosbag_file = widgets.AwFileSelect(self)
        self.rosbag_info = QtWidgets.QPushButton("Info")
        self.rosbag_text = QtWidgets.QLabel("No information")
        self.rosbag_enable = QtWidgets.QCheckBox()
        self.rosbag_label = QtWidgets.QLabel("Simulation Mode")
        self.rosbag_play = QtWidgets.QPushButton("Play")
        self.rosbag_stop = QtWidgets.QPushButton("Stop")
        self.rosbag_pause = QtWidgets.QPushButton("Pause")
        self.rosbag_state = QtWidgets.QLabel()
        #self.rosbag_stime  = QtWidgets.QLineEdit()
        #start time
        #repeat
        #rate

        self.rosbag_enable.stateChanged.connect(self.simulation_mode_changed)
        self.rosbag_info.clicked.connect(self.rosbag_info_requested)
        self.rosbag_info_proc.finished.connect(self.rosbag_info_completed)

        self.rosbag_play.clicked.connect(self.rosbag_started)
        self.rosbag_stop.clicked.connect(self.rosbag_stopped)
        self.rosbag_play_proc.finished.connect(self.rosbag_finished)
        self.rosbag_play_proc.readyReadStandardOutput.connect(
            self.rosbag_output)

        self.rosbag_pause.setCheckable(True)
        self.rosbag_pause.toggled.connect(self.rosbag_paused)

        self.setStyleSheet(
            "QCheckBox::indicator { width: 28px; height: 28px; }")
        self.rosbag_label.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Preferred)
        self.rosbag_text.setSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                       QtWidgets.QSizePolicy.Expanding)

        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.rosbag_enable, 0, 0)
        layout.addWidget(self.rosbag_label, 0, 1)
        layout.addWidget(self.rosbag_play, 0, 2)
        layout.addWidget(self.rosbag_stop, 0, 3)
        layout.addWidget(self.rosbag_pause, 0, 4)
        layout.addWidget(self.rosbag_state, 1, 0, 1, 5)
        layout.addWidget(self.rosbag_file.path, 2, 0, 1, 3)
        layout.addWidget(self.rosbag_file.button, 2, 3)
        layout.addWidget(self.rosbag_info, 2, 4)
        layout.addWidget(self.rosbag_text, 3, 0, 1, 5)
        self.setLayout(layout)
        self.simulation_mode_disabled()
Ejemplo n.º 4
0
    def __init__(self, guimgr):
        super(AwGazeboSimulatorWidget, self).__init__()
        self.gazebo_process = QtCore.QProcess(self)

        self.launch_button = QtWidgets.QPushButton("Launch")
        self.setup_button = QtWidgets.QPushButton("Initial Setup")
        self.world_buttons = []
        self.world_buttons.append(
            self.__create_radio_button("simple", "simple"))
        self.world_buttons.append(self.__create_radio_button("mcity", "mcity"))
        self.world_buttons.append(
            self.__create_radio_button("city sim", "citysim_gazebo7"))
        self.use_gpu_box = QtWidgets.QCheckBox("Use GPU")

        self.world_buttons[0].setChecked(True)
        self.setup_button.clicked.connect(self.__exec_setup_script)
        self.launch_button.setCheckable(True)
        self.launch_button.toggled.connect(self.__exec_simulator)
        self.gazebo_process.finished.connect(self.__simulator_finished)

        world_group = QtWidgets.QGroupBox("World")
        world_group.setLayout(QtWidgets.QVBoxLayout())
        for world_button in self.world_buttons:
            world_group.layout().addWidget(world_button)
        world_group.layout().addStretch()

        config_group = QtWidgets.QGroupBox("Config")
        config_group.setLayout(QtWidgets.QVBoxLayout())
        config_group.layout().addWidget(self.use_gpu_box)
        config_group.layout().addStretch()

        hlayout1 = QtWidgets.QHBoxLayout()
        hlayout1.addStretch()
        hlayout1.addWidget(self.setup_button)

        hlayout2 = QtWidgets.QHBoxLayout()
        hlayout2.addWidget(world_group)
        hlayout2.addWidget(config_group)

        self.setLayout(QtWidgets.QVBoxLayout())
        self.layout().addLayout(hlayout1)
        self.layout().addLayout(hlayout2)
        self.layout().addWidget(self.launch_button)
Ejemplo n.º 5
0
    def __init__(self, plugin):
        super(ConfigDialog, self).__init__()
        self._plugin = plugin
        self._interval_spin_box = QtWidgets.QSpinBox()
        self._interval_spin_box.setMaximum(10000)
        self._interval_spin_box.setMinimum(1)
        self._interval_spin_box.setValue(
            publisher.TopicPublisherWithTimer.publish_interval)
        self._interval_spin_box.valueChanged.connect(self.update_interval)
        self._vertical_layout = QtWidgets.QVBoxLayout()
        self.configurable_checkbox = QtWidgets.QCheckBox()
        self.configurable_checkbox.setChecked(plugin.configurable)
        configurable_label = QtWidgets.QLabel('Configurable')
        self._configurable_horizontal_layout = QtWidgets.QHBoxLayout()
        self._configurable_horizontal_layout.addWidget(configurable_label)
        self._configurable_horizontal_layout.addWidget(self.configurable_checkbox)
        self._vertical_layout.addLayout(self._configurable_horizontal_layout)
        self._horizontal_layout = QtWidgets.QHBoxLayout()
        spin_label = QtWidgets.QLabel('Publish Interval for repeat [ms]')
        self._horizontal_layout.addWidget(spin_label)
        self._horizontal_layout.addWidget(self._interval_spin_box)
        self._vertical_layout.addLayout(self._horizontal_layout)
        save_button = QtWidgets.QPushButton(parent=self)
        save_button.setIcon(
            self.style().standardIcon(QtWidgets.QStyle.SP_DialogSaveButton))
        save_button.setText('Save to file')
        save_button.clicked.connect(self.save_to_file)

        load_button = QtWidgets.QPushButton(parent=self)
        load_button.setIcon(
            self.style().standardIcon(QtWidgets.QStyle.SP_DialogOpenButton))
        load_button.setText('Load from file')
        load_button.clicked.connect(self.load_from_file)

        self._vertical_layout.addWidget(save_button)
        self._vertical_layout.addWidget(load_button)
        self.setLayout(self._vertical_layout)
        self.adjustSize()
Ejemplo n.º 6
0
    def __init__(self, context):
        super(BehaviorTreePlugin, self).__init__(context)
        self.setObjectName('BehaviorTreePlugin')

        self.tree = None

        self.initialized_buttons = False
        self.prev_graphviz = ''
        
        self.behavior_tree_graphviz_sub = rospy.Subscriber('behavior_tree_graphviz', String, self.behavior_tree_graphviz_callback)
        self.timer = rospy.Timer(rospy.Duration(0.1), self.timer_callback)
        self.functions_mutex = Lock()
        self.functions = {}
        self.last_graphviz_string = ''
        
        self.widget = QWidget()
        self.vbox = qt.QVBoxLayout()
        self.widget.setLayout(self.vbox)
        context.add_widget(self.widget)
        #self.widget.setStyleSheet('QWidget{margin-left:-1px;}')

        self.top_widget = qt.QWidget()
        self.top_layout = qt.QVBoxLayout()
        self.top_widget.setLayout(self.top_layout)
        
        self.graph_widget = qt.QWidget()
        self.graph_layout = qt.QVBoxLayout()
        self.graph_widget.setLayout(self.graph_layout)
        self.image_label = qt.QLabel('asdfadsf')
        #self.graph_layout.addWidget(self.image_label)
        self.xdot_widget = DotWidget()
        self.graph_layout.addWidget(self.xdot_widget)
        self.top_layout.addWidget(self.graph_widget)
        self.graph_widget.setStyleSheet("background-color: rgb(255, 255, 255);")
        
        self.config_widget = qt.QWidget()
        self.config_widget.setStyleSheet('QWidget{margin-left:-1px;}')
        self.config_layout = qt.QHBoxLayout()
        self.config_widget.setLayout(self.config_layout)
        self.config_widget.setFixedHeight(50)
        
        self.config_button = qt.QPushButton('Open Config...')
        self.config_button.clicked.connect(self.select_config_file)
        self.config_layout.addWidget(self.config_button)

        self.tree_label = qt.QLabel('tree filename: ')
        self.config_layout.addWidget(self.tree_label)

        self.debug_checkbox = qt.QCheckBox('Debug Mode')
        self.config_layout.addWidget(self.debug_checkbox)
        self.debug_checkbox.stateChanged.connect(self.debug_mode_changed)

        #self.config_widget.setStyleSheet("background-color: rgb(255, 0, 0);")
        self.top_layout.addWidget(self.config_widget)

        #self.vbox.addWidget(self.top_widget)

        self.button_container_widget = qt.QWidget()
        self.button_container_layout = qt.QVBoxLayout()
        self.button_container_widget.setLayout(self.button_container_layout)
        #self.vbox.addWidget(self.button_container_widget)
        
        self.button_widget = qt.QWidget()
        self.button_layout = qt.QHBoxLayout()
        self.button_widget.setLayout(self.button_layout)
        #self.button_widget.setStyleSheet("background-color: rgb(0, 0, 255);")

        
        self.condition_widget = qt.QWidget()
        self.condition_layout = qt.QVBoxLayout()
        self.condition_widget.setLayout(self.condition_layout)
        self.button_layout.addWidget(self.condition_widget)
        
        self.condition_label = qt.QLabel()
        self.condition_label.setText('Conditions')
        self.condition_label.setAlignment(Qt.AlignCenter)
        self.condition_label.setFont(gui.QFont("SansSerif", 18, gui.QFont.Bold))
        self.condition_layout.addWidget(self.condition_label)
        
        self.action_widget = qt.QWidget()
        self.action_layout = qt.QVBoxLayout()
        self.action_widget.setLayout(self.action_layout)
        self.button_layout.addWidget(self.action_widget)
        
        self.action_label = qt.QLabel()
        self.action_label.setText('Actions')
        self.action_label.setAlignment(Qt.AlignCenter)
        self.action_label.setFont(gui.QFont("SansSerif", 18, gui.QFont.Bold))
        self.action_layout.addWidget(self.action_label)
        
        self.button_scroll_area = qt.QScrollArea()
        self.button_scroll_area.setWidget(self.button_widget)
        #self.button_scroll_area.setFixedHeight(200)
        #self.button_container_widget.setFixedHeight(200)
        self.button_container_layout.addWidget(self.button_scroll_area)
        self.button_widget.setMinimumWidth(self.button_scroll_area.sizeHint().width())
        self.button_scroll_area.setWidgetResizable(True)
        
        self.horizontal_splitter = qt.QSplitter(core.Qt.Vertical)
        self.horizontal_splitter.addWidget(self.top_widget)
        self.horizontal_splitter.addWidget(self.button_container_widget)
        self.vbox.addWidget(self.horizontal_splitter)

        self.button_container_widget.hide()
Ejemplo n.º 7
0
 def setup_ui(self, name):
     self._check_box = QtWidgets.QCheckBox()
     self._check_box.stateChanged.connect(self.state_changed)
     self._horizontal_layout.addWidget(self._check_box)
     self.setLayout(self._horizontal_layout)