当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QRadioButton类代码示例

本文整理汇总了Python中PyQt4.QtGui.QRadioButton的典型用法代码示例。如果您正苦于以下问题:Python QRadioButton类的具体用法?Python QRadioButton怎么用?Python QRadioButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QRadioButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RadioButton

class RadioButton(QWidget):
    selected = pyqtSignal()

    def __init__(self, caption, parent, selected=False):
        QWidget.__init__(self)

        self.value = selected
        self.radiobutton = QRadioButton(caption, parent)
        self.radiobutton.clicked.connect(self.__on_change)

        hbox = QHBoxLayout()
        hbox.addWidget(self.radiobutton)
        hbox.setMargin(0)
        self.setLayout(hbox)
        self.setContentsMargins(0, 0, 0, 0)
        self.radiobutton.setChecked(self.value)

    def __on_change(self):
        self.value = True
        self.selected.emit()

    def set_value(self, value):
        self.radiobutton.setChecked(value)

    def get_value(self):
        return self.radiobutton.isChecked()
开发者ID:carriercomm,项目名称:Turpial,代码行数:26,代码来源:preferences.py

示例2: LabelDistributionOptionsDlg

        class LabelDistributionOptionsDlg( QDialog ):
            """
            A little dialog to let the user specify how the labels should be
            distributed from the current stages to the other stages.
            """
            def __init__(self, source_stage_index, num_stages, *args, **kwargs):
                super(LabelDistributionOptionsDlg, self).__init__(*args, **kwargs)

                from PyQt4.QtCore import Qt
                from PyQt4.QtGui import QGroupBox, QCheckBox, QRadioButton, QDialogButtonBox
            
                self.setWindowTitle("Distributing from Stage {}".format(source_stage_index+1))

                self.stage_checkboxes = []
                for stage_index in range(1, num_stages+1):
                    self.stage_checkboxes.append( QCheckBox("Stage {}".format( stage_index )) )
                
                # By default, send labels back into the current stage, at least.
                self.stage_checkboxes[source_stage_index].setChecked(True)
                
                stage_selection_layout = QVBoxLayout()
                for checkbox in self.stage_checkboxes:
                    stage_selection_layout.addWidget( checkbox )

                stage_selection_groupbox = QGroupBox("Send labels from Stage {} to:".format( source_stage_index+1 ), self)
                stage_selection_groupbox.setLayout(stage_selection_layout)
                
                self.copy_button = QRadioButton("Copy", self)
                self.partition_button = QRadioButton("Partition", self)
                self.partition_button.setChecked(True)
                distribution_mode_layout = QVBoxLayout()
                distribution_mode_layout.addWidget(self.copy_button)
                distribution_mode_layout.addWidget(self.partition_button)
                
                distribution_mode_group = QGroupBox("Distribution Mode", self)
                distribution_mode_group.setLayout(distribution_mode_layout)
                
                buttonbox = QDialogButtonBox( Qt.Horizontal, parent=self )
                buttonbox.setStandardButtons( QDialogButtonBox.Ok | QDialogButtonBox.Cancel )
                buttonbox.accepted.connect( self.accept )
                buttonbox.rejected.connect( self.reject )
                
                dlg_layout = QVBoxLayout()
                dlg_layout.addWidget(stage_selection_groupbox)
                dlg_layout.addWidget(distribution_mode_group)
                dlg_layout.addWidget(buttonbox)
                self.setLayout(dlg_layout)

            def distribution_mode(self):
                if self.copy_button.isChecked():
                    return "copy"
                if self.partition_button.isChecked():
                    return "partition"
                assert False, "Shouldn't get here."
            
            def destination_stages(self):
                """
                Return the list of stage_indexes (0-based) that the user checked.
                """
                return [ i for i,box in enumerate(self.stage_checkboxes) if box.isChecked() ]
开发者ID:JaimeIvanCervantes,项目名称:ilastik,代码行数:60,代码来源:newAutocontextWorkflow.py

