我们从Python开源项目中,提取了以下32个代码示例,用于说明如何使用PyQt5.QtWidgets.QRadioButton()。
def __init__(self, ebeveyn=None): super(Son, self).__init__(ebeveyn) self.e = ebeveyn self.kapanacak_mi =False kutu = QGridLayout() self.setLayout(kutu) milis_logo = QLabel() milis_logo.setAlignment(Qt.AlignCenter) milis_logo.setPixmap(QPixmap("./resimler/milis-logo.svg")) kutu.addWidget(milis_logo,0,0,1,2) self.veda_label = QLabel() self.veda_label.setAlignment(Qt.AlignCenter) self.veda_label.setWordWrap(True) kutu.addWidget(self.veda_label,1,0,1,2) self.denemeye_devam = QRadioButton() self.denemeye_devam.setIcon(QIcon("./resimler/cik.svg")) self.denemeye_devam.setIconSize(QSize(50,50)) self.denemeye_devam.toggled.connect(self.degisti) kutu.addWidget(self.denemeye_devam,2,0,1,1) self.kapat = QRadioButton() self.kapat.setIcon(QIcon("./resimler/yeniden-baslat.svg")) self.kapat.setIconSize(QSize(50,50)) self.kapat.toggled.connect(self.degisti) kutu.addWidget(self.kapat,2,1,1,1) self.denemeye_devam.setChecked(True)
def __init__(self, parent=None): super().__init__(parent) self.wizard = self.parent() options = ['ecoinvent homepage', 'local 7z-archive', 'local directory with ecospold2 files'] self.radio_buttons = [QtWidgets.QRadioButton(o) for o in options] self.option_box = QtWidgets.QGroupBox('Choose type of database import') box_layout = QtWidgets.QVBoxLayout() for i, button in enumerate(self.radio_buttons): box_layout.addWidget(button) if i == 0: button.setChecked(True) self.option_box.setLayout(box_layout) self.layout = QtWidgets.QVBoxLayout() self.layout.addWidget(self.option_box) self.setLayout(self.layout)
def refresh_classes(self,event=None): for i in reversed(range(self.class_line.count())): w = self.class_line.itemAt(i).widget() self.class_line.removeWidget(w) w.setParent(None) for i, k in enumerate(self.classes.key): if k == ' ': text = ' ' else: text = k button = QtWidgets.QRadioButton(text, self) button.clicked.connect(self.show_selected_class) if i == 0: button.setChecked(True) self.class_num.addButton(button, i) self.class_line.addWidget(button, i/5, i%5)
def refresh_class_line(self): for i in reversed(range(self.class_line.count())): w = self.class_line.itemAt(i).widget() self.class_line.removeWidget(w) w.setParent(None) self.class_num = QtWidgets.QButtonGroup() button = QtWidgets.QRadioButton('All') button.setChecked(True) self.class_num.addButton(button, 0) self.class_line.addWidget(button, 0, 0) for i, k in enumerate(self.classes.key): if k == ' ': text = ' ' else: text = k button = QtWidgets.QRadioButton(text, self) self.class_num.addButton(button, i+1) self.class_line.addWidget(button, (i+1)/5, (i+1)%5) self.class_list_summary.setText(self.classes.gen_summary())
def add_device_radio_to_widget(self, devices_list): """ add device radio to widget :param devices_list: :return: """ self.clear_devices_radio_btn() self.devices_list = devices_list for device in devices_list: radio = QRadioButton(device.id + " (" + device.description + ")") if device.status != Device.ONLINE: radio.setDisabled(True) self.devices_radio_buttons.append(radio) self.devices_layout.addWidget(radio) # set default checked radio for device_radio in self.devices_radio_buttons: if Device.ONLINE[1] in device_radio.text(): device_radio.setChecked(True) break
def __init__(self, choices, title = "select one from choices", parent = None): super(ChoiceDialog, self).__init__(parent) layout = QVBoxLayout(self) self.choiceButtonGroup=QButtonGroup(parent) # it is not a visible UI self.choiceButtonGroup.setExclusive(True) if choices and len(choices)>=1: self.choices = choices for id, choice in enumerate(self.choices): rb = QRadioButton(choice) self.choiceButtonGroup.addButton(rb) self.choiceButtonGroup.setId(rb, id) # negative id if not specified layout.addWidget(rb) self.choiceButtonGroup.buttonClicked.connect(self.choiceChanged) # OK and Cancel buttons buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons) self.setLayout(layout) self.setWindowTitle(title)
def __init__(self): QWidget.__init__(self, flags=Qt.Widget) self.setWindowTitle("RadioButton") # ??? ?? ?? ?? rb_1 = QRadioButton("RadioButton 1") rb_2 = QRadioButton("RadioButton 2") rb_3 = QRadioButton("RadioButton 3") rb_4 = QRadioButton("RadioButton 4") rb_5 = QRadioButton("RadioButton 5") # ???? ?? ? Form Widget? ?? base_layout = QBoxLayout(QBoxLayout.TopToBottom, self) base_layout.addWidget(rb_1) base_layout.addWidget(rb_2) base_layout.addWidget(rb_3) base_layout.addWidget(rb_4) base_layout.addWidget(rb_5) self.setLayout(base_layout)
def __init__(self, parent=None): super().__init__(parent) self.ui = Ui_DialogFilterBandwidth() self.ui.setupUi(self) bw_type = constants.SETTINGS.value("bandpass_filter_bw_type", "Medium", str) custom_bw = constants.SETTINGS.value("bandpass_filter_custom_bw", 0.1, float) for item in dir(self.ui): item = getattr(self.ui, item) if isinstance(item, QLabel): name = item.objectName().replace("label", "") key = next((key for key in Filter.BANDWIDTHS.keys() if name.startswith(key.replace(" ", ""))), None) if key is not None and name.endswith("Bandwidth"): item.setText("{0:n}".format(Filter.BANDWIDTHS[key])) elif key is not None and name.endswith("KernelLength"): item.setText(str(Filter.get_filter_length_from_bandwidth(Filter.BANDWIDTHS[key]))) elif isinstance(item, QRadioButton): item.setChecked(bw_type.replace(" ", "_") == item.objectName().replace("radioButton", "")) self.ui.doubleSpinBoxCustomBandwidth.setValue(custom_bw) self.ui.spinBoxCustomKernelLength.setValue(Filter.get_filter_length_from_bandwidth(custom_bw)) self.create_connects()
def createTopGroupBox(self): self.topGroupBox = QGroupBox('Integration Time') self.it2_4ms = QRadioButton() self.it2_4ms.setText('2.4ms') self.it2_4ms.toggled.connect(lambda: self.itstate(self.it2_4ms)) self.it24ms = QRadioButton() self.it24ms.setText('24ms') self.it24ms.toggled.connect(lambda: self.itstate(self.it24ms)) self.it50ms = QRadioButton() self.it50ms.setText('50ms') self.it50ms.toggled.connect(lambda: self.itstate(self.it50ms)) self.it101ms = QRadioButton() self.it101ms.setText('101ms') self.it101ms.toggled.connect(lambda: self.itstate(self.it101ms)) self.it154ms = QRadioButton() self.it154ms.setText('154ms') self.it154ms.toggled.connect(lambda: self.itstate(self.it154ms)) self.it700ms = QRadioButton() self.it700ms.setText('700ms') self.it700ms.toggled.connect(lambda: self.itstate(self.it700ms)) self.it2_4ms.setChecked(True) layout = QHBoxLayout() layout.addWidget(self.it2_4ms) layout.addWidget(self.it24ms) layout.addWidget(self.it50ms) layout.addWidget(self.it101ms) layout.addWidget(self.it154ms) layout.addWidget(self.it700ms) layout.addStretch(1) self.topGroupBox.setLayout(layout)
def createMidGroupBox(self): self.midGroupBox = QGroupBox('Gain') self.gain1 = QRadioButton() self.gain1.setText('1X') self.gain1.toggled.connect(lambda: self.gnstate(self.gain1)) self.gain4 = QRadioButton() self.gain4.setText('4X') self.gain4.toggled.connect(lambda: self.gnstate(self.gain4)) self.gain16 = QRadioButton() self.gain16.setText('16X') self.gain16.toggled.connect(lambda: self.gnstate(self.gain16)) self.gain60 = QRadioButton() self.gain60.setText('60X') self.gain60.toggled.connect(lambda: self.gnstate(self.gain60)) self.gain1.setChecked(True) layout = QHBoxLayout() layout.addWidget(self.gain1) layout.addWidget(self.gain4) layout.addWidget(self.gain16) layout.addWidget(self.gain60) layout.addStretch(1) self.midGroupBox.setLayout(layout)
def add_roi_radiobutton(self, num): button = QtWidgets.QRadioButton(str(num)) if num == 0: button.setChecked(True) self.current_roi.addButton(button, num) self.roi_choice.addWidget(button, num/5, num%5)
def __init__(self): QDialog.__init__(self) layout = QGridLayout(self) lblWBS = QLabel("lblWBS") lblDialog = QLabel("lblDialog") btnOK = QPushButton("OK") layout.addWidget(btnOK, 5, 1) optGreen = QRadioButton() optYellow = QRadioButton() optRed = QRadioButton() lblGreen = QLabel("Green") lblYellow = QLabel("Yellow") lblRed = QLabel("Red") layout.addWidget(lblWBS, 0, 1) layout.addWidget(lblDialog, 1, 1) l = [optGreen, lblGreen, optYellow, lblYellow, optRed, lblRed] def randomOptions(): for w in l: layout.removeWidget(w) rdmOpt = [2,3,4] random.shuffle(rdmOpt) for i in range(len(l)): layout.addWidget(l[i], rdmOpt[i//2], i % 2) randomOptions() btnOK.clicked.connect(randomOptions) self.setWindowTitle("PALCDMS")
def __init__(self, parent): super().__init__('Search mode:', parent) self._radio_buttons = { SearchMode.Text: QtWidgets.QRadioButton('Text', self), SearchMode.Note: QtWidgets.QRadioButton('Note', self), SearchMode.Actor: QtWidgets.QRadioButton('Actor', self), SearchMode.Style: QtWidgets.QRadioButton('Style', self), } layout = QtWidgets.QVBoxLayout(self) for radio_button in self._radio_buttons.values(): layout.addWidget(radio_button) self._radio_buttons[SearchMode.Text].setChecked(True)
def __init__(self, parent): super().__init__('Alignment', parent) self.radio_buttons = { x: QtWidgets.QRadioButton( [ '\N{SOUTH WEST ARROW}', '\N{DOWNWARDS ARROW}', '\N{SOUTH EAST ARROW}', '\N{LEFTWARDS ARROW}', '\N{BLACK DIAMOND}', '\N{RIGHTWARDS ARROW}', '\N{NORTH WEST ARROW}', '\N{UPWARDS ARROW}', '\N{NORTH EAST ARROW}', ][x - 1], self) for x in range(1, 10) } layout = QtWidgets.QGridLayout(self) layout.setColumnStretch(0, 1) layout.setColumnStretch(1, 1) layout.setColumnStretch(2, 1) layout.addWidget(self.radio_buttons[7], 0, 0) layout.addWidget(self.radio_buttons[8], 0, 1) layout.addWidget(self.radio_buttons[9], 0, 2) layout.addWidget(self.radio_buttons[4], 1, 0) layout.addWidget(self.radio_buttons[5], 1, 1) layout.addWidget(self.radio_buttons[6], 1, 2) layout.addWidget(self.radio_buttons[1], 2, 0) layout.addWidget(self.radio_buttons[2], 2, 1) layout.addWidget(self.radio_buttons[3], 2, 2) for radio_button in self.radio_buttons.values(): radio_button.toggled.connect( lambda _event: self.changed.emit())
def __init__(self): QWidget.__init__(self, flags=Qt.Widget) self.setWindowTitle("RadioButton") # ??? ?? ?? ?? grp_1 = QGroupBox("Group 1") grp_2 = QGroupBox("Group 2") rb_1 = QRadioButton("RadioButton 1") rb_2 = QRadioButton("RadioButton 2") rb_3 = QRadioButton("RadioButton 3") rb_4 = QRadioButton("RadioButton 4") rb_5 = QRadioButton("RadioButton 5") # ???? ?? ? Form Widget? ?? base_layout = QBoxLayout(QBoxLayout.TopToBottom, self) grp_1_layout = QBoxLayout(QBoxLayout.TopToBottom) grp_2_layout = QBoxLayout(QBoxLayout.TopToBottom) grp_1.setLayout(grp_1_layout) grp_2.setLayout(grp_2_layout) grp_1_layout.addWidget(rb_1) grp_1_layout.addWidget(rb_2) grp_1_layout.addWidget(rb_3) grp_2_layout.addWidget(rb_4) grp_2_layout.addWidget(rb_5) base_layout.addWidget(grp_1) base_layout.addWidget(grp_2) self.setLayout(base_layout)
def init_widget(self): """ ?? ??? ???? ??? """ self.setWindowTitle("Hello World") form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self) self.setLayout(form_lbx) # 1? ???? ?? gb_1 = QGroupBox(self) gb_1.setTitle("GroupBox") form_lbx.addWidget(gb_1) lbx = QBoxLayout(QBoxLayout.LeftToRight, parent=self) gb_1.setLayout(lbx) lbx.addWidget(QCheckBox("check box #1")) lbx.addWidget(QCheckBox("check box #2")) lbx.addWidget(QCheckBox("check box #3")) # 2? ????, ???? ??? ??, ?? ??? ???? gb_2 = QGroupBox(self) gb_2.setTitle("GroupBox") gb_2.setCheckable(True) gb_2.setChecked(False) form_lbx.addWidget(gb_2) lbx = QBoxLayout(QBoxLayout.LeftToRight, parent=self) gb_2.setLayout(lbx) lbx.addWidget(QRadioButton("radio button #1")) lbx.addWidget(QRadioButton("radio button #2")) lbx.addWidget(QRadioButton("radio button #3"))
def init_widget(self): """ ?? ??? ???? ??? """ self.setWindowTitle("Hello World") form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self) self.setLayout(form_lbx) gb_1 = QGroupBox(self) gb_1.setTitle("GroupBox") form_lbx.addWidget(gb_1) lbx = QBoxLayout(QBoxLayout.LeftToRight) gb_1.setLayout(lbx) lbx.addWidget(QCheckBox("check box #1")) lbx.addWidget(QCheckBox("check box #2")) lbx.addWidget(QCheckBox("check box #3")) gb_2 = QGroupBox(self) gb_2.setTitle("GroupBox") gb_2.setCheckable(True) gb_2.setChecked(False) form_lbx.addWidget(gb_2) lbx = QBoxLayout(QBoxLayout.LeftToRight) gb_2.setLayout(lbx) lbx.addWidget(QRadioButton("radio button #1")) lbx.addWidget(QRadioButton("radio button #2")) lbx.addWidget(QRadioButton("radio button #3"))
def checked_radiobutton(self): for rb in dir(self.ui): radio_button = getattr(self.ui, rb) if isinstance(radio_button, QRadioButton) and radio_button.isChecked(): return radio_button return None
def __init__(self, parent=None): super(Dialog, self).__init__(parent) self.setWindowTitle("Settings") self.setWindowIcon(QIcon('images/logo.png')) self.save_settings = QtWidgets.QPushButton('Save') self.save_settings.setObjectName("save_settings") self.extension_1 = QtWidgets.QRadioButton('png') self.extension_2 = QtWidgets.QRadioButton('jpg') self.extension_3 = QtWidgets.QRadioButton('??? ? ????????? ???????????') self.extension_1.setObjectName("extension_1") self.extension_2.setObjectName("extension_2") self.extension_3.setObjectName("extension_3") self.extension_3.setChecked(True) self.extension_group = QtWidgets.QGroupBox('extension') v_dmain_box = QtWidgets.QVBoxLayout() v_dmain_box.addWidget(self.extension_1) v_dmain_box.addWidget(self.extension_2) v_dmain_box.addWidget(self.extension_3) self.extension_group.setLayout(v_dmain_box) vlayout = QtWidgets.QVBoxLayout() vlayout.addWidget(self.extension_group) vlayout.addWidget(self.save_settings) self.setLayout(vlayout) """connecting""" self.save_settings.clicked.connect(self.accept)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(480, 180) Form.setLayoutDirection(QtCore.Qt.LeftToRight) Form.setAutoFillBackground(False) Form.setWindowIcon(QtGui.QIcon('./batman.ico')) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.label_url = QtWidgets.QLabel(Form) self.label_url.setAlignment(QtCore.Qt.AlignCenter) self.label_url.setObjectName("label_url") self.gridLayout.addWidget(self.label_url, 0, 0, 1, 1) #??url???? self.edit_url = QtWidgets.QLineEdit(Form) self.edit_url.setObjectName("edit_url") self.gridLayout.addWidget(self.edit_url, 0, 1, 1, 1) #???? self.bt_preview = QtWidgets.QPushButton(Form) self.bt_preview.setAutoDefault(True) self.bt_preview.setDefault(False) self.bt_preview.setObjectName("bt_preview") self.bt_preview.clicked.connect(self.preview)#? self.gridLayout.addWidget(self.bt_preview, 0, 2, 1, 1) #?????? self.bt_crawl = QtWidgets.QPushButton(Form) self.bt_crawl.setDefault(True) self.bt_crawl.setObjectName("bt_crawl") self.bt_crawl.clicked.connect(self.crawl)#? self.gridLayout.addWidget(self.bt_crawl, 0, 3, 1, 2) self.label_dir = QtWidgets.QLabel(Form) self.label_dir.setAlignment(QtCore.Qt.AlignCenter) self.label_dir.setObjectName("label_dir") self.gridLayout.addWidget(self.label_dir, 1, 0, 1, 1) #???????? self.edit_dir = QtWidgets.QLineEdit(Form) self.edit_dir.setObjectName("edit_dir") self.edit_url.textChanged.connect(self.edit_dir.clear)#URL??????? self.edit_url.textChanged.connect(self.loaded_statu)#?????? self.edit_dir.textChanged.connect(self.loaded_statu)#?????? self.gridLayout.addWidget(self.edit_dir, 1, 1, 1, 1) #?????? self.bt_select = QtWidgets.QPushButton(Form) self.bt_select.setObjectName("bt_select") self.bt_select.clicked.connect(self.select_dir) self.gridLayout.addWidget(self.bt_select, 1, 2, 1, 1) #???? self.bt_parallel = QtWidgets.QRadioButton(Form) self.bt_parallel.setChecked(False) self.bt_parallel.setObjectName("bt_parallel") self.gridLayout.addWidget(self.bt_parallel, 1, 4, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(186, 154) Form.setMaximumSize(QtCore.QSize(200, 16777215)) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 7, 0, 1, 2) self.linkCombo = QtWidgets.QComboBox(Form) self.linkCombo.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents) self.linkCombo.setObjectName("linkCombo") self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2) self.autoPercentSpin = QtWidgets.QSpinBox(Form) self.autoPercentSpin.setEnabled(True) self.autoPercentSpin.setMinimum(1) self.autoPercentSpin.setMaximum(100) self.autoPercentSpin.setSingleStep(1) self.autoPercentSpin.setProperty("value", 100) self.autoPercentSpin.setObjectName("autoPercentSpin") self.gridLayout.addWidget(self.autoPercentSpin, 2, 2, 1, 2) self.autoRadio = QtWidgets.QRadioButton(Form) self.autoRadio.setChecked(True) self.autoRadio.setObjectName("autoRadio") self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2) self.manualRadio = QtWidgets.QRadioButton(Form) self.manualRadio.setObjectName("manualRadio") self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2) self.minText = QtWidgets.QLineEdit(Form) self.minText.setObjectName("minText") self.gridLayout.addWidget(self.minText, 1, 2, 1, 1) self.maxText = QtWidgets.QLineEdit(Form) self.maxText.setObjectName("maxText") self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1) self.invertCheck = QtWidgets.QCheckBox(Form) self.invertCheck.setObjectName("invertCheck") self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4) self.mouseCheck = QtWidgets.QCheckBox(Form) self.mouseCheck.setChecked(True) self.mouseCheck.setObjectName("mouseCheck") self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4) self.visibleOnlyCheck = QtWidgets.QCheckBox(Form) self.visibleOnlyCheck.setObjectName("visibleOnlyCheck") self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2) self.autoPanCheck = QtWidgets.QCheckBox(Form) self.autoPanCheck.setObjectName("autoPanCheck") self.gridLayout.addWidget(self.autoPanCheck, 4, 2, 1, 2) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def _load_fitter_info(self): """ Load fitter info from pytc. """ # get list of Fitter subclasses, sorted by name objects = [] for name, obj in inspect.getmembers(pytc.fitters): if inspect.isclass(obj): objects.append((name,obj)) objects.sort() self._fitter_classes = [] self._fitter_vars = [] self._fitter_widgets = [] self._fitter_options = [] self._fitter_names = [] self._fitter_radio_buttons = [] self._fitter_defaults = [] # For every Fitter subclass... for name, obj in objects: self._fitter_classes.append(obj) # Make new widget self._fitter_widgets.append(QW.QFrame()) self._fitter_options.append(QW.QFormLayout(self._fitter_widgets[-1])) # Add name and radio button to widget self._fitter_names.append(name.replace("Fitter","")) self._fitter_radio_buttons.append(QW.QRadioButton(self._fitter_names[-1])) self._fitter_radio_buttons[-1].toggled.connect(self._select_fit) # Figure out arguments for this Fitter subclass args = inspect.getargspec(obj) if len(args.args) == 1 and args.defaults is None: self._fitter_defaults.append({}) else: self._fitter_defaults.append({arg: param for arg, param in zip(args.args[1:], args.defaults)}) fitter_keys = list(self._fitter_defaults[-1].keys()) fitter_keys.sort() # Append fit option self._fitter_vars.append({}) for n in fitter_keys: label_name = str(n).replace("_", " ") + ": " label = QW.QLabel(label_name.title(), self) entry = InputWidget(self._fitter_defaults[-1][n]) self._fitter_vars[-1][n] = entry self._fitter_options[-1].addRow(label,entry) # map from name back to index in lists above self._fitter_name_to_index = dict([(v,i) for i, v in enumerate(self._fitter_names)])
def __init__( self, wizard_state ): super().__init__() self.wizard_state = wizard_state self.setTitle( T_('Add Project') ) self.setSubTitle( T_('Where is the Project?') ) self.radio_browse_existing = QtWidgets.QRadioButton( T_('Browse for an existing project') ) self.radio_scan_for_existing = QtWidgets.QRadioButton( T_('Scan for existing projects') ) self.radio_scan_for_existing.setChecked( True ) self.radio_browse_existing.setChecked( False ) self.grp_show = QtWidgets.QButtonGroup() self.grp_show.addButton( self.radio_scan_for_existing ) self.grp_show.addButton( self.radio_browse_existing ) self.all_clone_radio = [] for id_, page in sorted( wizard_state.all_clone_pages.items() ): radio = QtWidgets.QRadioButton( page.radioButtonLabel() ) self.all_clone_radio.append( (id_, radio) ) self.grp_show.addButton( radio ) self.all_init_radio = [] for id_, page in sorted( wizard_state.all_init_pages.items() ): radio = QtWidgets.QRadioButton( page.radioButtonLabel() ) self.all_init_radio.append( (id_, radio) ) self.grp_show.addButton( radio ) layout = QtWidgets.QVBoxLayout() layout.addWidget( QtWidgets.QLabel( '<b>%s</b>' % (T_('Add an existing local project'),) ) ) layout.addWidget( self.radio_scan_for_existing ) layout.addWidget( self.radio_browse_existing ) layout.addWidget( QtWidgets.QLabel( '<b>%s</b>' % (T_('Add an external project'),) ) ) for id_, radio in self.all_clone_radio: layout.addWidget( radio ) layout.addWidget( QtWidgets.QLabel( '<b>%s</b>' % (T_('Create an empty project'),) ) ) for id_, radio in self.all_init_radio: layout.addWidget( radio ) self.setLayout( layout )
def init_ui(self): self.setWindowTitle(_('Bib')) self.setWindowIcon(QIcon(config.ICON)) self.setSizeGripEnabled(False) self.setModal(True) self.layout = QFormLayout(self) self.label_template = QLabel(_('Template')) self.item_template = AdvComboBox() self.item_template.addItems(get_templates(config.template_dir('bib'))) self.layout.addRow(self.label_template, self.item_template) self.item_custom_path = QPushButton(_('Choose template')) def select_custom_path(): file_name = get_open_file_name(_('Open HTML template'), _("HTML file (*.html)")) self.item_template.setCurrentText(file_name) self.item_custom_path.clicked.connect(select_custom_path) self.layout.addRow(self.item_custom_path) self.sorting_type_box = QGroupBox(_('Sorting by')) self.sorting_type_layout = QFormLayout() self.sorting_type_bib = QRadioButton(_('Bib')) self.sorting_type_bib.setChecked(True) self.sorting_type_layout.addRow(self.sorting_type_bib) self.sorting_type_org = QRadioButton(_('Team')) self.sorting_type_layout.addRow(self.sorting_type_org) self.sorting_type_group = QRadioButton(_('Group')) self.sorting_type_layout.addRow(self.sorting_type_group) self.sorting_type_box.setLayout(self.sorting_type_layout) self.layout.addRow(self.sorting_type_box) def cancel_changes(): self.close() def apply_changes(): try: self.apply_changes_impl() except Exception as e: logging.exception(str(e)) self.close() self.button_ok = QPushButton(_('OK')) self.button_ok.clicked.connect(apply_changes) self.button_cancel = QPushButton(_('Cancel')) self.button_cancel.clicked.connect(cancel_changes) self.layout.addRow(self.button_ok, self.button_cancel) self.show() self.button_ok.setFocus()
def init_ui(self): self.setWindowTitle(_('Scores assign')) self.setWindowIcon(QIcon(config.ICON)) self.setSizeGripEnabled(False) self.setModal(False) self.setMinimumWidth(650) self.layout = QFormLayout(self) self.label_list = QRadioButton(_('Value list')) self.label_list.setChecked(True) self.item_list = QLineEdit() self.item_list.setText('40;37;35;33;32;31;30;29;28;27;26;25;24;23;22;21;20;19;18;17;16;15;14;13;12;11;10;9;8;7;6;5;4;3;2;1') self.layout.addRow(self.label_list, self.item_list) self.label_formula = QRadioButton(_('Formula')) self.item_formula = QLineEdit() self.layout.addRow(self.label_formula, self.item_formula) self.label_formula_hint = QLabel('Hint: You can use following variables: LeaderTime, Time, Year, Place, Length') self.layout.addRow(self.label_formula_hint) self.label_limit = QCheckBox(_('Limit per team')) self.item_limit = QSpinBox() self.item_limit.setMaximumWidth(50) self.layout.addRow(self.label_limit, self.item_limit) def cancel_changes(): self.close() def apply_changes(): try: self.apply_changes_impl() except Exception as e: logging.exception(str(e)) self.close() self.button_ok = QPushButton(_('OK')) self.button_ok.clicked.connect(apply_changes) self.button_cancel = QPushButton(_('Cancel')) self.button_cancel.clicked.connect(cancel_changes) self.layout.addRow(self.button_ok, self.button_cancel) self.show()
def setupUi(self): self.setObjectName("number_change") self.setWindowModality(QtCore.Qt.WindowModal) self.resize(319, 167) self.setSizeGripEnabled(False) self.setModal(True) self.button_box = QtWidgets.QDialogButtonBox(self) self.button_box.setGeometry(QtCore.QRect(70, 120, 161, 32)) self.button_box.setOrientation(QtCore.Qt.Horizontal) self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.button_box.setObjectName("button_box") self.layoutWidget = QtWidgets.QWidget(self) self.layoutWidget.setGeometry(QtCore.QRect(14, 10, 290, 48)) self.layoutWidget.setObjectName("layoutWidget") self.number_grid_layout = QtWidgets.QGridLayout(self.layoutWidget) self.number_grid_layout.setContentsMargins(0, 0, 0, 0) self.number_grid_layout.setObjectName("number_grid_layout") self.source_num_label = QtWidgets.QLabel(self.layoutWidget) self.source_num_label.setObjectName("source_num_label") self.number_grid_layout.addWidget(self.source_num_label, 0, 0, 1, 1) self.source_num_spin_box = QtWidgets.QSpinBox(self.layoutWidget) self.source_num_spin_box.setMaximum(100000) self.source_num_spin_box.setObjectName("source_num_spin_box") self.number_grid_layout.addWidget(self.source_num_spin_box, 0, 1, 1, 1) self.source_info_label = QtWidgets.QLabel(self.layoutWidget) self.source_info_label.setObjectName("source_info_label") self.number_grid_layout.addWidget(self.source_info_label, 0, 2, 1, 1) self.target_num_label = QtWidgets.QLabel(self.layoutWidget) self.target_num_label.setObjectName("target_num_label") self.number_grid_layout.addWidget(self.target_num_label, 1, 0, 1, 1) self.target_num_spin_box = QtWidgets.QSpinBox(self.layoutWidget) self.target_num_spin_box.setMaximum(100000) self.target_num_spin_box.setObjectName("target_num_spin_box") self.number_grid_layout.addWidget(self.target_num_spin_box, 1, 1, 1, 1) self.target_info_label = QtWidgets.QLabel(self.layoutWidget) self.target_info_label.setObjectName("target_info_label") self.number_grid_layout.addWidget(self.target_info_label, 1, 2, 1, 1) self.layoutWidget1 = QtWidgets.QWidget(self) self.layoutWidget1.setGeometry(QtCore.QRect(14, 70, 256, 42)) self.layoutWidget1.setObjectName("layoutWidget1") self.options_vert_layout = QtWidgets.QVBoxLayout(self.layoutWidget1) self.options_vert_layout.setContentsMargins(0, 0, 0, 0) self.options_vert_layout.setObjectName("options_vert_layout") self.remove_radio_button = QtWidgets.QRadioButton(self.layoutWidget1) self.remove_radio_button.setChecked(True) self.remove_radio_button.setObjectName("remove_radio_button") self.options_vert_layout.addWidget(self.remove_radio_button) self.replace_radio_button = QtWidgets.QRadioButton(self.layoutWidget1) self.replace_radio_button.setObjectName("replace_radio_button") self.options_vert_layout.addWidget(self.replace_radio_button) self.retranslateUi() self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) QtCore.QMetaObject.connectSlotsByName(self)
def setupUi(self, window): window.setObjectName("window") window.resize(247, 172) window.setMinimumSize(QtCore.QSize(247, 172)) window.setMaximumSize(QtCore.QSize(247, 172)) self.opt_square = QtWidgets.QRadioButton(window) self.opt_square.setGeometry(QtCore.QRect(30, 37, 119, 28)) self.opt_square.setMinimumSize(QtCore.QSize(0, 28)) self.opt_square.setMaximumSize(QtCore.QSize(140, 28)) self.opt_square.setObjectName("opt_square") self.spb_width = QtWidgets.QSpinBox(window) self.spb_width.setGeometry(QtCore.QRect(23, 73, 80, 28)) self.spb_width.setMinimumSize(QtCore.QSize(38, 28)) self.spb_width.setMaximumSize(QtCore.QSize(80, 28)) self.spb_width.setMinimum(1) self.spb_width.setMaximum(999) self.spb_width.setProperty("value", 30) self.spb_width.setObjectName("spb_width") self.btn_create = QtWidgets.QPushButton(window) self.btn_create.setGeometry(QtCore.QRect(153, 120, 75, 31)) self.btn_create.setAutoDefault(True) self.btn_create.setObjectName("btn_create") self.btn_cancel = QtWidgets.QPushButton(window) self.btn_cancel.setGeometry(QtCore.QRect(23, 120, 75, 31)) self.btn_cancel.setAutoDefault(False) self.btn_cancel.setObjectName("btn_cancel") self.spb_height = QtWidgets.QSpinBox(window) self.spb_height.setGeometry(QtCore.QRect(133, 73, 80, 28)) self.spb_height.setMinimumSize(QtCore.QSize(38, 28)) self.spb_height.setMaximumSize(QtCore.QSize(80, 28)) self.spb_height.setMinimum(1) self.spb_height.setMaximum(999) self.spb_height.setProperty("value", 30) self.spb_height.setObjectName("spb_height") self.label_2 = QtWidgets.QLabel(window) self.label_2.setGeometry(QtCore.QRect(113, 70, 10, 35)) self.label_2.setMinimumSize(QtCore.QSize(10, 0)) self.label_2.setMaximumSize(QtCore.QSize(10, 16777215)) self.label_2.setObjectName("label_2") self.opt_hex = QtWidgets.QRadioButton(window) self.opt_hex.setGeometry(QtCore.QRect(30, 10, 121, 28)) self.opt_hex.setMinimumSize(QtCore.QSize(0, 28)) self.opt_hex.setMaximumSize(QtCore.QSize(140, 28)) self.opt_hex.setChecked(True) self.opt_hex.setObjectName("opt_hex") self.retranslateUi(window) QtCore.QMetaObject.connectSlotsByName(window)
def time_jump_dialog( parent, value=0, relative_label='Time:', absolute_label='Time:', relative_checked=True, show_radio=True): class TimeJumpDialog(QtWidgets.QDialog): def __init__(self, parent=None): super().__init__(parent) self._label = QtWidgets.QLabel('', self) self._time_edit = bubblesub.ui.util.TimeEdit(self) self._radio_rel = QtWidgets.QRadioButton('Relative', self) self._radio_abs = QtWidgets.QRadioButton('Absolute', self) if relative_checked: self._radio_rel.setChecked(True) else: self._radio_abs.setChecked(True) strip = QtWidgets.QDialogButtonBox(self) strip.addButton(strip.Ok) strip.addButton(strip.Cancel) if not show_radio: self._radio_abs.setHidden(True) self._radio_rel.setHidden(True) strip.accepted.connect(self.accept) strip.rejected.connect(self.reject) self._radio_rel.clicked.connect(self._on_radio_click) self._radio_abs.clicked.connect(self._on_radio_click) layout = QtWidgets.QVBoxLayout(self) layout.addWidget(self._label) layout.addWidget(self._time_edit) layout.addWidget(self._radio_rel) layout.addWidget(self._radio_abs) layout.addWidget(strip) self._on_radio_click() self._time_edit.set_value(value) def _on_radio_click(self): is_relative = self._radio_rel.isChecked() if is_relative: self._label.setText(relative_label) else: self._label.setText(absolute_label) self._time_edit.set_allow_negative(is_relative) def value(self): return ( self._time_edit.get_value(), self._radio_rel.isChecked()) dialog = TimeJumpDialog(parent) if dialog.exec_(): return dialog.value() return None
def setupUi(self, DialogMessageType): DialogMessageType.setObjectName("DialogMessageType") DialogMessageType.resize(471, 359) self.gridLayout = QtWidgets.QGridLayout(DialogMessageType) self.gridLayout.setObjectName("gridLayout") self.rbAssignManually = QtWidgets.QRadioButton(DialogMessageType) self.rbAssignManually.setObjectName("rbAssignManually") self.gridLayout.addWidget(self.rbAssignManually, 0, 0, 1, 1) self.rbAssignAutomatically = QtWidgets.QRadioButton(DialogMessageType) self.rbAssignAutomatically.setObjectName("rbAssignAutomatically") self.gridLayout.addWidget(self.rbAssignAutomatically, 0, 1, 1, 1) self.cbRulesetMode = QtWidgets.QComboBox(DialogMessageType) self.cbRulesetMode.setObjectName("cbRulesetMode") self.cbRulesetMode.addItem("") self.cbRulesetMode.addItem("") self.cbRulesetMode.addItem("") self.gridLayout.addWidget(self.cbRulesetMode, 1, 0, 1, 2) self.tblViewRuleset = QtWidgets.QTableView(DialogMessageType) self.tblViewRuleset.setObjectName("tblViewRuleset") self.gridLayout.addWidget(self.tblViewRuleset, 2, 0, 3, 2) self.btnAddRule = QtWidgets.QToolButton(DialogMessageType) icon = QtGui.QIcon.fromTheme("list-add") self.btnAddRule.setIcon(icon) self.btnAddRule.setObjectName("btnAddRule") self.gridLayout.addWidget(self.btnAddRule, 2, 2, 1, 1) self.btnRemoveRule = QtWidgets.QToolButton(DialogMessageType) icon = QtGui.QIcon.fromTheme("list-remove") self.btnRemoveRule.setIcon(icon) self.btnRemoveRule.setObjectName("btnRemoveRule") self.gridLayout.addWidget(self.btnRemoveRule, 3, 2, 1, 1) spacerItem = QtWidgets.QSpacerItem(20, 145, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 2, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.btnSaveAndApply = QtWidgets.QPushButton(DialogMessageType) self.btnSaveAndApply.setObjectName("btnSaveAndApply") self.horizontalLayout.addWidget(self.btnSaveAndApply) self.btnClose = QtWidgets.QPushButton(DialogMessageType) self.btnClose.setObjectName("btnClose") self.horizontalLayout.addWidget(self.btnClose) self.gridLayout.addLayout(self.horizontalLayout, 5, 0, 1, 2) self.retranslateUi(DialogMessageType) QtCore.QMetaObject.connectSlotsByName(DialogMessageType)
def setupUi(self, FilterDialog): FilterDialog.setObjectName("FilterDialog") FilterDialog.resize(469, 327) icon = QtGui.QIcon.fromTheme("view-filter") FilterDialog.setWindowIcon(icon) self.gridLayout = QtWidgets.QGridLayout(FilterDialog) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(FilterDialog) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 3, 0, 1, 1) self.spinBoxNumTaps = QtWidgets.QSpinBox(FilterDialog) self.spinBoxNumTaps.setMinimum(1) self.spinBoxNumTaps.setMaximum(999999999) self.spinBoxNumTaps.setProperty("value", 10) self.spinBoxNumTaps.setObjectName("spinBoxNumTaps") self.gridLayout.addWidget(self.spinBoxNumTaps, 3, 1, 1, 1) self.radioButtonCustomTaps = QtWidgets.QRadioButton(FilterDialog) self.radioButtonCustomTaps.setObjectName("radioButtonCustomTaps") self.gridLayout.addWidget(self.radioButtonCustomTaps, 6, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 11, 0, 1, 1) self.lineEditCustomTaps = QtWidgets.QLineEdit(FilterDialog) self.lineEditCustomTaps.setObjectName("lineEditCustomTaps") self.gridLayout.addWidget(self.lineEditCustomTaps, 8, 0, 1, 2) self.radioButtonMovingAverage = QtWidgets.QRadioButton(FilterDialog) self.radioButtonMovingAverage.setChecked(True) self.radioButtonMovingAverage.setObjectName("radioButtonMovingAverage") self.gridLayout.addWidget(self.radioButtonMovingAverage, 5, 0, 1, 2) self.buttonBox = QtWidgets.QDialogButtonBox(FilterDialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 10, 0, 1, 2) self.label_3 = QtWidgets.QLabel(FilterDialog) font = QtGui.QFont() font.setItalic(True) self.label_3.setFont(font) self.label_3.setWordWrap(True) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 0, 1, 2) self.label_2 = QtWidgets.QLabel(FilterDialog) font = QtGui.QFont() font.setItalic(True) self.label_2.setFont(font) self.label_2.setWordWrap(True) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 2) self.retranslateUi(FilterDialog) QtCore.QMetaObject.connectSlotsByName(FilterDialog)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(400, 300) MainWindow.setMinimumSize(QtCore.QSize(400, 300)) MainWindow.setMaximumSize(QtCore.QSize(400, 300)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/logo/logo3.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.label = QtWidgets.QLabel(self.centralWidget) self.label.setGeometry(QtCore.QRect(10, 20, 121, 21)) self.label.setObjectName("label") self.vipvideo = QtWidgets.QRadioButton(self.centralWidget) self.vipvideo.setGeometry(QtCore.QRect(120, 20, 117, 21)) #self.vipvideo.setChecked(True) self.vipvideo.setObjectName("vipvideo") self.no_name = QtWidgets.QRadioButton(self.centralWidget) self.no_name.setGeometry(QtCore.QRect(270, 20, 117, 21)) self.no_name.setObjectName("no_name") self.no_name.setChecked(True) self.label_2 = QtWidgets.QLabel(self.centralWidget) self.label_2.setGeometry(QtCore.QRect(10, 60, 121, 41)) self.label_2.setObjectName("label_2") self.lineEdit = QtWidgets.QLineEdit(self.centralWidget) self.lineEdit.setGeometry(QtCore.QRect(130, 60, 161, 41)) self.lineEdit.setObjectName("lineEdit") self.play = QtWidgets.QPushButton(self.centralWidget) self.play.setGeometry(QtCore.QRect(300, 60, 81, 41)) self.play.setObjectName("play") self.label_3 = QtWidgets.QLabel(self.centralWidget) self.label_3.setGeometry(QtCore.QRect(20, 120, 361, 51)) self.label_3.setAutoFillBackground(False) self.label_3.setStyleSheet("color: rgb(170, 0, 0);") self.label_3.setLineWidth(1) self.label_3.setTextFormat(QtCore.Qt.PlainText) self.label_3.setScaledContents(False) self.label_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label_3.setWordWrap(True) self.label_3.setOpenExternalLinks(False) self.label_3.setObjectName("label_3") self.label_4 = QtWidgets.QLabel(self.centralWidget) self.label_4.setGeometry(QtCore.QRect(0, 180, 391, 91)) self.label_4.setAutoFillBackground(False) self.label_4.setLineWidth(1) self.label_4.setTextFormat(QtCore.Qt.PlainText) self.label_4.setScaledContents(False) self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label_4.setWordWrap(True) self.label_4.setOpenExternalLinks(False) self.label_4.setObjectName("label_4") MainWindow.setCentralWidget(self.centralWidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)