def __init__(self, guimgr): super(AwLgsvlSimulatorWidget, self).__init__() self.process = QtCore.QProcess(self) self.console = AwProcessViewer(self.process) self.button = QtWidgets.QPushButton("Launch Simulator") self.button.setCheckable(True) self.button.toggled.connect(self.launch_lgsvm) self.server_addr = QtWidgets.QLineEdit() self.server_port = QtWidgets.QLineEdit() self.client_addr = QtWidgets.QLineEdit() self.client_port = QtWidgets.QLineEdit() self.server_addr.setText("10.100.2.1") self.server_port.setText("5000") for host in QtNetwork.QNetworkInterface.allAddresses(): if not host.isLoopback(): if host.protocol() == QtNetwork.QAbstractSocket.IPv4Protocol: self.client_addr.setText(host.toString()) self.client_port.setText("9090") layout = QtWidgets.QGridLayout() layout.addWidget(QtWidgets.QLabel("Server Address"), 0, 0) layout.addWidget(QtWidgets.QLabel("Server Port"), 1, 0) layout.addWidget(QtWidgets.QLabel("Client Address"), 2, 0) layout.addWidget(QtWidgets.QLabel("Client Port"), 3, 0) layout.addWidget(self.server_addr, 0, 1) layout.addWidget(self.server_port, 1, 1) layout.addWidget(self.client_addr, 2, 1) layout.addWidget(self.client_port, 3, 1) layout.addWidget(self.button, 4, 0, 1, 2) layout.addWidget(self.console, 5, 0, 1, 2) self.setLayout(layout)
def __init__(self, frame_editor): self.editor = frame_editor self.editor.observers.append(self) self.old_frame = None self.layout = QtWidgets.QGridLayout() self.widget = QWidget() self.widget.setLayout(self.layout) self.mesh_label = QtWidgets.QLineEdit("File:") self.mesh_label.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Fixed) self.mesh_button = QtWidgets.QPushButton("Open") self.mesh_button.clicked.connect(lambda: self.btn_open_mesh_clicked()) self.diameter_label = QtWidgets.QLabel("Diameter:") self.diameter_spinbox = QtWidgets.QDoubleSpinBox() self.diameter_spinbox.editingFinished.connect( lambda: self.diameter_changed()) self.length_label = QtWidgets.QLabel("Length:") self.length_spinbox = QtWidgets.QDoubleSpinBox() self.length_spinbox.editingFinished.connect( lambda: self.length_changed()) self.width_label = QtWidgets.QLabel("Width:") self.width_spinbox = QtWidgets.QDoubleSpinBox() self.width_spinbox.editingFinished.connect( lambda: self.width_changed()) self.height_label = QtWidgets.QLabel("Height:") self.height_spinbox = QtWidgets.QDoubleSpinBox() self.height_spinbox.editingFinished.connect( lambda: self.height_changed()) self.color_label = QtWidgets.QLabel() self.color_label.setAutoFillBackground(True) self.update_color_label(None) self.color_button = QtWidgets.QPushButton("Set Color") self.color_button.clicked.connect(lambda: self.btn_color_clicked()) self.layout.addWidget(self.mesh_label, 0, 0) self.layout.addWidget(self.mesh_button, 0, 1) self.layout.addWidget(self.diameter_label, 1, 0) self.layout.addWidget(self.diameter_spinbox, 1, 1) self.layout.addWidget(self.length_label, 2, 0) self.layout.addWidget(self.length_spinbox, 2, 1) self.layout.addWidget(self.width_label, 3, 0) self.layout.addWidget(self.width_spinbox, 3, 1) self.layout.addWidget(self.height_label, 4, 0) self.layout.addWidget(self.height_spinbox, 4, 1) self.layout.addWidget(self.color_label, 5, 0) self.layout.addWidget(self.color_button, 5, 1) print("init") self.update_widget(None)
def __init__(self, attr): self.name = QtWidgets.QLabel() self.type = QtWidgets.QComboBox() self.list = QtWidgets.QComboBox() self.default = QtWidgets.QLineEdit() self.name.setText(attr["name"]) self.type.addItems(["str", "int", "real", "bool"]) self.list.addItems(["none", "space", "yaml"]) self.default.setText(attr.get("default")) self.type.setCurrentIndex(-1) if attr.get("default"): itype = self.type_inference(attr["default"]) self.type.setCurrentIndex(self.type.findText(itype))
def chained_tasks_drop_cb(self, event): ''' Called when a task is dropped from the available_tasks_list to the chained_tasks_table, or when a task is moved (reordered) within the chained_tasks_table. ''' idx = self.chained_tasks_table.indexAt(event.pos()).row() if idx == -1: # Handle insertion at end of table idx = self.chained_tasks_table.rowCount() # If drop is from itself, do a reorder if event.source() == self.chained_tasks_table: # Now swap the two rows selected_index = self.chained_tasks_table.selectedIndexes()[0].row( ) if idx == selected_index: return self.chained_tasks_table.insertRow(idx) if selected_index > idx: selected_index += 1 for i in range(self.chained_tasks_table.columnCount()): self.chained_tasks_table.setCellWidget( idx, i, self.chained_tasks_table.cellWidget(selected_index, i)) self.chained_tasks_table.removeRow(selected_index) # If drop is from available list, insert it at the dropped row elif event.source() == self.available_tasks_list: selected_item = self.available_tasks_list.selectedItems()[0] task = QtWidgets.QLabel(selected_item.text()) required = CenteredCheckBox() required.setChecked(True) # Start with default required timeout = QtWidgets.QDoubleSpinBox() timeout.setValue(0) timeout.setMaximum(10000) timeout.setSuffix('s') parameters = QtWidgets.QLineEdit('') self.chained_tasks_table.insertRow(idx) self.chained_tasks_table.setCellWidget(idx, 0, task) self.chained_tasks_table.setCellWidget(idx, 1, required) self.chained_tasks_table.setCellWidget(idx, 2, timeout) self.chained_tasks_table.setCellWidget(idx, 3, parameters)
def load_chained_missions(self, list_of_missions): for i in reversed(range(self.chained_missions_table.rowCount())): self.chained_missions_table.removeRow(i) for idx, m in enumerate(list_of_missions): mission = m['mission'] timeout = m['timeout'] required = m['required'] parameters = m['parameters'] mission = QtWidgets.QLabel(m['mission']) required = CenteredCheckBox() required.setChecked(m['required']) # Start with default required timeout = QtWidgets.QDoubleSpinBox() timeout.setValue(m['timeout']) timeout.setMaximum(10000) timeout.setSuffix('s') parameters = QtWidgets.QLineEdit(m['parameters']) self.chained_missions_table.insertRow(idx) self.chained_missions_table.setCellWidget(idx, 0, mission) self.chained_missions_table.setCellWidget(idx, 1, required) self.chained_missions_table.setCellWidget(idx, 2, timeout) self.chained_missions_table.setCellWidget(idx, 3, parameters)
def __init__(self, parent=None): super(LineEditDialog, self).__init__() self.value = None vbox = QtWidgets.QVBoxLayout(self) # combo box model = QtGui.QStandardItemModel(self) for elm in rospy.get_param_names(): model.setItem(model.rowCount(), 0, QtGui.QStandardItem(elm)) self.combo_box = QtWidgets.QComboBox(self) self.line_edit = QtWidgets.QLineEdit() self.combo_box.setLineEdit(self.line_edit) self.combo_box.setCompleter(QtWidgets.QCompleter()) self.combo_box.setModel(model) self.combo_box.completer().setModel(model) self.combo_box.lineEdit().setText('') vbox.addWidget(self.combo_box) # button button = QPushButton() button.setText("Done") button.clicked.connect(self.buttonCallback) vbox.addWidget(button) self.setLayout(vbox)
def setup_ui(self, name): self._line_edit = QtWidgets.QLineEdit() self._line_edit.returnPressed.connect(self.input_text) self._horizontal_layout.addWidget(self._line_edit) self.setLayout(self._horizontal_layout)
def __init__(self, parent): super(AwFileSelect, self).__init__(parent) self.path = QtWidgets.QLineEdit() self.button = QtWidgets.QPushButton("Browse") self.button.clicked.connect(self.browse)
def __init__(self, input_id): super(InputWidget, self).__init__() self._id = input_id self.setLayout(QtWidgets.QHBoxLayout()) self._id_label = QtWidgets.QLabel("Input " + str(self._id)) self.layout().addWidget(self._id_label) # ---- Input port input ---- self._input_port_input = QtWidgets.QLineEdit() self.port_validator = QtGui.QRegExpValidator(QtCore.QRegExp("[a-z]+[0-9]+")) self._input_port_input.setValidator(self.port_validator) self.layout().addWidget(self._input_port_input) self._input_port_input.setText(str(rospy.get_param(self.get_param_base() + "input", "js" + str(self._id)))) self._input_port_input.textChanged.connect(self.change_input_port) # ---- /Input selector ---- # ---- Type selector ---- self._type_selector = QtWidgets.QComboBox() self.layout().addWidget(self._type_selector) self._type_selector.insertItem(0, "xbox ewoud") self._type_selector.insertItem(0, "xbox vision") self._type_selector.insertItem(0, "playstation") self._type_selector.insertItem(0, "gioteck") currentJoyType = rospy.get_param(self.get_param_base() + "joyType", "gioteck"); self._type_selector.setCurrentIndex(self._type_selector.findText(currentJoyType)) self._type_selector.currentIndexChanged.connect(self.change_input_type) # ---- /Type selector ---- self._robot_id_label = QtWidgets.QLabel("Robot id") self.layout().addWidget(self._robot_id_label) # --- Robot id input ---- self._robot_id_input = QtWidgets.QLineEdit() self.int_validator = QtGui.QRegExpValidator(QtCore.QRegExp("[0-9]+")) self._robot_id_input.setValidator(self.int_validator) self.layout().addWidget(self._robot_id_input) self._robot_id_input.setText(str(rospy.get_param(self.get_param_base() + "robot", int(self._id)))) self._robot_id_input.textChanged.connect(self.change_bot_id) # --- /Robot id input ---- # --- Mode selector ---- self._mode_selector = QtWidgets.QComboBox() self.layout().addWidget(self._mode_selector) self._mode_selector.insertItem(0, "our keeper") self._mode_selector.insertItem(0, "normal") currentMode = rospy.get_param(self.get_param_base() + "mode", "normal"); self._mode_selector.setCurrentIndex(self._mode_selector.findText(currentMode)) self._mode_selector.currentIndexChanged.connect(self.change_input_mode)