def __init__(self, widget): self.pkgbox = QtWidgets.QComboBox() self.pkgbox.setEditable(True) self.pkgbox.setInsertPolicy(QtWidgets.QComboBox.NoInsert) self.xmlbox = QtWidgets.QComboBox() self.xmlbox.setEditable(True) widget.setTitle("Launch File Select") widget.setLayout(QtWidgets.QFormLayout()) widget.layout().addRow("Package", self.pkgbox) widget.layout().addRow("File", self.xmlbox)
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 __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 __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)