def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setObjectName("MainBox") self.__on_intern_change = False boxLayout = QtGui.QFormLayout() boxLayout.setVerticalSpacing(0) self.setLayout(boxLayout)
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle('Select Binary') self.verticalLayout = QtGui.QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.content = QtGui.QWidget() self.contentLayout = QtGui.QFormLayout(self.content) self.contentLayout.setVerticalSpacing(0) self.verticalLayout.addWidget(self.content) self.packages = None package_label = QtGui.QLabel("Package:", self.content) self.package_field = QtGui.QComboBox(self.content) self.package_field.setInsertPolicy( QtGui.QComboBox.InsertAlphabetically) self.package_field.setSizePolicy( QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)) self.package_field.setEditable(True) self.contentLayout.addRow(package_label, self.package_field) binary_label = QtGui.QLabel("Binary:", self.content) self.binary_field = QtGui.QComboBox(self.content) # self.binary_field.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.binary_field.setSizePolicy( QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)) self.binary_field.setEditable(True) self.contentLayout.addRow(binary_label, self.binary_field) self.buttonBox = QtGui.QDialogButtonBox(self) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.package_field.setFocus(QtCore.Qt.TabFocusReason) self.package = '' self.binary = '' if self.packages is None: self.package_field.addItems(['packages searching...']) self.package_field.setCurrentIndex(0) self._fill_packages_thread = PackagesThread() self._fill_packages_thread.packages.connect(self._fill_packages) self._fill_packages_thread.start() QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject) QtCore.QMetaObject.connectSlotsByName(self) self.package_field.activated[str].connect(self.on_package_selected) self.package_field.textChanged.connect(self.on_package_selected)
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setObjectName('FindDialog') self.setWindowTitle('Search') self.verticalLayout = QtGui.QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.content = QtGui.QWidget(self) self.contentLayout = QtGui.QFormLayout(self.content) # self.contentLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) # self.contentLayout.setVerticalSpacing(0) self.contentLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.addWidget(self.content) label = QtGui.QLabel("Find:", self.content) self.search_field = QtGui.QLineEdit(self.content) self.contentLayout.addRow(label, self.search_field) replace_label = QtGui.QLabel("Replace:", self.content) self.replace_field = QtGui.QLineEdit(self.content) self.contentLayout.addRow(replace_label, self.replace_field) self.recursive = QtGui.QCheckBox("recursive search") self.contentLayout.addRow(self.recursive) self.result_label = QtGui.QLabel("") self.verticalLayout.addWidget(self.result_label) self.found_files = QtGui.QListWidget() self.found_files.setVisible(False) self.found_files.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.verticalLayout.addWidget(self.found_files) self.buttonBox = QtGui.QDialogButtonBox(self) self.find_button = QtGui.QPushButton(self.tr("&Find")) self.find_button.setDefault(True) self.buttonBox.addButton(self.find_button, QtGui.QDialogButtonBox.ActionRole) self.replace_button = QtGui.QPushButton(self.tr("&Replace/Find")) self.buttonBox.addButton(self.replace_button, QtGui.QDialogButtonBox.ActionRole) self.buttonBox.addButton(QtGui.QDialogButtonBox.Close) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) # QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject) QtCore.QMetaObject.connectSlotsByName(self) self.search_text = '' self.search_pos = QtGui.QTextCursor()
def create_controls(self): """ Create UI controls. """ vbox = QtGui.QVBoxLayout() form = QtGui.QFormLayout() self.num_sigma = QtGui.QDoubleSpinBox() self.num_sigma.setValue(1.0) self.num_sigma.setMinimum(0.0) self.num_sigma.setSingleStep(0.1) self.num_sigma.setMaximum(1e3) self.num_sigma.setDecimals(2) form.addRow(tr("Sigma:"), self.num_sigma) vbox.addLayout(form) self.chk_preview = QtGui.QCheckBox(tr("Preview")) self.chk_preview.setCheckable(True) self.chk_preview.setChecked(False) vbox.addWidget(self.chk_preview) self.chk_preview.toggled[bool].connect(self.set_preview) self.gbo_output = QtGui.QGroupBox(tr("Output")) self.opt_new = QtGui.QRadioButton(tr("New signal")) self.opt_replace = QtGui.QRadioButton(tr("In place")) self.opt_new.setChecked(True) gbo_vbox2 = QtGui.QVBoxLayout() gbo_vbox2.addWidget(self.opt_new) gbo_vbox2.addWidget(self.opt_replace) self.gbo_output.setLayout(gbo_vbox2) vbox.addWidget(self.gbo_output) self.btn_ok = QtGui.QPushButton(tr("&OK")) self.btn_ok.setDefault(True) self.btn_ok.clicked.connect(self.accept) self.btn_cancel = QtGui.QPushButton(tr("&Cancel")) self.btn_cancel.clicked.connect(self.reject) hbox = QtGui.QHBoxLayout() hbox.addWidget(self.btn_ok) hbox.addWidget(self.btn_cancel) vbox.addLayout(hbox) vbox.addStretch(1) self.setLayout(vbox)
def __init__(self, name, param_type, collapsible=True, parent=None): QtGui.QWidget.__init__(self, parent) self.setObjectName(name) self.name = name self.type = param_type self.params = [] self.collapsed = False self.parameter_description = None vLayout = QtGui.QVBoxLayout() vLayout.setSpacing(0) self.options_layout = QtGui.QHBoxLayout() self.param_widget = QtGui.QFrame() self.name_label = QtGui.QLabel(name) font = self.name_label.font() font.setBold(True) self.name_label.setFont(font) self.type_label = QtGui.QLabel(''.join([' (', param_type, ')'])) if collapsible: self.hide_button = QtGui.QPushButton('-') self.hide_button.setFlat(True) self.hide_button.setMaximumSize(20,20) self.hide_button.clicked.connect(self._on_hide_clicked) self.options_layout.addWidget(self.hide_button) self.options_layout.addWidget(self.name_label) self.options_layout.addWidget(self.type_label) self.options_layout.addStretch() vLayout.addLayout(self.options_layout) self.param_widget.setFrameShape(QtGui.QFrame.Box) self.param_widget.setFrameShadow(QtGui.QFrame.Raised) boxLayout = QtGui.QFormLayout() boxLayout.setVerticalSpacing(0) self.param_widget.setLayout(boxLayout) vLayout.addWidget(self.param_widget) self.setLayout(vLayout) if param_type in ['std_msgs/Header']: self.setCollapsed(True)
def _update_state(self, msg): self.totalBar.setValue(100 * msg.total_voltage / msg.max_total_voltage) self.totalBar.setFormat(str(msg.total_voltage) + ' V') if not self.inited: cellContainer = QtGui.QWidget() cellLayout = QtGui.QFormLayout() cellContainer.setLayout(cellLayout) i = 0 self.cellBars = list() for cell in msg.cells: voltBar = QtGui.QProgressBar() voltBar.setGeometry(0, 0, 150, 25) voltBar.setValue(75) voltBar.setFormat('Cell ' + str(cell.cell_id)) cellLayout.addRow(cell.frame_id, voltBar) self.cellBars.append(voltBar) i += 1 self.vbox.addWidget(cellContainer) self.alert = QtGui.QMessageBox(QtGui.QMessageBox.Information, 'Battery Voltage', 'The current battery voltage is: ' + str(msg.total_voltage) + ' V', flags=Qt.Dialog | Qt.MSWindowsFixedSizeDialogHint | Qt.WindowStaysOnTopHint) self.alert.show() self.inited = True i = 0 for cell in msg.cells: self.cellBars[i].setValue(100 * cell.voltage / msg.max_cell_voltage) self.cellBars[i].setFormat(str(cell.voltage) + ' V') i += 1 if msg.total_voltage < msg.critical_total_voltage: if (rospy.get_rostime() - self.last_voltage_critical ) > rospy.Duration(VOLTAGE_CRITICAL_INTERVAL): self.alert = QtGui.QMessageBox( QtGui.QMessageBox.Warning, 'Battery Voltage Critical!!!', 'The current battery voltage is: ' + str(msg.total_voltage) + ' V. You should shutdown now!!!', flags=Qt.Dialog | Qt.MSWindowsFixedSizeDialogHint | Qt.WindowStaysOnTopHint) self.alert.show() self.last_voltage_critical = rospy.get_rostime() elif msg.total_voltage < msg.warn_total_voltage: if (rospy.get_rostime() - self.last_voltage_warning ) > rospy.Duration(VOLTAGE_WARNING_INTERVAL): self.alert = QtGui.QMessageBox( QtGui.QMessageBox.Warning, 'Battery Voltage Low', 'The current battery voltage is: ' + str(msg.total_voltage) + ' V. You should plug in soon', flags=Qt.Dialog | Qt.MSWindowsFixedSizeDialogHint | Qt.WindowStaysOnTopHint) self.alert.show() self.last_voltage_warning = rospy.get_rostime()