示例3: add_user

    def add_user(self, name):
        radio_button = QRadioButton(name, self)
        if not len(self.radio_buttons):
            radio_button.setChecked(True)

        self.groupBoxLayout.addWidget(radio_button)
        self.radio_buttons.append(radio_button)
开发者ID:BStalewski,项目名称:lanler,代码行数:7,代码来源:main_gui.py

示例4: get_widget

 def get_widget(self):
     if self.widget is None:
         self.widget = QWidget()
         
         layout = QFormLayout()
         self.widget.setLayout(layout)
         
         self.desktopLabel = QLabel("Record Desktop")
         self.desktopButton = QRadioButton()
         layout.addRow(self.desktopLabel, self.desktopButton)
         
         # Record Area of Desktop
         areaGroup = QHBoxLayout()
         self.areaLabel = QLabel("Record Region")
         self.areaButton = QRadioButton()
         self.setAreaButton = QPushButton("Set")
         areaGroup.addWidget(self.areaButton)
         areaGroup.addWidget(self.setAreaButton)
         layout.addRow(self.areaLabel, areaGroup)
         
         # Select screen to record
         self.screenLabel = QLabel("Screen")
         self.screenSpinBox = QSpinBox()
         layout.addRow(self.screenLabel, self.screenSpinBox)
         
         # Connections
         self.widget.connect(self.desktopButton, SIGNAL('clicked()'), self.set_desktop_full)
         self.widget.connect(self.areaButton, SIGNAL('clicked()'), self.set_desktop_area)
         self.widget.connect(self.setAreaButton, SIGNAL('clicked()'), self.area_select)
         self.widget.connect(self.screenSpinBox, SIGNAL('valueChanged(int)'), self.set_screen)
         
         
     return self.widget
开发者ID:rameshrajagopal,项目名称:freeseer,代码行数:33,代码来源:desktop.py

示例5: choice

    def choice(self, title, msg, choices):
        vbox = QVBoxLayout()
        self.set_layout(vbox)
        vbox.addWidget(QLabel(title))
        gb2 = QGroupBox(msg)
        vbox.addWidget(gb2)

        vbox2 = QVBoxLayout()
        gb2.setLayout(vbox2)

        group2 = QButtonGroup()
        for i, c in enumerate(choices):
            button = QRadioButton(gb2)
            button.setText(c[1])
            vbox2.addWidget(button)
            group2.addButton(button)
            group2.setId(button, i)
            if i == 0:
                button.setChecked(True)
        vbox.addStretch(1)
        vbox.addLayout(Buttons(CancelButton(self), OkButton(self, _('Next'))))
        if not self.exec_():
            return
        wallet_type = choices[group2.checkedId()][0]
        return wallet_type
开发者ID:gjhiggins,项目名称:electrum,代码行数:25,代码来源:installwizard.py

示例6: __getTermGroupbox

    def __getTermGroupbox( self ):
        " Creates the term groupbox "
        termGroupbox = QGroupBox( self )
        sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred )
        sizePolicy.setHorizontalStretch( 0 )
        sizePolicy.setVerticalStretch( 0 )
        sizePolicy.setHeightForWidth(
                        termGroupbox.sizePolicy().hasHeightForWidth() )
        termGroupbox.setSizePolicy( sizePolicy )

        layoutTerm = QVBoxLayout( termGroupbox )
        self.__redirectRButton = QRadioButton( termGroupbox )
        self.__redirectRButton.setText( "&Redirect to IDE" )
        self.__redirectRButton.toggled.connect( self.__redirectedChanged )
        layoutTerm.addWidget( self.__redirectRButton )
        self.__autoRButton = QRadioButton( termGroupbox )
        self.__autoRButton.setText( "Aut&o detection" )
        layoutTerm.addWidget( self.__autoRButton )
        self.__konsoleRButton = QRadioButton( termGroupbox )
        self.__konsoleRButton.setText( "Default &KDE konsole" )
        layoutTerm.addWidget( self.__konsoleRButton )
        self.__gnomeRButton = QRadioButton( termGroupbox )
        self.__gnomeRButton.setText( "gnome-&terminal" )
        layoutTerm.addWidget( self.__gnomeRButton )
        self.__xtermRButton = QRadioButton( termGroupbox )
        self.__xtermRButton.setText( "&xterm" )
        layoutTerm.addWidget( self.__xtermRButton )
        return termGroupbox
