def __init__(self, parent=None): # + parent=None super().__init__(parent) # + parent self.setLayout(QFormLayout()) self.inputs = dict() self.inputs['Customer Name'] = QLineEdit() self.inputs['Customer Address'] = QPlainTextEdit() self.inputs['Invoice Date'] = QDateEdit(date=QDate.currentDate(), calendarPopup=True) self.inputs['Days until Due'] = QSpinBox() for label, widget in self.inputs.items(): self.layout().addRow(label, widget) self.line_items = QTableWidget(rowCount=10, columnCount=3) self.line_items.setHorizontalHeaderLabels(['Job', 'Rate', 'Hours']) self.line_items.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) self.layout().addRow(self.line_items) for row in range(self.line_items.rowCount()): for col in range(self.line_items.columnCount()): if col > 0: w = QSpinBox() self.line_items.setCellWidget(row, col, w) submit = QPushButton('Create Invoice', clicked=self.on_submit) # + vvvvvv vvvvvvvvvvvvv _print = QPushButton('Print Invoice', clicked=self.window().printpreviewDialog) # + _print, + self.window() self.layout().addRow(submit, _print) # + _print
def __init__(self, image, parent=None): super(EchoWidget, self).__init__(parent) params_layout = QHBoxLayout() params_layout.addWidget(QLabel(self.tr('Radius:'))) self.radius_spin = QSpinBox() self.radius_spin.setRange(1, 15) self.radius_spin.setSuffix(self.tr(' px')) self.radius_spin.setValue(2) self.radius_spin.valueChanged.connect(self.process) params_layout.addWidget(self.radius_spin) params_layout.addWidget(QLabel(self.tr('Contrast:'))) self.contrast_spin = QSpinBox() self.contrast_spin.setRange(0, 100) self.contrast_spin.setSuffix(self.tr(' %')) self.contrast_spin.setValue(85) self.contrast_spin.valueChanged.connect(self.process) params_layout.addWidget(self.contrast_spin) params_layout.addStretch() self.image = image self.viewer = ImageViewer(self.image, self.image, None) self.process() main_layout = QVBoxLayout() main_layout.addLayout(params_layout) main_layout.addWidget(self.viewer) self.setLayout(main_layout)
def createResolutionBox(self): # Horizontal Resolution self.hResBox = QSpinBox(self) self.hResBox.setRange(1, 99999) self.hResBox.setSingleStep(25) self.hResBox.setSuffix(' px') self.hResBox.valueChanged.connect(self.mw.editHRes) # Vertical Resolution self.vResLabel = QLabel('Pixel Height:') self.vResBox = QSpinBox(self) self.vResBox.setRange(1, 99999) self.vResBox.setSingleStep(25) self.vResBox.setSuffix(' px') self.vResBox.valueChanged.connect(self.mw.editVRes) # Ratio checkbox self.ratioCheck = QCheckBox("Fixed Aspect Ratio", self) self.ratioCheck.stateChanged.connect(self.mw.toggleAspectLock) # Resolution Form Layout self.resLayout = QFormLayout() self.resLayout.addRow(self.ratioCheck) self.resLayout.addRow('Pixel Width:', self.hResBox) self.resLayout.addRow(self.vResLabel, self.vResBox) self.resLayout.setLabelAlignment(QtCore.Qt.AlignLeft) self.resLayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) # Resolution Group Box self.resGroupBox = QGroupBox("Resolution") self.resGroupBox.setLayout(self.resLayout)
def init_ui(self): self.setWindowTitle(_('Course properties')) self.setWindowIcon(QIcon(config.ICON)) self.setSizeGripEnabled(False) self.setModal(True) self.layout = QFormLayout(self) self.label_name = QLabel(_('Name')) self.item_name = QLineEdit() self.item_name.textChanged.connect(self.check_name) self.layout.addRow(self.label_name, self.item_name) self.label_length = QLabel(_('Length(m)')) self.item_length = QSpinBox() self.item_length.setMaximum(100000) self.item_length.setSingleStep(100) self.item_length.setValue(0) self.layout.addRow(self.label_length, self.item_length) self.label_climb = QLabel(_('Climb')) self.item_climb = QSpinBox() self.item_climb.setValue(0) self.item_climb.setMaximum(10000) self.item_climb.setSingleStep(10) self.layout.addRow(self.label_climb, self.item_climb) self.label_control_qty = QLabel(_('Point count')) self.item_control_qty = QSpinBox() self.item_control_qty.setDisabled(True) self.layout.addRow(self.label_control_qty, self.item_control_qty) self.label_controls = QLabel( '{}\n\n31 150\n32 200\n33\n34 500\n...\n90 150'.format( _('Controls'))) self.item_controls = QTextEdit() self.item_controls.setTabChangesFocus(True) self.layout.addRow(self.label_controls, self.item_controls) def cancel_changes(): self.close() def apply_changes(): try: self.apply_changes_impl() except Exception as e: logging.error(str(e)) self.close() button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.button_ok = button_box.button(QDialogButtonBox.Ok) self.button_ok.setText(_('OK')) self.button_ok.clicked.connect(apply_changes) self.button_cancel = button_box.button(QDialogButtonBox.Cancel) self.button_cancel.setText(_('Cancel')) self.button_cancel.clicked.connect(cancel_changes) self.layout.addRow(button_box) self.show()
def setupSettings(self): spinBoxLayout = QFormLayout() self.removeOffset = QCheckBox('Remove DC offset') self.removeOffset.setChecked(self.parameters['offset filter']) spinBoxLayout.addRow(self.removeOffset) self.removeSupply = QCheckBox('Remove 50Hz') self.removeSupply.setChecked(self.parameters['supply filter']) spinBoxLayout.addRow(self.removeSupply) ## self.lpfHighcut = QSpinBox() ## self.lpfHighcut.setMaximum(10000) ## self.lpfHighcut.setValue(self.parameters['LPF highcut']) ## spinBoxLayout.addRow('LPF highcut frequency:', self.lpfHighcut) self.bpfLowcut = QSpinBox() self.bpfLowcut.setMaximum(10000) self.bpfLowcut.setValue(self.parameters['BPF lowcut']) spinBoxLayout.addRow('BPF lowcut frequency:', self.bpfLowcut) self.bpfHighcut = QSpinBox() self.bpfHighcut.setMaximum(10000) self.bpfHighcut.setValue(self.parameters['BPF highcut']) spinBoxLayout.addRow('BPF highcut frequency:', self.bpfHighcut) ## self.ArtefactsThreshold = QSpinBox() ## self.ArtefactsThreshold.setMaximum(10000) ## self.ArtefactsThreshold.setValue(self.parameters['art thres']) ## spinBoxLayout.addRow('Artefacts Threshold:', self.ArtefactsThreshold) self.algWindowSize = QSpinBox() self.algWindowSize.setMaximum(10000) self.algWindowSize.setValue(self.parameters['window']) spinBoxLayout.addRow('Window (samples):', self.algWindowSize) self.hmtLargerMean = QDoubleSpinBox() self.hmtLargerMean.setMinimum(0.1) self.hmtLargerMean.setMaximum(10000) self.hmtLargerMean.setValue(self.parameters['hmt larger mean']) spinBoxLayout.addRow('How many times larger than mean:', self.hmtLargerMean) self.prevSeconds = QDoubleSpinBox() self.prevSeconds.setMinimum(0.1) self.prevSeconds.setMaximum(10000) self.prevSeconds.setValue(self.parameters['prev sec']) spinBoxLayout.addRow('Number of previous seconds:', self.prevSeconds) self.hmtLarger = QDoubleSpinBox() self.hmtLarger.setMinimum(0.1) self.hmtLarger.setMaximum(10000) self.hmtLarger.setValue(self.parameters['hmt larger']) spinBoxLayout.addRow('How many times larger than previous:', self.hmtLarger) gBox = QGroupBox('Settings') gBox.setLayout(spinBoxLayout) self.mainLayout.addWidget(gBox)
def __init__(self, parent: "QWidget" = None): HyperparametersConfigWidget.__init__(self) QWidget.__init__(self, parent) # Widgets self._epoch_spinbox = QSpinBox(parent=self) self._epoch_spinbox.setMinimum(1) self._epoch_spinbox.setValue(self.get_epochs()) self._loss_function_combobox = QComboBox(parent=self) self._loss_function_combobox.addItems(self.get_available_loss_functions()) self._loss_function_combobox.setCurrentText(self.get_loss_function()) self._optimizer_combobox = QComboBox() self._optimizer_combobox.addItems(self.get_available_optimizers()) self._optimizer_combobox.setCurrentText(self.get_optimizer()) self._batch_size_spinbox = QSpinBox(parent=self) self._batch_size_spinbox.setValue(self.get_batch_size()) self._batch_size_spinbox.setMinimum(1) self._batch_size_spinbox.setMaximum(999999) # Layouts self._main_layout = QFormLayout() self._main_layout.addRow("Epochs", self._epoch_spinbox) self._main_layout.addRow("Optimizer", self._optimizer_combobox) self._main_layout.addRow("Loss function", self._loss_function_combobox) self._main_layout.addRow("Batch size", self._batch_size_spinbox) self.setLayout(self._main_layout) # Hyperparameters dictionary self._epoch_spinbox.valueChanged.connect(self.set_epochs) self._loss_function_combobox.currentTextChanged.connect(self.set_loss_function) self._optimizer_combobox.currentTextChanged.connect(self.set_optimizer) self._batch_size_spinbox.valueChanged.connect(self.set_batch_size)
def createDurationDialog(self): popup = QDialog(self) popup.setFixedSize(150, 150) popup.setWindowTitle("Nouvelle durée") layout = QVBoxLayout() hourLayout = QHBoxLayout() hourLabel = QLabel("Heures:") hourSpin = QSpinBox() hourLayout.addWidget(hourLabel) hourLayout.addWidget(hourSpin) minuteLayout = QHBoxLayout() minuteLabel = QLabel("Minutes:") minuteSpin = QSpinBox() minuteLayout.addWidget(minuteLabel) minuteLayout.addWidget(minuteSpin) secondLayout = QHBoxLayout() secondLabel = QLabel("Secondes:") secondSpin = QSpinBox() secondLayout.addWidget(secondLabel) secondLayout.addWidget(secondSpin) layout.addLayout(hourLayout) layout.addLayout(minuteLayout) layout.addLayout(secondLayout) button = QPushButton("Ok") button.clicked.connect(lambda: self.createDuration( popup, hourSpin.value(), minuteSpin.value(), secondSpin.value())) layout.addWidget(button) popup.setLayout(layout) popup.exec_()
def __init__(self, image, parent=None): super(ElaWidget, self).__init__(parent) params_layout = QHBoxLayout() params_layout.addWidget(QLabel(self.tr('Quality:'))) self.quality_spin = QSpinBox() self.quality_spin.setRange(0, 100) self.quality_spin.setSuffix(self.tr(' %')) self.quality_spin.valueChanged.connect(self.process) params_layout.addWidget(self.quality_spin) params_layout.addWidget(QLabel(self.tr('Scale:'))) self.scale_spin = QSpinBox() self.scale_spin.setRange(1, 100) self.scale_spin.valueChanged.connect(self.process) params_layout.addWidget(self.scale_spin) self.equalize_check = QCheckBox(self.tr('Equalized')) self.equalize_check.stateChanged.connect(self.process) params_layout.addWidget(self.equalize_check) params_layout.addStretch() default_button = QPushButton(self.tr('Default')) default_button.clicked.connect(self.default) params_layout.addWidget(default_button) self.image = image self.viewer = ImageViewer(self.image, self.image) self.default() self.process() main_layout = QVBoxLayout() main_layout.addLayout(params_layout) main_layout.addWidget(self.viewer) self.setLayout(main_layout)
def __init__(self): super().__init__() self.threadpool = QThreadPool() self.totalTickets = QSpinBox() self.totalTickets.setRange(0, 500) self.serviceTickets = QSpinBox() self.serviceTickets.setRange(0, 250) self.incidentTickets = QSpinBox() self.incidentTickets.setRange(0, 250) self.unassignedTickets = QSpinBox() self.unassignedTickets.setRange(0, 200) self.reasonOne = QLineEdit() self.reasonTwo = QLineEdit() self.reasonThree = QLineEdit() self.additionalNotes = QTextEdit() self.generate_btn = QPushButton("Generate PDF") self.generate_btn.pressed.connect(self.generate) layout = QFormLayout() layout.addRow("Number of tickets today", self.totalTickets) layout.addRow("Service tickets", self.serviceTickets) layout.addRow("Incident tickets", self.incidentTickets) layout.addRow("Unassigned tickets", self.unassignedTickets) layout.addRow("Reason for most tickets", self.reasonOne) layout.addRow("Second reason for most tickets", self.reasonTwo) layout.addRow("Third reason for most tickets", self.reasonThree) layout.addRow("additionalNotes", self.additionalNotes) layout.addRow(self.generate_btn) self.setLayout(layout)
def setupCWTLayout(self): CWTSettLayout = QFormLayout(self) ## for winType in self.specWindows: ## if self.specWindows[winType][1] == int: ## paramEdit = QSpinBox() ## else: ## paramEdit = QDoubleSpinBox() ## paramEdit.setMinimum(self.specWindows[winType][2]) ## paramEdit.setMaximum(self.specWindows[winType][3]) ## paramEdit.setValue(self.specWindows[winType][4]) ## paramLabel = QLabel(self.specWindows[winType][0]) ## self.specWindows[winType] = [paramLabel, paramEdit] ## ## self.winTypeChooser = QComboBox() ## for winType in self.winTypes: ## self.winTypeChooser.addItem(winType) ## ## self.winTypeChooser.currentTextChanged.connect(self.windowChanged) ## self.winTypeChooser.setCurrentText('hann') ## STFTSettLayout.addRow('Window type', self.winTypeChooser) self.minScaleEdit = QSpinBox() self.minScaleEdit.setMaximum(self.fs / 2) self.minScaleEdit.setValue(self.defaultParam['minScale']) CWTSettLayout.addRow('Min output Scale', self.minScaleEdit) self.maxScaleEdit = QSpinBox() self.maxScaleEdit.setMaximum(self.fs / 2) self.maxScaleEdit.setValue(self.defaultParam['maxScale']) CWTSettLayout.addRow('Max output Scale', self.maxScaleEdit)
def displayWidgets(self): """ Configura os widgets da app """ info_lbl = QLabel("Selecione 2 itens que você almoçou e seus preços.") info_lbl.setFont(QFont('Arial', 16)) info_lbl.setAlignment(Qt.AlignCenter) self.total_lbl = QLabel("Total: R$") self.total_lbl.setFont(QFont('Arial', 16)) self.total_lbl.setAlignment(Qt.AlignRight) list_comida = [ "ovos", "misto quente", "queijo quente", "queijo", "homus", "iogurte", "maçã", "banana", "laranja", "pão de queijo", "cenouras", "pão", "macarrão", "biscoitos", "tapioca", "batatas fritas", "café", "refrigerante", "água" ] alm1_cbx = QComboBox() alm1_cbx.addItems(list_comida) alm2_cbx = QComboBox() alm2_cbx.addItems(list_comida) self.pre1R_sbx = QSpinBox() self.pre1R_sbx.setRange(0, 100) self.pre1R_sbx.setPrefix("R$ ") self.pre1R_sbx.valueChanged.connect(self.calculaTotal) self.pre1C_sbx = QSpinBox() self.pre1C_sbx.setRange(0, 99) self.pre1C_sbx.setPrefix(".") self.pre1C_sbx.valueChanged.connect(self.calculaTotal) self.pre2R_sbx = QSpinBox() self.pre2R_sbx.setRange(0, 100) self.pre2R_sbx.setPrefix("R$ ") self.pre2R_sbx.valueChanged.connect(self.calculaTotal) self.pre2C_sbx = QSpinBox() self.pre2C_sbx.setRange(0, 99) self.pre2C_sbx.setPrefix(".") self.pre2C_sbx.valueChanged.connect(self.calculaTotal) hbox1 = QHBoxLayout() hbox2 = QHBoxLayout() hbox1.addWidget(alm1_cbx) hbox1.addWidget(self.pre1R_sbx) hbox1.addWidget(self.pre1C_sbx) hbox2.addWidget(alm2_cbx) hbox2.addWidget(self.pre2R_sbx) hbox2.addWidget(self.pre2C_sbx) vbox = QVBoxLayout() vbox.addWidget(info_lbl) vbox.addLayout(hbox1) vbox.addLayout(hbox2) vbox.addWidget(self.total_lbl) self.setLayout(vbox)
def __init__(self, image, parent=None): super(NoiseWidget, self).__init__(parent) self.mode_combo = QComboBox() self.mode_combo.addItems([ self.tr('Median'), self.tr('Gaussian'), self.tr('BoxBlur'), self.tr('Bilateral'), self.tr('NonLocal') ]) self.radius_spin = QSpinBox() self.radius_spin.setRange(1, 10) self.radius_spin.setSuffix(self.tr(' px')) self.radius_spin.setValue(1) self.sigma_spin = QSpinBox() self.sigma_spin.setRange(1, 200) self.sigma_spin.setValue(3) self.levels_spin = QSpinBox() self.levels_spin.setRange(0, 255) self.levels_spin.setSpecialValueText(self.tr('Equalized')) self.levels_spin.setValue(32) self.gray_check = QCheckBox(self.tr('Grayscale')) self.denoised_check = QCheckBox(self.tr('Denoised')) self.image = image self.viewer = ImageViewer(self.image, self.image) self.process() params_layout = QHBoxLayout() params_layout.addWidget(QLabel(self.tr('Mode:'))) params_layout.addWidget(self.mode_combo) params_layout.addWidget(QLabel(self.tr('Radius:'))) params_layout.addWidget(self.radius_spin) params_layout.addWidget(QLabel(self.tr('Sigma:'))) params_layout.addWidget(self.sigma_spin) params_layout.addWidget(QLabel(self.tr('Levels:'))) params_layout.addWidget(self.levels_spin) params_layout.addWidget(self.gray_check) params_layout.addWidget(self.denoised_check) params_layout.addStretch() main_layout = QVBoxLayout() main_layout.addLayout(params_layout) main_layout.addWidget(self.viewer) self.setLayout(main_layout) self.mode_combo.currentTextChanged.connect(self.process) self.radius_spin.valueChanged.connect(self.process) self.sigma_spin.valueChanged.connect(self.process) self.levels_spin.valueChanged.connect(self.process) self.gray_check.stateChanged.connect(self.process) self.denoised_check.stateChanged.connect(self.process)
def __init__(self): super().__init__() form = QFormLayout() self.track_id = QSpinBox() self.track_id.setRange(0, 2147483647) self.track_id.setDisabled(True) self.name = QLineEdit() self.album = QComboBox() self.media_type = QComboBox() self.genre = QComboBox() self.composer = QLineEdit() self.milliseconds = QSpinBox() self.milliseconds.setRange(0, 2147483647) # <1> self.milliseconds.setSingleStep(1) self.bytes = QSpinBox() self.bytes.setRange(0, 2147483647) self.bytes.setSingleStep(1) self.unit_price = QDoubleSpinBox() self.unit_price.setRange(0, 999) self.unit_price.setSingleStep(0.01) self.unit_price.setPrefix("$") form.addRow(QLabel("Track ID"), self.track_id) form.addRow(QLabel("Track name"), self.name) form.addRow(QLabel("Composer"), self.composer) form.addRow(QLabel("Milliseconds"), self.milliseconds) form.addRow(QLabel("Bytes"), self.bytes) form.addRow(QLabel("Unit Price"), self.unit_price) self.model = QSqlTableModel(db=db) self.mapper = QDataWidgetMapper() # <2> self.mapper.setModel(self.model) self.mapper.addMapping(self.track_id, 0) # <3> self.mapper.addMapping(self.name, 1) self.mapper.addMapping(self.composer, 5) self.mapper.addMapping(self.milliseconds, 6) self.mapper.addMapping(self.bytes, 7) self.mapper.addMapping(self.unit_price, 8) self.model.setTable("Track") self.model.select() # <4> self.mapper.toFirst() # <5> self.setMinimumSize(QSize(400, 400)) widget = QWidget() widget.setLayout(form) self.setCentralWidget(widget)
def __init__(self): super(InputsLayout, self).__init__() self.big_font = QFont() self.medium_font = QFont() self.header = QLabel() self.header_general = QLabel() self.header_fitness_remapping = QLabel() self.header_stop = QLabel() self.header_selection = QLabel() self.header_pairing = QLabel() self.header_crossover = QLabel() self.header_mutation = QLabel() self.inp_functions_combo = QComboBox() self.inp_num_variables = QSpinBox() self.inp_extrema_min = QRadioButton("Minimum") self.inp_extrema_max = QRadioButton("Maximum") self.inp_pop_size = QSpinBox() self.inp_lower_bound = QDoubleSpinBox() self.inp_upper_bound = QDoubleSpinBox() # Stopping self.inp_max_iter = QSpinBox() self.inp_similarity_cb = QCheckBox() self.inp_similarity = QSpinBox() self.inp_best_result_cb = QCheckBox() self.inp_best_result = QDoubleSpinBox() self.inp_average_result_cb = QCheckBox() self.inp_average_result = QDoubleSpinBox() # Fitness remapping self.inp_fitness_remapping = QComboBox() # Selection self.inp_selection_method = QComboBox() self.inp_elitism = QDoubleSpinBox() # Pairing self.inp_pairing_method = QComboBox() # Crossover self.inp_crossover_method = QComboBox() self.inp_crossover_fraction = QDoubleSpinBox() self.intermediate_offset = QDoubleSpinBox() # Mutation self.inp_mutation_method = QComboBox() self.inp_mutation_intensity = QDoubleSpinBox() self.inp_mutation_intensity_final = QDoubleSpinBox() self.init_fonts() self.init_header() self.init_row_functions() self.init_row_general() self.init_row_fitness_remapping() self.init_row_stop() self.init_row_selection() self.init_row_pairing() self.init_row_crossover() self.init_row_mutation()
def initialize_ui(self): self.setAttribute(Qt.WA_StyledBackground, True) self.main_layout = QGridLayout(self) self.filename_label = QLabel(self.tr("Filename:")) self.filename_display = QLabel(self.tr("Unknown")) self.main_layout.addWidget(self.filename_label, 0, 0) self.main_layout.addWidget(self.filename_display, 0, 1, 1, 2) self.select_button = QPushButton(qta.icon("mdi.file-table"), self.tr("Select")) self.select_button.clicked.connect(self.on_select_clicked) self.main_layout.addWidget(self.select_button, 0, 3) self.sheet_label = QLabel(self.tr("Sheet:")) self.sheet_combo_box = QComboBox() self.sheet_combo_box.addItem(self.tr("Empty")) self.main_layout.addWidget(self.sheet_label, 1, 0) self.main_layout.addWidget(self.sheet_combo_box, 1, 1, 1, 3) self.classes_row_label = QLabel( self.tr("Row With Grain-size Classes:")) self.classes_row_input = QSpinBox() self.classes_row_input.setRange(1, 999) self.main_layout.addWidget(self.classes_row_label, 2, 0, 1, 3) self.main_layout.addWidget(self.classes_row_input, 2, 3) self.sample_names_column_label = QLabel( self.tr("Column With Sample Names:")) self.sample_names_column_input = QSpinBox() self.sample_names_column_input.setRange(1, 999) self.main_layout.addWidget(self.sample_names_column_label, 3, 0, 1, 3) self.main_layout.addWidget(self.sample_names_column_input, 3, 3) self.distribution_start_row_label = QLabel( self.tr("Distribution Start Row:")) self.distribution_start_row_input = QSpinBox() self.distribution_start_row_input.setRange(2, 999999) self.main_layout.addWidget(self.distribution_start_row_label, 4, 0, 1, 3) self.main_layout.addWidget(self.distribution_start_row_input, 4, 3) self.distribution_start_column_label = QLabel( self.tr("Distribution Start Column:")) self.distribution_start_column_input = QSpinBox() self.distribution_start_column_input.setRange(2, 999999) self.main_layout.addWidget(self.distribution_start_column_label, 5, 0, 1, 3) self.main_layout.addWidget(self.distribution_start_column_input, 5, 3) self.try_load_button = QPushButton(qta.icon("fa5s.book-reader"), self.tr("Try Load")) self.try_load_button.clicked.connect(self.on_try_load_clicked) self.try_load_button.setEnabled(False) self.main_layout.addWidget(self.try_load_button, 6, 0, 1, 4) self.info_display = QTextEdit() self.info_display.setReadOnly(True) self.main_layout.addWidget(self.info_display, 7, 0, 1, 4)
def __init__(self, image, parent=None): super(WaveletWidget, self).__init__(parent) self.family_combo = QComboBox() self.family_combo.addItems([ self.tr("Daubechies"), self.tr("Symlets"), self.tr("Coiflets"), self.tr("Biorthogonal") ]) self.wavelet_combo = QComboBox() self.wavelet_combo.setMinimumWidth(70) self.threshold_spin = QSpinBox() self.threshold_spin.setRange(0, 100) self.threshold_spin.setSuffix("%") self.mode_combo = QComboBox() self.mode_combo.addItems([ self.tr("Soft"), self.tr("Hard"), self.tr("Garrote"), self.tr("Greater"), self.tr("Less") ]) self.level_spin = QSpinBox() self.image = image self.coeffs = None self.viewer = ImageViewer(self.image, self.image) self.update_wavelet() self.family_combo.activated.connect(self.update_wavelet) self.wavelet_combo.activated.connect(self.update_level) self.threshold_spin.valueChanged.connect(self.compute_idwt) self.mode_combo.activated.connect(self.compute_idwt) self.level_spin.valueChanged.connect(self.compute_idwt) top_layout = QHBoxLayout() top_layout.addWidget(QLabel(self.tr("Family:"))) top_layout.addWidget(self.family_combo) top_layout.addWidget(QLabel(self.tr("Wavelet:"))) top_layout.addWidget(self.wavelet_combo) top_layout.addWidget(QLabel(self.tr("Threshold:"))) top_layout.addWidget(self.threshold_spin) top_layout.addWidget(QLabel(self.tr("Mode:"))) top_layout.addWidget(self.mode_combo) top_layout.addWidget(QLabel(self.tr("Level:"))) top_layout.addWidget(self.level_spin) top_layout.addStretch() main_layout = QVBoxLayout() main_layout.addLayout(top_layout) main_layout.addWidget(self.viewer) self.setLayout(main_layout)
def __init__(self, parent=None): super(StyleWidget, self).__init__(parent) self.label_line_length = QLabel(u'Длина линии') self.spinbox_line_length = QSpinBox() self.spinbox_line_length.setMinimum(10) self.spinbox_line_length.setMaximum(250) self.spinbox_line_length.setSingleStep(10) self.spinbox_line_length.setValue(200) self.label_line_width = QLabel(u'Толщина линии') self.spinbox_line_width = QSpinBox() self.spinbox_line_width.setMinimum(1) self.spinbox_line_width.setMaximum(10) self.spinbox_line_width.setSingleStep(1) self.spinbox_line_width.setValue(2) self.label_circle_rad = QLabel(u'Радиус круга') self.spinbox_circle_rad = QSpinBox() self.spinbox_circle_rad.setMinimum(1) self.spinbox_circle_rad.setMaximum(30) self.spinbox_circle_rad.setSingleStep(1) self.spinbox_circle_rad.setValue(10) self.label_line_color = QLabel(u'Цвет линии') self.combobox_line_color = QComboBox() self.combobox_line_color.addItem(u'черный', 'black') self.combobox_line_color.addItem(u'красный', 'red') self.combobox_line_color.addItem(u'зеленый', 'green') self.combobox_line_color.addItem(u'синий', 'blue') self.checkbox_normalize_circle_rad = QCheckBox(u'Круги одинакового размера') layout = QGridLayout() layout.addWidget(self.label_line_length, 0, 0, Qt.AlignRight) layout.addWidget(self.spinbox_line_length, 0, 1) layout.addWidget(self.label_line_width, 1, 0, Qt.AlignRight) layout.addWidget(self.spinbox_line_width, 1, 1) layout.addWidget(self.label_circle_rad, 2, 0, Qt.AlignRight) layout.addWidget(self.spinbox_circle_rad, 2, 1) layout.addWidget(self.label_line_color, 3, 0, Qt.AlignRight) layout.addWidget(self.combobox_line_color, 3, 1) layout.addWidget(self.checkbox_normalize_circle_rad, 4, 0, 1, 2) layout.setRowStretch(5, 1) self.setLayout(layout) self.spinbox_line_length.valueChanged.connect(self.on_change) self.spinbox_line_width.valueChanged.connect(self.on_change) self.spinbox_circle_rad.valueChanged.connect(self.on_change) self.combobox_line_color.activated.connect(self.on_change) self.checkbox_normalize_circle_rad.stateChanged.connect(self.on_change) self.on_change()
def testSetValueIndirect(self): """Indirect signal emission: QSpinBox using valueChanged(int)/setValue(int)""" spinSend = QSpinBox() spinRec = QSpinBox() spinRec.setValue(5) QObject.connect(spinSend, SIGNAL('valueChanged(int)'), spinRec, SLOT('setValue(int)')) self.assertEqual(spinRec.value(), 5) spinSend.setValue(3) self.assertEqual(spinRec.value(), 3) self.assertEqual(spinSend.value(), 3)
def create_gui(self): buttonHeight = 100 self._forward_btn = QPushButton("ACC", self) self._brake_btn = QPushButton("BRAKE", self) self._left_btn = QPushButton("LEFT", self) self._right_btn = QPushButton("RIGHT", self) self._forward_btn.setFixedHeight(buttonHeight) self._brake_btn.setFixedHeight(buttonHeight) self._left_btn.setFixedHeight(buttonHeight) self._right_btn.setFixedHeight(buttonHeight) self._trim_btn = QPushButton("Set Trim", self) self._trim_btn.clicked.connect(self.show_trim_window) self._le_ip = QLineEdit(self._vehicle_ctl.vehicle_ip(), self) self._le_ip.textChanged.connect(self.ip_changed) self._lbl_ip = QLabel("Ip:") self._sb_port = QSpinBox(self) self._sb_port.setMaximum(99999) self._sb_port.setValue(self._vehicle_ctl.vehicle_port()) self._sb_port.valueChanged.connect(self.port_changed) self._lbl_port = QLabel("Port:") self._lbl_mode = QLabel("Mode:") self._cbo_mode = QComboBox(self) self._lbl_proxy_address = QLabel("Proxy:") self._le_proxy_address = QLineEdit( self._vehicle_ctl.vehicle_proxy_address(), self) self._lbl_proxy_port = QLabel("Proxy Port:") self._lbl_gear = QLabel('<b style="color: black;">' + self._vehicle_ctl.get_gear().value + "</b>") f = self._lbl_gear.font() f.setPointSizeF(100) self._lbl_gear.setFont(f) self._lbl_gear.setAlignment(Qt.AlignCenter) self._btn_change_gear = QPushButton("Shift Gear") self._sb_proxy_port = QSpinBox(self) self._sb_proxy_port.setMaximum(99999) self._sb_proxy_port.setValue(self._vehicle_ctl.vehicle_proxy_port()) self._cbo_mode.addItem("NORMAL", int(ModeType.NORMAL)) self._cbo_mode.addItem("TRAIN", int(ModeType.TRAIN)) self._cbo_mode.addItem("AUTO", int(ModeType.AUTO)) self._btn_restart = QPushButton("Restart Stream") self._cb_proxy = QCheckBox() self._lbl_use_proxy = QLabel("Use Proxy") self._cb_proxy.setChecked(self._vehicle_ctl.is_using_proxy()) self._le_proxy_address.setEnabled(self._vehicle_ctl.is_using_proxy()) self._sb_proxy_port.setEnabled(self._vehicle_ctl.is_using_proxy())
def __init__(self, image, parent=None): super(ElaWidget, self).__init__(parent) self.quality_spin = QSpinBox() self.quality_spin.setRange(1, 100) self.quality_spin.setSuffix(self.tr(' %')) self.quality_spin.setToolTip(self.tr('JPEG reference quality level')) self.scale_spin = QSpinBox() self.scale_spin.setRange(1, 100) self.scale_spin.setSuffix(' %') self.scale_spin.setToolTip(self.tr('Output multiplicative gain')) self.contrast_spin = QSpinBox() self.contrast_spin.setRange(0, 100) self.contrast_spin.setSuffix(' %') self.contrast_spin.setToolTip(self.tr('Output tonality compression')) self.linear_check = QCheckBox(self.tr('Linear')) self.linear_check.setToolTip(self.tr('Linearize absolute difference')) self.gray_check = QCheckBox(self.tr('Grayscale')) self.gray_check.setToolTip(self.tr('Desaturated output')) default_button = QPushButton(self.tr('Default')) default_button.setToolTip(self.tr('Revert to default parameters')) params_layout = QHBoxLayout() params_layout.addWidget(QLabel(self.tr('Quality:'))) params_layout.addWidget(self.quality_spin) params_layout.addWidget(QLabel(self.tr('Scale:'))) params_layout.addWidget(self.scale_spin) params_layout.addWidget(QLabel(self.tr('Contrast:'))) params_layout.addWidget(self.contrast_spin) params_layout.addWidget(self.linear_check) params_layout.addWidget(self.gray_check) params_layout.addWidget(default_button) params_layout.addStretch() self.image = image self.original = image.astype(np.float32) / 255 self.compressed = None self.viewer = ImageViewer(self.image, self.image) self.default() self.quality_spin.valueChanged.connect(self.preprocess) self.scale_spin.valueChanged.connect(self.process) self.contrast_spin.valueChanged.connect(self.process) self.linear_check.stateChanged.connect(self.process) self.gray_check.stateChanged.connect(self.process) default_button.clicked.connect(self.default) main_layout = QVBoxLayout() main_layout.addLayout(params_layout) main_layout.addWidget(self.viewer) self.setLayout(main_layout)
def setupUi(self): self.mainLayout = QVBoxLayout() self.subLayout = QHBoxLayout() groups = [ALL_GROUPS] groups.extend(list(self.obj.group.keys())) self.groupSelection = CheckableComboBox(label="Groups", allowNoSelection=False) self.groupSelection.addItems(groups) self.labelSelection = CheckableComboBox(label="Solution", allowNoSelection=False, singleSelection=True) self.labelSelection.addItems([sol.label for sol in self.obj.solution]) self.indexLabel = QLabel() self.indexSelection = QSpinBox() self.indexSelection.setMinimum(0) self.indexSelection.setMaximum(0) self.indexSelection.setValue(0) self.colorLevelEdit = QSpinBox() self.colorLevelEdit.setButtonSymbols(QAbstractSpinBox.NoButtons) self.colorLevelEdit.setMinimum(256) self.colorLevelEdit.setMinimum(2) self.colorLevelEdit.setValue(11) self.minValueEdit = FloatEdit() self.maxValueEdit = FloatEdit() self.mainLayout.addWidget(self.groupSelection) self.mainLayout.addWidget(self.labelSelection) self.mainLayout.addLayout(self.subLayout) self.mainLayout.addWidget(self.plotWidget) self.subLayout.addWidget(self.indexLabel) self.subLayout.addWidget(self.indexSelection) self.subLayout.addWidget(QLabel("Min.")) self.subLayout.addWidget(self.minValueEdit) self.subLayout.addWidget(QLabel("Max.")) self.subLayout.addWidget(self.maxValueEdit) self.subLayout.addWidget(QLabel("Color Levels")) self.subLayout.addWidget(self.colorLevelEdit) self.setLayout(self.mainLayout) self.setMinimumWidth(700)
def scramble_row(task_type, unit_type, unit_count, client_slots: bool, row: int): unit_name = QLabel("{} ({})".format(db.unit_type_name(unit_type), unit_count)) self.gridLayout.addWidget(unit_name, row, 0) scramble_entry = QSpinBox() self.gridLayout.addWidget(scramble_entry, row, 1) if client_slots: client_entry = QSpinBox() self.gridLayout.addWidget(client_entry, row, 2) else: client_entry = None self.scramble_entries[task_type][unit_type] = scramble_entry, client_entry
def create_widgets(self): self.label_player1 = QLabel("Player 1") self.input_player1_name = QLineEdit() self.input_player1_name.setPlaceholderText("Player 1") self.input_player1_name.setFocus() self.player1_completer = QCompleter() self.input_player1_name.setCompleter(self.player1_completer) self.label_player2 = QLabel("Player 2") self.input_player2_name = QLineEdit() self.input_player2_name.setPlaceholderText("Player 2") self.player2_completer = QCompleter() self.input_player2_name.setCompleter(self.player2_completer) # player widget-ek feltültése a db-ben szereplő nevekkel, autocomplete-hez self.get_player_name() self.gomb_301 = QRadioButton("301") self.gomb_401 = QRadioButton("401") self.gomb_501 = QRadioButton("501") self.gomb_501.setChecked(True) self.gomb_701 = QRadioButton("701") self.label_bestof = QLabel("Best Of.. (Egyébként First To..)") self.best_of = QCheckBox() self.spin_legs = QSpinBox() self.spin_legs.setValue(3) self.spin_legs.setMinimum(1) self.spin_legs.setMaximum(21) self.spin_sets = QSpinBox() self.spin_sets.setValue(1) self.spin_sets.setMinimum(1) self.spin_sets.setMaximum(15) self.handi1 = QSpinBox() self.handi1.setValue(0) self.handi1.setMinimum(-100) self.handi1.setMaximum(100) self.handi2 = QSpinBox() self.handi2.setValue(0) self.handi2.setMinimum(-100) self.handi2.setMaximum(100) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel | QDialogButtonBox.Reset) self.buttonbox.clicked.connect(self.buttonbox_click)
def testSpinBoxValueChanged(self): """Multiple connections to QSpinBox.valueChanged(int)""" sender = QSpinBox() #FIXME if number of receivers if higher than 50, segfaults receivers = [BasicPySlotCase() for x in range(10)] self.run_many(sender, 'valueChanged(int)', sender.setValue, receivers, (1, ))
def __init__(self): super().__init__() # Some buttons layout = QVBoxLayout() self.name = QLineEdit() layout.addWidget(self.name) self.country = QLineEdit() layout.addWidget(self.country) self.website = QLineEdit() layout.addWidget(self.website) self.number_of_lines = QSpinBox() layout.addWidget(self.number_of_lines) btn_run = QPushButton("Execute") btn_run.clicked.connect(self.start) layout.addWidget(btn_run) w = QWidget() w.setLayout(layout) self.setCentralWidget(w) # Thread runner self.threadpool = QThreadPool() self.show()
def create_new_show(self): w = QDialog() w.setWindowTitle("Create New Show") w.setLayout(QFormLayout()) show_name = QLineEdit("New Show") w.layout().addRow(QLabel("New Show Title:"), show_name) prod_days = QSpinBox() w.layout().addRow(QLabel("Days of production:"), prod_days) calendar_input = QCalendarWidget() w.layout().addRow(QLabel("Start date:")) w.layout().addRow(calendar_input) if self.shows: # If a show has already been created. previous_show = self.shows[-1] prod_days.setValue(previous_show.prod_days) accept = QPushButton("Create") accept.clicked.connect(w.accept) reject = QPushButton("Cancel") reject.clicked.connect(w.reject) w.layout().addRow(accept, reject) if w.exec_() == QDialog.Accepted: print("New show name:", show_name.text(), "Days of pre-production", prod_days.value()) selected_date = calendar_input.selectedDate() start_date = datetime.date(selected_date.year(), selected_date.month(), selected_date.day()) self.shows.append( Show(show_name.text(), prod_days.value(), start_date))
def createMessageGroupBox(self): self.messageGroupBox = QGroupBox("Balloon Message") self.typeLabel = QLabel("Type:") self.typeComboBox = QComboBox() self.typeComboBox.addItem("None", QSystemTrayIcon.NoIcon) self.typeComboBox.addItem( self.style().standardIcon(QStyle.SP_MessageBoxInformation), "Information", QSystemTrayIcon.Information, ) self.typeComboBox.addItem( self.style().standardIcon(QStyle.SP_MessageBoxWarning), "Warning", QSystemTrayIcon.Warning, ) self.typeComboBox.addItem( self.style().standardIcon(QStyle.SP_MessageBoxCritical), "Critical", QSystemTrayIcon.Critical, ) self.typeComboBox.addItem(QIcon(), "Custom icon", -1) self.typeComboBox.setCurrentIndex(1) self.durationLabel = QLabel("Duration:") self.durationSpinBox = QSpinBox() self.durationSpinBox.setRange(5, 60) self.durationSpinBox.setSuffix(" s") self.durationSpinBox.setValue(15) self.durationWarningLabel = QLabel("(some systems might ignore this hint)") self.durationWarningLabel.setIndent(10) self.titleLabel = QLabel("Title:") self.titleEdit = QLineEdit("Cannot connect to network") self.bodyLabel = QLabel("Body:") self.bodyEdit = QTextEdit() self.bodyEdit.setPlainText("Don't believe me. Honestly, I don't have a clue." "\nClick this balloon for details.") self.showMessageButton = QPushButton("Show Message") self.showMessageButton.setDefault(True) messageLayout = QGridLayout() messageLayout.addWidget(self.typeLabel, 0, 0) messageLayout.addWidget(self.typeComboBox, 0, 1, 1, 2) messageLayout.addWidget(self.durationLabel, 1, 0) messageLayout.addWidget(self.durationSpinBox, 1, 1) messageLayout.addWidget(self.durationWarningLabel, 1, 2, 1, 3) messageLayout.addWidget(self.titleLabel, 2, 0) messageLayout.addWidget(self.titleEdit, 2, 1, 1, 4) messageLayout.addWidget(self.bodyLabel, 3, 0) messageLayout.addWidget(self.bodyEdit, 3, 1, 2, 4) messageLayout.addWidget(self.showMessageButton, 5, 4) messageLayout.setColumnStretch(3, 1) messageLayout.setRowStretch(4, 1) self.messageGroupBox.setLayout(messageLayout)
def __init__(self, image, parent=None): super(PlanesWidget, self).__init__(parent) self.chan_combo = QComboBox() self.chan_combo.addItems( [self.tr('Luminance'), self.tr('Red'), self.tr('Green'), self.tr('Blue'), self.tr('RGB Norm')]) self.plane_spin = QSpinBox() self.plane_spin.setPrefix(self.tr('Bit ')) self.plane_spin.setRange(0, 7) self.filter_combo = QComboBox() self.filter_combo.addItems([self.tr('Disabled'), self.tr('Median'), self.tr('Gaussian')]) self.image = image self.viewer = ImageViewer(self.image, self.image) self.planes = None self.preprocess() self.chan_combo.currentIndexChanged.connect(self.preprocess) self.plane_spin.valueChanged.connect(self.process) self.filter_combo.currentIndexChanged.connect(self.process) top_layout = QHBoxLayout() top_layout.addWidget(QLabel(self.tr('Channel:'))) top_layout.addWidget(self.chan_combo) top_layout.addWidget(QLabel(self.tr('Plane:'))) top_layout.addWidget(self.plane_spin) top_layout.addWidget(QLabel(self.tr('Filter:'))) top_layout.addWidget(self.filter_combo) top_layout.addStretch() main_layout = QVBoxLayout() main_layout.addLayout(top_layout) main_layout.addWidget(self.viewer) self.setLayout(main_layout)
def createBottomRightGroupBox(self): self.bottomRightGroupBox = QGroupBox("Group 3") self.bottomRightGroupBox.setCheckable(True) self.bottomRightGroupBox.setChecked(True) lineEdit = QLineEdit('s3cRe7') lineEdit.setEchoMode(QLineEdit.Password) spinBox = QSpinBox(self.bottomRightGroupBox) spinBox.setValue(50) dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox) dateTimeEdit.setDateTime(QDateTime.currentDateTime()) slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox) slider.setValue(40) scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox) scrollBar.setValue(60) dial = QDial(self.bottomRightGroupBox) dial.setValue(30) dial.setNotchesVisible(True) layout = QGridLayout() layout.addWidget(lineEdit, 0, 0, 1, 2) layout.addWidget(spinBox, 1, 0, 1, 2) layout.addWidget(dateTimeEdit, 2, 0, 1, 2) layout.addWidget(slider, 3, 0) layout.addWidget(scrollBar, 4, 0) layout.addWidget(dial, 3, 1, 2, 1) layout.setRowStretch(5, 1) self.bottomRightGroupBox.setLayout(layout)
def __create_spinbox_label(self, value: int, label: str, minimum: int, maximum: int, min_width: int = 200) -> Tuple[Dict, Dict]: """__create_line_label will create a spinner and corresponding label Arguments: value {int} -- Default value label {str} -- Label name minimum {int} -- Minimum value maximum {int} -- Maximum value min_width {int} -- Minium width (default: {200}) Returns: Tuple[Dict, Dict] -- Line Edit, Label """ spin_box = QSpinBox() spin_box.setValue(value) spin_box.setMinimumWidth(min_width) spin_box.setMinimum(minimum) spin_box.setMaximum(maximum) label = QLabel(label) label.setBuddy(spin_box) return spin_box, label