开发者ID:eaglexmw,项目名称:codimension,代码行数:28,代码来源:runparams.py

示例7: RepoTypeWizardPage

class RepoTypeWizardPage(QWizardPage):
    def __init__(self, parent=None):
        super(RepoTypeWizardPage, self).__init__(
            parent,
            title="Select Account Type",
            subTitle="Select the type of Repo to create")
        
        # RadioButtons

        self.githubRadioButton = QRadioButton('Github Repo')

        # Layout

        self.mainLayout = QVBoxLayout()
        self.mainLayout.addWidget(self.githubRadioButton)
        self.setLayout(self.mainLayout)
        
        # Setup

        self.githubRadioButton.toggle() 
    
    def nextId(self):
        
        if self.githubRadioButton.isChecked():
            return 1
开发者ID:cameronbwhite,项目名称:GithubRemote,代码行数:25,代码来源:AddRepoWizard.py

示例8: __init__

 def __init__(self, db, mainWindow, username, contact):
     QWidget.__init__(self)
     self.contact = contact
     self.username = username
     self.mainWindow = mainWindow
     self.db = db
     
     self.resize(400, 300)
     self.setWindowTitle('Edit Contact')
     
     self.addressListLabel = QLabel('Addresses')
     
     addresses = self.contact.getAddresses(self.db)
     addresses = [("%s: %s" % (address['strAddressType'], address['strAddress']), address['strAddress']) for address in addresses]
     self.addresses = AutoCompleteListBox(self, addresses)
     self.addresses.getLineEdit().hide()
     
     saveButton = QPushButton('Save')
     cancelButton = QPushButton('Cancel')
     
     self.personRadio = QRadioButton('Contact is a person', self)
     self.companyRadio = QRadioButton('Contact is an organization', self)
     
     self.personWidget = self._getPersonWidget()
     self.companyWidget = self._getCompanyWidget()
     
     self.personRadio.toggled.connect(self.switchToPerson)
     self.companyRadio.toggled.connect(self.switchToCompany)
     
     grid = QGridLayout()
     grid.setSpacing(10)
     
     grid.addWidget(self.addressListLabel, 1, 0)
     grid.addWidget(self.addresses.getLineEdit(), 0, 1, 1, 2)
     grid.addWidget(self.addresses.getListBox(), 1, 1, 1, 2)
     
     grid.addWidget(self.personRadio, 2, 1, 1, 2)
     grid.addWidget(self.companyRadio, 3, 1, 1, 2)
     
     grid.addWidget(self.personWidget, 4, 0, 1, 3)
     grid.addWidget(self.companyWidget, 5, 0, 1, 3)
     
     grid.addWidget(saveButton, 7, 1)
     grid.addWidget(cancelButton, 7, 2)
     
     self.setLayout(grid)
     
     if contact.isPerson == True:
         self.personRadio.setChecked(True)
         self.switchToPerson()
     elif contact.isPerson == False:
         self.companyRadio.setChecked(True)
         self.switchToCompany()
     else:
         self.personWidget.hide()
         self.companyWidget.hide()
     
     self.connect(cancelButton, SIGNAL('clicked()'), SLOT('close()'))
     self.connect(saveButton, SIGNAL('clicked()'), self.save)
开发者ID:lastaardvark,项目名称:Owl,代码行数:59,代码来源:editContact.py

示例9: RadioSet

 def RadioSet(widget : QtGui.QRadioButton, val : str, id : int) -> bool:
     """If QRadioButton name match 'val' select it and return True."""
     # if widget.accessibleName() != val: return False
     # widget.setChecked(True)
     # return True                
     assert len(self.enum) > id
     if self.enum[id] != val: return False
     widget.setChecked(True)
     return True
开发者ID:ixc-software,项目名称:lucksi,代码行数:9,代码来源:GuiFieldWidgetFactory.py

示例10: makeSortButton

 def makeSortButton(name, sortFunction):
     bname = "%sSortButton" % name
     button = QRadioButton(self.sortBox)
     setattr(self, bname, button)
     def buttonClicked():
         self.__sortOrder = name
         self.model.setSortOrder(sortFunction)
     self.connect(button, SIGNAL("clicked()"),
                  buttonClicked)
     self.sortLayout.addWidget(button)
     button.setText("By %s" % name.capitalize())
开发者ID:Whatang,项目名称:QBetty,代码行数:11,代码来源:BettyGUI.py

示例11: makeOddsButton

 def makeOddsButton(name, oddsDisplayer):
     bname = "%sButton" % name
     button = QRadioButton(self.oddsGroupBox)
     setattr(self, bname, button)
     def buttonClicked():
         self.__oddsDisplay = name
         self.model.setOddsDisplay(oddsDisplayer)
     self.connect(button, SIGNAL("clicked()"),
                  buttonClicked)
     button.setEnabled(oddsDisplayer.implemented)
     self.oddsLayout.addWidget(button)
     button.setText(name.capitalize())
开发者ID:Whatang,项目名称:QBetty,代码行数:12,代码来源:BettyGUI.py

示例12: __init__

    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setup_model()

        self.tableview = QTableView()
        self.tableview.setSelectionMode(QAbstractItemView.NoSelection)
        self.tableview.setEditTriggers(QAbstractItemView.DoubleClicked)
        self.cbdelegate = CheckBoxDelegate()
        self.tableview.setItemDelegate(self.cbdelegate)
        self.tableview.setAutoScroll(False)
        self.tableview.setModel(self.model)
        self.tableview.sortByColumn(0, Qt.AscendingOrder)
        self.adjust_headers()

        #self.model.setHeaderData(0, Qt.Horizontal, u"")
        #self.model.setHeaderData(1, Qt.Horizontal, u"Title")

        self.radio_all = QRadioButton("All")
        self.radio_all.setChecked(True)
        self.radio_need = QRadioButton("Need")
        self.connect(self.radio_all, SIGNAL("toggled(bool)"), self.set_show_all)

        label = QLabel("DB:")
        label.setFixedWidth(40)
        label.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)

        self.db_combo = QComboBox()
        self.populate_db_combo()
        self.connect(
            self.db_combo, SIGNAL("currentIndexChanged(int)"),
            self.db_index_changed)

        self.new_button = QPushButton("New")
        self.connect(self.new_button, SIGNAL("clicked()"), self.new_item)

        self.box = QVBoxLayout(self)
        self.box.addWidget(self.tableview)
        self.button_box = QHBoxLayout()
        self.button_box.setSpacing(0)
        self.button_box.addWidget(self.new_button)
        self.button_box.addWidget(self.radio_all)
        self.button_box.addWidget(self.radio_need)
        self.button_box.addWidget(label)
        self.button_box.addWidget(self.db_combo)
        self.box.addLayout(self.button_box)

        # self.setStyleSheet("""
        # QComboBox {
        #     font-size: 16px;
        # }
        # """)

        self.dwim_after_load()
开发者ID:ivan4th,项目名称:i4checklist,代码行数:53,代码来源:i4checklist.py

示例13: __init__

    def __init__(self, parent=None):
        '''
        Constructor
        '''
        QRadioButton.__init__(self, parent)
        self.setStyleSheet(self.styleSheet)
        font = QFont( "Arial", 18)
        self.setFont(font)

        #VARIABILI INTERNE
        self.__intValue = 0
        self.__strValue = ""
开发者ID:Nerkyator,项目名称:pyQt_components,代码行数:12,代码来源:LightBlueRadio.py

示例14: __init__

    def __init__(self):
        super(IntroductionPage, self).__init__()
        self.setTitle(self.tr("Creación de un nuevo Proyecto"))
        self.setSubTitle(self.tr("Información básica del Proyecto"))
        container = QVBoxLayout(self)
        hbox = QHBoxLayout()
        # Nombre
        hbox.addWidget(QLabel(self.tr("Nombre del Proyecto:")))
        self.line_name = QLineEdit()
        hbox.addWidget(self.line_name)
        container.addLayout(hbox)
        # Ubicación
        group = QGroupBox(self.tr("Ubicación:"))
        box = QVBoxLayout(group)
        button_group = QButtonGroup(self)
        radio_buttons = [
            self.tr("Directorio por defecto"),
            self.tr("Otro")
            ]
        for _id, radiob in enumerate(radio_buttons):
            radio_button = QRadioButton(radiob)
            button_group.addButton(radio_button, _id)
            box.addWidget(radio_button)
            if _id == 0:
                # El primero checked por defecto
                radio_button.setChecked(True)
        container.addWidget(group)

        self.line_location = QLineEdit()
        container.addWidget(self.line_location)

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel(self.tr("Archivo del Proyecto: ")))
        self._project_filename = QLineEdit()
        hbox.addWidget(self._project_filename)
        container.addLayout(hbox)

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel(self.tr("Archivo resultante: ")))
        self._resulting_filename = QLineEdit()
        hbox.addWidget(self._resulting_filename)
        container.addLayout(hbox)

        # Conexiones
        self.connect(button_group, SIGNAL("buttonClicked(int)"),
                     self._update_location)
        self.connect(self.line_name, SIGNAL("textChanged(const QString&)"),
                     self._on_project_name_changed)
        self.connect(self.line_name, SIGNAL("textChanged(const QString&)"),
                     lambda: self.emit(SIGNAL("completeChanged()")))

        self._update_location(0)
开发者ID:Garjy,项目名称:edis,代码行数:52,代码来源:new_project.py

示例15: __init__

 def __init__(self, parent=None):
     super(ShortcutEditDialog, self).__init__(parent)
     self.setMinimumWidth(400)
     # create gui
     
     layout = QVBoxLayout()
     layout.setSpacing(10)
     self.setLayout(layout)
     
     top = QHBoxLayout()
     top.setSpacing(4)
     p = self.toppixmap = QLabel()
     l = self.toplabel = QLabel()
     l.setWordWrap(True)
     top.addWidget(p)
     top.addWidget(l, 1)
     layout.addLayout(top)
     
     grid = QGridLayout()
     grid.setSpacing(4)
     grid.setColumnStretch(1, 2)
     layout.addLayout(grid)
     
     self.buttonDefault = QRadioButton(self)
     self.buttonNone = QRadioButton(self)
     self.buttonCustom = QRadioButton(self)
     grid.addWidget(self.buttonDefault, 0, 0, 1, 2)
     grid.addWidget(self.buttonNone, 1, 0, 1, 2)
     grid.addWidget(self.buttonCustom, 2, 0, 1, 2)
     
     self.keybuttons = []
     self.keylabels = []
     for num in range(4):
         l = QLabel(self)
         l.setStyleSheet("margin-left: 2em;")
         l.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
         b = KeySequenceWidget(self)
         b.keySequenceChanged.connect(self.slotKeySequenceChanged)
         l.setBuddy(b)
         self.keylabels.append(l)
         self.keybuttons.append(b)
         grid.addWidget(l, num+3, 0)
         grid.addWidget(b, num+3, 1)
     
     layout.addWidget(Separator(self))
     
     b = QDialogButtonBox(self)
     b.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
     layout.addWidget(b)
     b.accepted.connect(self.accept)
     b.rejected.connect(self.reject)
     app.translateUI(self)
开发者ID:WedgeLeft,项目名称:frescobaldi,代码行数:52,代码来源:shortcuteditdialog.py


注:本文中的PyQt4.QtGui.QRadioButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。