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


Python QtGui.QButtonGroup类代码示例

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


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

示例1: JoystickInvertPreference

class JoystickInvertPreference(QWidget):
    def __init__(self, parent=None):
        super(JoystickInvertPreference, self).__init__(parent)

        layout = QHBoxLayout()
        self._btnGroup = QButtonGroup()

        self.btnNormal = ExpandingButton()
        self.btnNormal.setText('Down')
        self.btnNormal.setCheckable(True)
        self.btnNormal.clicked.connect(self.set_preference)
        self._btnGroup.addButton(self.btnNormal)
        layout.addWidget(self.btnNormal)

        self.btnInvert = ExpandingButton()
        self.btnInvert.setText('Up')
        self.btnInvert.setCheckable(True)
        self.btnInvert.clicked.connect(self.set_preference)
        self._btnGroup.addButton(self.btnInvert)
        layout.addWidget(self.btnInvert)

        self.setLayout(layout)

        self.update_from_preferences()
        Preferences.subscribe(self.update_from_preferences)

    def update_from_preferences(self):
        invert_y = Preferences.get('joystick.invert_y', False)
        self.btnInvert.setChecked(invert_y)
        self.btnNormal.setChecked(not invert_y)

    def set_preference(self):
        Preferences.set('joystick.invert_y', self.btnInvert.isChecked())
开发者ID:staldates,项目名称:av-control,代码行数:33,代码来源:Preferences.py

示例2: RadioButtons

class RadioButtons(WidgetBridge, Choices):
    _qttype = QGroupBox

    def customize(self, widget):
        assert self.choices, "RadioButtons: Cannot build widget bridge without choices"
        # We give the GroupBox a container so we can add stretch at the end.
        self.container = QWidget(self.parent)
        hbox = QHBoxLayout(self.container)
        self.buttongroup = QButtonGroup(self.parent)
        if "direction" in self.config and \
                self.config["direction"].lower() == "vertical":
            box = QVBoxLayout()
        else:
            box = QHBoxLayout()
        ix = 1
        for text in self.choicesdict().values():
            rb = QRadioButton(text, self.parent)
            box.addWidget(rb)
            self.buttongroup.addButton(rb, ix)
            ix += 1
        widget.setLayout(box)
        hbox.addWidget(widget)
        hbox.addStretch(1)
        hbox.setContentsMargins(QMargins(0, 0, 0, 0))

    def apply(self, value):
        for b in self.buttongroup.buttons():
            b.setChecked(False)
        b = self.buttongroup.button(self.index(value) + 1)
        if b:
            b.setChecked(True)

    def retrieve(self):
        ix = self.buttongroup.checkedId()
        return self.at(ix - 1) if ix > 0 else None
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:35,代码来源:bridge.py

示例3: addPrivacyTab

    def addPrivacyTab(self):
        self.privacySettingsGroup = QtGui.QGroupBox("Privacy settings")
        self.privacySettingsLayout = QtGui.QVBoxLayout()
        self.privacySettingsFrame = QtGui.QFrame()
        self.privacyFrame = QtGui.QFrame()
        self.privacyLayout = QtGui.QGridLayout()

        self.filenameprivacyLabel = QLabel(getMessage("filename-privacy-label"), self)
        self.filenameprivacyButtonGroup = QButtonGroup()
        self.filenameprivacySendRawOption = QRadioButton(getMessage("privacy-sendraw-option"))
        self.filenameprivacySendHashedOption = QRadioButton(getMessage("privacy-sendhashed-option"))
        self.filenameprivacyDontSendOption = QRadioButton(getMessage("privacy-dontsend-option"))
        self.filenameprivacyButtonGroup.addButton(self.filenameprivacySendRawOption)
        self.filenameprivacyButtonGroup.addButton(self.filenameprivacySendHashedOption)
        self.filenameprivacyButtonGroup.addButton(self.filenameprivacyDontSendOption)

        self.filesizeprivacyLabel = QLabel(getMessage("filesize-privacy-label"), self)
        self.filesizeprivacyButtonGroup = QButtonGroup()
        self.filesizeprivacySendRawOption = QRadioButton(getMessage("privacy-sendraw-option"))
        self.filesizeprivacySendHashedOption = QRadioButton(getMessage("privacy-sendhashed-option"))
        self.filesizeprivacyDontSendOption = QRadioButton(getMessage("privacy-dontsend-option"))
        self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacySendRawOption)
        self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacySendHashedOption)
        self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacyDontSendOption)

        self.filenameprivacyLabel.setObjectName("filename-privacy")
        self.filenameprivacySendRawOption.setObjectName("privacy-sendraw" + constants.CONFIG_NAME_MARKER + "filenamePrivacyMode" + constants.CONFIG_VALUE_MARKER + constants.PRIVACY_SENDRAW_MODE)
        self.filenameprivacySendHashedOption.setObjectName("privacy-sendhashed" + constants.CONFIG_NAME_MARKER + "filenamePrivacyMode" + constants.CONFIG_VALUE_MARKER + constants.PRIVACY_SENDHASHED_MODE)
        self.filenameprivacyDontSendOption.setObjectName("privacy-dontsend" + constants.CONFIG_NAME_MARKER + "filenamePrivacyMode" + constants.CONFIG_VALUE_MARKER + constants.PRIVACY_DONTSEND_MODE)
        self.filesizeprivacyLabel.setObjectName("filesize-privacy")
        self.filesizeprivacySendRawOption.setObjectName("privacy-sendraw" + constants.CONFIG_NAME_MARKER + "filesizePrivacyMode" + constants.CONFIG_VALUE_MARKER + constants.PRIVACY_SENDRAW_MODE)
        self.filesizeprivacySendHashedOption.setObjectName("privacy-sendhashed" + constants.CONFIG_NAME_MARKER + "filesizePrivacyMode" + constants.CONFIG_VALUE_MARKER + constants.PRIVACY_SENDHASHED_MODE)
        self.filesizeprivacyDontSendOption.setObjectName("privacy-dontsend" + constants.CONFIG_NAME_MARKER + "filesizePrivacyMode" + constants.CONFIG_VALUE_MARKER + constants.PRIVACY_DONTSEND_MODE)

        self.privacyLayout.addWidget(self.filenameprivacyLabel, 1, 0)
        self.privacyLayout.addWidget(self.filenameprivacySendRawOption, 1, 1, Qt.AlignLeft)
        self.privacyLayout.addWidget(self.filenameprivacySendHashedOption, 1, 2, Qt.AlignLeft)
        self.privacyLayout.addWidget(self.filenameprivacyDontSendOption, 1, 3, Qt.AlignLeft)
        self.privacyLayout.addWidget(self.filesizeprivacyLabel, 2, 0)
        self.privacyLayout.addWidget(self.filesizeprivacySendRawOption, 2, 1, Qt.AlignLeft)
        self.privacyLayout.addWidget(self.filesizeprivacySendHashedOption, 2, 2, Qt.AlignLeft)
        self.privacyLayout.addWidget(self.filesizeprivacyDontSendOption, 2, 3, Qt.AlignLeft)

        self.privacyFrame.setLayout(self.privacyLayout)
        self.privacySettingsGroup.setLayout(self.privacyLayout)
        self.privacySettingsGroup.setMaximumHeight(self.privacySettingsGroup.minimumSizeHint().height())
        self.privacySettingsLayout.addWidget(self.privacySettingsGroup)
        self.privacySettingsLayout.setAlignment(Qt.AlignTop)
        self.privacyFrame.setLayout(self.privacySettingsLayout)
        self.stackedLayout.addWidget(self.privacyFrame)
开发者ID:Konubinix,项目名称:syncplay,代码行数:50,代码来源:GuiConfiguration.py

示例4: _modeControls

    def _modeControls(self):
        layout = QVBoxLayout()
        layout.addWidget(TitleLabel("Lighting Mode"))

        normal = OptionButton()
        normal.setText("Normal")
        _safelyConnect(normal.clicked, lambda: self.lights.execute("goto default"))
        layout.addWidget(normal)

        late = OptionButton()
        late.setText("8.15 Service")
        _safelyConnect(late.clicked, lambda: self.lights.execute("Goto 8:15"))
        layout.addWidget(late)

        test = OptionButton()
        test.setText("Test (All @50%)")
        _safelyConnect(test.clicked, lambda: self.lights.activate("St Aldate's.Section Zero.All at 50"))
        layout.addWidget(test)

        self.modes = QButtonGroup()
        self.modes.addButton(normal, 1)
        self.modes.addButton(late, 2)
        self.modes.addButton(test, 3)

        return layout
开发者ID:staldates,项目名称:av-control,代码行数:25,代码来源:LightingControl.py

示例5: _buildSpeedPanel

 def _buildSpeedPanel(self):
     '''
     Creates the sub-panel containing control widgets for controlling the 
     speed of execution of the algorithm.
     '''
     self._runBtn = QPushButton("Run", self._window)
     self._stepBtn = QPushButton("Step Once", self._window)        
     self._runBtn.clicked.connect(self._onRun)
     self._stepBtn.clicked.connect(self._onStep)        
     
     slowRadio = QRadioButton('Slow', self._window)
     medRadio = QRadioButton('Medium', self._window)
     fastRadio = QRadioButton('Fast', self._window)
     notVisRadio = QRadioButton('Not visible', self._window)
     slowRadio.setChecked(True)        
     
     self._speedGroup = QButtonGroup(self._window)
     self._speedGroup.addButton(slowRadio, 0)
     self._speedGroup.addButton(medRadio, 1)
     self._speedGroup.addButton(fastRadio, 2)
     self._speedGroup.addButton(notVisRadio, 3)
     self._speedGroup.buttonClicked.connect(self._onSpeedChange)
       
     layout = QVBoxLayout()
     layout.addWidget(self._runBtn)
     layout.addWidget(self._stepBtn)
     layout.addWidget(slowRadio)
     layout.addWidget(medRadio)
     layout.addWidget(fastRadio)
     layout.addWidget(notVisRadio)
     
     grpBx = QGroupBox("Run Controls")
     grpBx.setLayout(layout)
     grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
     return grpBx
开发者ID:tansir1,项目名称:ReverseAStar,代码行数:35,代码来源:gui.py

示例6: __init__

	def __init__(self):
		super(ColorChoiceWidget, self).__init__()

		self.buttons = []

		self.buttonGroup = QButtonGroup()
		self.buttonGroup.setExclusive(True)
		self.buttonGroup.buttonClicked.connect(self.selectColor)
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:8,代码来源:ColorWidget.py

示例7: ColorChoiceWidget

class ColorChoiceWidget(ColorWidget):
	def __init__(self):
		super(ColorChoiceWidget, self).__init__()

		self.buttons = []

		self.buttonGroup = QButtonGroup()
		self.buttonGroup.setExclusive(True)
		self.buttonGroup.buttonClicked.connect(self.selectColor)

	def setColors(self, colors):
		layout = self.buttonWidget.layout()
		id = 0
		for color in colors:
			button = ColorButton()
			button.setColor(color)
			button.setCheckable(True)
			layout.addWidget(button)
			self.buttonGroup.addButton(button)
			self.buttonGroup.setId(button, id)
			id += 1
		layout.addStretch(10)

	def setColor(self, color):
		self.color = color
		for button in self.buttonGroup.buttons():
			diffs = map(lambda x, y: abs(x - y), button.color, color)
			if sum(diffs) < 0.0001:
				button.setChecked(True)
				break

	def selectColor(self, button):
		self.color = button.color
		self.valueChanged.emit(self.color)
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:34,代码来源:ColorWidget.py

示例8: _welcomeAreaControls

    def _welcomeAreaControls(self):
        def onOff(presetString):
            @handlePyroErrors
            def inner(isOn):
                if isOn:
                    self.lights.activate(presetString)
                else:
                    self.lights.deactivate(presetString)
            return inner

        layout = QHBoxLayout()

        gallery_ext = QVBoxLayout()

        gallery_ext.addWidget(TitleLabel("Gallery and External"))

        gallery = ExpandingButton()
        gallery.setText("Gallery")
        gallery.setCheckable(True)
        gallery.toggled.connect(onOff("St Aldate's.Welcome Area.gall on"))
        gallery_ext.addWidget(gallery)

        external = ExpandingButton()
        external.setText("External Lights")
        external.setCheckable(True)
        external.toggled.connect(onOff("EXTERIOR.Section Zero.ENTRA ONLY ON"))
        gallery_ext.addWidget(external)

        layout.addLayout(gallery_ext)

        welcomeArea = QVBoxLayout()

        welcomeArea.addWidget(TitleLabel("Welcome Area"))

        full = OptionButton()
        full.setText("100%")
        _safelyConnect(full.clicked, lambda: self.lights.activate("St Aldate's.Welcome Area.Welcome100%"))
        welcomeArea.addWidget(full)

        std = OptionButton()
        std.setText("70%")
        _safelyConnect(std.clicked, lambda: self.lights.activate("St Aldate's.Welcome Area.Welcome70%"))
        welcomeArea.addWidget(std)

        off = OptionButton()
        off.setText("Off")
        _safelyConnect(off.clicked, lambda: self.lights.activate("St Aldate's.Welcome Area.Ent&GalOFF"))
        welcomeArea.addWidget(off)

        self.welcomeArea = QButtonGroup()
        self.welcomeArea.addButton(full, 1)
        self.welcomeArea.addButton(std, 2)
        self.welcomeArea.addButton(off, 3)

        layout.addLayout(welcomeArea)

        return layout
开发者ID:staldates,项目名称:av-control,代码行数:57,代码来源:LightingControl.py

示例9: addReadinessTab

    def addReadinessTab(self):
        self.readyFrame = QtGui.QFrame()
        self.readyLayout = QtGui.QVBoxLayout()
        self.readyFrame.setLayout(self.readyLayout)

        # Initial state

        self.readyInitialGroup = QtGui.QGroupBox(u"Initial readiness state")
        self.readyInitialLayout = QtGui.QVBoxLayout()
        self.readyInitialGroup.setLayout(self.readyInitialLayout)
        self.readyatstartCheckbox = QCheckBox(getMessage("readyatstart-label"))
        self.readyatstartCheckbox.setObjectName("readyAtStart")
        self.readyInitialLayout.addWidget(self.readyatstartCheckbox)
        self.readyLayout.addWidget(self.readyInitialGroup)

        # Automatically pausing
        self.readyPauseGroup = QtGui.QGroupBox(u"Pausing")
        self.readyPauseLayout = QtGui.QVBoxLayout()
        self.readyPauseGroup.setLayout(self.readyPauseLayout)
        self.pauseonleaveCheckbox = QCheckBox(getMessage("pauseonleave-label"))
        self.pauseonleaveCheckbox.setObjectName("pauseOnLeave")
        self.readyPauseLayout.addWidget(self.pauseonleaveCheckbox)
        self.readyLayout.addWidget(self.readyPauseGroup)

        # Unpausing
        self.readyUnpauseGroup = QtGui.QGroupBox(getMessage("unpause-title"))
        self.readyUnpauseLayout = QtGui.QVBoxLayout()
        self.readyUnpauseGroup.setLayout(self.readyUnpauseLayout)
        self.readyUnpauseButtonGroup = QButtonGroup()
        self.unpauseIfAlreadyReadyOption = QRadioButton(getMessage("unpause-ifalreadyready-option"))
        self.readyUnpauseButtonGroup.addButton(self.unpauseIfAlreadyReadyOption)
        self.unpauseIfAlreadyReadyOption.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png"))
        self.unpauseIfAlreadyReadyOption.setObjectName("unpause-ifalreadyready" + constants.CONFIG_NAME_MARKER + "unpauseAction" + constants.CONFIG_VALUE_MARKER + constants.UNPAUSE_IFALREADYREADY_MODE)
        self.readyUnpauseLayout.addWidget(self.unpauseIfAlreadyReadyOption)
        self.unpauseIfOthersReadyOption = QRadioButton(getMessage("unpause-ifothersready-option"))
        self.readyUnpauseButtonGroup.addButton(self.unpauseIfOthersReadyOption)
        self.unpauseIfOthersReadyOption.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png"))
        self.unpauseIfOthersReadyOption.setObjectName("unpause-ifothersready" + constants.CONFIG_NAME_MARKER + "unpauseAction" + constants.CONFIG_VALUE_MARKER + constants.UNPAUSE_IFOTHERSREADY_MODE)
        self.readyUnpauseLayout.addWidget(self.unpauseIfOthersReadyOption)
        self.unpauseIfMinUsersReadyOption = QRadioButton(getMessage("unpause-ifminusersready-option"))
        self.readyUnpauseButtonGroup.addButton(self.unpauseIfMinUsersReadyOption)
        self.unpauseIfMinUsersReadyOption.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png"))
        self.unpauseIfMinUsersReadyOption.setObjectName("unpause-ifminusersready" + constants.CONFIG_NAME_MARKER + "unpauseAction" + constants.CONFIG_VALUE_MARKER + constants.UNPAUSE_IFMINUSERSREADY_MODE)
        self.readyUnpauseLayout.addWidget(self.unpauseIfMinUsersReadyOption)
        self.unpauseAlwaysUnpauseOption = QRadioButton(getMessage("unpause-always"))
        self.readyUnpauseButtonGroup.addButton(self.unpauseAlwaysUnpauseOption)
        self.unpauseAlwaysUnpauseOption.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png"))
        self.unpauseAlwaysUnpauseOption.setObjectName("unpause-always" + constants.CONFIG_NAME_MARKER + "unpauseAction" + constants.CONFIG_VALUE_MARKER + constants.UNPAUSE_ALWAYS_MODE)
        self.readyUnpauseLayout.addWidget(self.unpauseAlwaysUnpauseOption)
        self.readyLayout.addWidget(self.readyUnpauseGroup)

        self.readyLayout.setAlignment(Qt.AlignTop)
        self.stackedLayout.addWidget(self.readyFrame)
开发者ID:SLKTH,项目名称:syncplay,代码行数:53,代码来源:GuiConfiguration.py

示例10: makeContent

    def makeContent(self):
        layout = QGridLayout()

        self.screens = QButtonGroup()

        btnLeft = IDedButton(1)
        btnLeft.setText("Left")
        layout.addWidget(btnLeft, 1, 0, 1, 2)
        btnLeft.setCheckable(True)
        self.screens.addButton(btnLeft, 1)

        btnAll = IDedButton(0)
        btnAll.setText("Both")
        layout.addWidget(btnAll, 1, 2, 1, 3)
        btnAll.setCheckable(True)
        btnAll.setChecked(True)
        self.screens.addButton(btnAll, 0)

        btnRight = IDedButton(2)
        btnRight.setText("Right")
        layout.addWidget(btnRight, 1, 5, 1, 2)
        btnRight.setCheckable(True)
        self.screens.addButton(btnRight, 2)

        iconSize = QSize(96, 96)

        btnRaise = ExpandingButton()
        btnRaise.setText("Raise")
        btnRaise.setIcon(QIcon("icons/go-up.svg"))
        btnRaise.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        layout.addWidget(btnRaise, 2, 1, 1, 3)
        btnRaise.setIconSize(iconSize)
        btnRaise.clicked.connect(self.raiseUp)

        btnLower = ExpandingButton()
        btnLower.setText("Lower")
        btnLower.setIcon(QIcon("icons/go-down.svg"))
        btnLower.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        layout.addWidget(btnLower, 3, 1, 1, 3)
        btnLower.setIconSize(iconSize)
        btnLower.clicked.connect(self.lowerDown)

        btnStop = ExpandingButton()
        btnStop.setText("Stop")
        btnStop.setIcon(QIcon("icons/process-stop.svg"))
        btnStop.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        layout.addWidget(btnStop, 2, 4, 2, 2)
        btnStop.setIconSize(iconSize)
        btnStop.clicked.connect(self.stop)

        return layout
开发者ID:staldates,项目名称:aldatesx,代码行数:51,代码来源:ProjectorScreensControl.py

示例11: AdvancedCameraControl

class AdvancedCameraControl(ScreenWithBackButton):

    def __init__(self, title, camera, mainScreen):
        self.camera = camera
        super(AdvancedCameraControl, self).__init__(title, mainScreen)

    def makeContent(self):
        layout = QHBoxLayout()

        # self.exposureControls = ExposureControl(self.camera)
        # layout.addWidget(self.exposureControls)

        whiteBalanceGrid = QGridLayout()
        wbTitle = QLabel("White Balance")
        wbTitle.setAlignment(Qt.AlignCenter)
        whiteBalanceGrid.addWidget(wbTitle, 0, 0, 1, 2)

        btnAuto = OptionButton()
        btnAuto.setText("Auto")
        _safelyConnect(btnAuto.clicked, self.camera.whiteBalanceAuto)
        whiteBalanceGrid.addWidget(btnAuto, 1, 0)

        btnIndoor = OptionButton()
        btnIndoor.setText("Indoor")
        _safelyConnect(btnIndoor.clicked, self.camera.whiteBalanceIndoor)
        whiteBalanceGrid.addWidget(btnIndoor, 2, 0)

        btnOutdoor = OptionButton()
        btnOutdoor.setText("Outdoor")
        _safelyConnect(btnOutdoor.clicked, self.camera.whiteBalanceOutdoor)
        whiteBalanceGrid.addWidget(btnOutdoor, 3, 0)

        btnOnePush = OptionButton()
        btnOnePush.setText("One Push")
        _safelyConnect(btnOnePush.clicked, self.camera.whiteBalanceOnePush)
        whiteBalanceGrid.addWidget(btnOnePush, 4, 0)

        btnOnePushTrigger = ExpandingButton()
        btnOnePushTrigger.setText("Set")
        _safelyConnect(btnOnePushTrigger.clicked, self.camera.whiteBalanceOnePushTrigger)
        btnOnePushTrigger.setEnabled(False)
        whiteBalanceGrid.addWidget(btnOnePushTrigger, 4, 1)

        self.wbOpts = QButtonGroup()
        self.wbOpts.addButton(btnAuto, 1)
        self.wbOpts.addButton(btnIndoor, 2)
        self.wbOpts.addButton(btnOutdoor, 3)
        self.wbOpts.addButton(btnOnePush, 4)
        self.wbOpts.buttonClicked.connect(lambda: btnOnePushTrigger.setEnabled(self.wbOpts.checkedId() == 4))

        layout.addLayout(whiteBalanceGrid)

        return layout
开发者ID:staldates,项目名称:av-control,代码行数:53,代码来源:CameraControls.py

示例12: StackedPage

class StackedPage(QWidget):
    def __init__(self, parent = None):
        super(StackedPage, self).__init__(parent)
        layout = QHBoxLayout(self)
        leftpane = QVBoxLayout()
        self.buttongroup = QButtonGroup(self)
        self.buttongroup.setExclusive(True)
        self.groupbox = QGroupBox(self)
        self.groupbox.setMinimumWidth(200)
        QVBoxLayout(self.groupbox)
        leftpane.addWidget(self.groupbox)
        leftpane.addStretch(1)
        layout.addLayout(leftpane)
        self.rightpane = QStackedWidget(self)
        layout.addWidget(self.rightpane)
        self.buttongroup.buttonClicked[int].connect(self.rightpane.setCurrentIndex)
        self.rightpane.currentChanged[int].connect(self.activate)
         
    def addPage(self, buttontext, widget):
        button = QPushButton(buttontext)
        button.setCheckable(True)
        button.setChecked(self.rightpane.count() == 0)
        self.buttongroup.addButton(button, self.rightpane.count())
        self.groupbox.layout().addWidget(button)
        self.rightpane.addWidget(widget)
        
    def pages(self):
        return [ self.rightpane.widget(i) for i in range(self.rightpane.count()) ]

    def activate(self, ix):
        page = self.rightpane.currentWidget()
        if hasattr(page, "activate") and callable(page.activate):
            page.activate()
            
    def showEvent(self, *args, **kwargs):
        self.activate(0)
        return QWidget.showEvent(self, *args, **kwargs)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:37,代码来源:stackedpage.py

示例13: initWidgets

    def initWidgets(self):
        self.showAllServicesItem = QListWidgetItem(self.tr("(All registered services)"))
        self.servicesListWidget = QListWidget()
        self.interfacesListWidget = QListWidget()
        self.interfacesListWidget.addItem(self.tr("(Select a service)"))
        self.attributesListWidget = QListWidget()
        self.attributesListWidget.addItem(self.tr("(Select an interface implementation)"))
        self.interfacesListWidget.setMinimumWidth(450)
        self.servicesListWidget.currentItemChanged.connect(self.reloadInterfaceImplementationsList)
        self.interfacesListWidget.currentItemChanged.connect(self.currentInterfaceImplChanged)
        self.defaultInterfaceButton = QPushButton(self.tr("Set as default implementation"))
        self.defaultInterfaceButton.setEnabled(False)
        self.defaultInterfaceButton.clicked.connect(self.setDefaultInterfaceImplementation)
        self.selectedImplRadioButton = QRadioButton(self.tr("Selected interface implementation"))
        self.defaultImplRadioButton = QRadioButton(self.tr("Default implementation"))
        self.selectedImplRadioButton.setChecked(True)
        self.radioButtons = QButtonGroup(self)
        self.radioButtons.addButton(self.selectedImplRadioButton)
        self.radioButtons.addButton(self.defaultImplRadioButton)
        self.radioButtons.buttonClicked.connect(self.reloadAttributesList)

        self.servicesGroup = QGroupBox(self.tr("Show services for:"))
        servicesLayout = QVBoxLayout()
        servicesLayout.addWidget(self.servicesListWidget)
        self.servicesGroup.setLayout(servicesLayout)

        self.interfacesGroup = QGroupBox(self.tr("Interface implementations"))
        interfacesLayout = QVBoxLayout()
        interfacesLayout.addWidget(self.interfacesListWidget)
        interfacesLayout.addWidget(self.defaultInterfaceButton)
        self.interfacesGroup.setLayout(interfacesLayout)

        self.attributesGroup = QGroupBox(self.tr("Invokable attributes"))
        attributesLayout = QVBoxLayout()
        self.attributesGroup.setLayout(attributesLayout)
        attributesLayout.addWidget(self.attributesListWidget)
        attributesLayout.addWidget(QLabel(self.tr("Show attributes for:")))
        attributesLayout.addWidget(self.selectedImplRadioButton)
        attributesLayout.addWidget(self.defaultImplRadioButton)

        self.attributesGroup.setLayout(attributesLayout)

        layout = QGridLayout()
        layout.addWidget(self.servicesGroup, 0, 0)
        layout.addWidget(self.attributesGroup, 0, 1, 2, 1)
        layout.addWidget(self.interfacesGroup, 1, 0)

        self.setLayout(layout)
开发者ID:AmerGit,项目名称:Examples,代码行数:48,代码来源:servicebrowser.py

示例14: __init__

 def __init__(self, parent = None):
     super(StackedPage, self).__init__(parent)
     layout = QHBoxLayout(self)
     leftpane = QVBoxLayout()
     self.buttongroup = QButtonGroup(self)
     self.buttongroup.setExclusive(True)
     self.groupbox = QGroupBox(self)
     self.groupbox.setMinimumWidth(200)
     QVBoxLayout(self.groupbox)
     leftpane.addWidget(self.groupbox)
     leftpane.addStretch(1)
     layout.addLayout(leftpane)
     self.rightpane = QStackedWidget(self)
     layout.addWidget(self.rightpane)
     self.buttongroup.buttonClicked[int].connect(self.rightpane.setCurrentIndex)
     self.rightpane.currentChanged[int].connect(self.activate)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:16,代码来源:stackedpage.py

示例15: makeContent

    def makeContent(self):
        layout = QGridLayout()

        self.blinds = QButtonGroup()

        for i in range(1, 7):
            btn = IDedButton(i)
            btn.setText(str(i))
            layout.addWidget(btn, 0, i - 1)
            btn.setCheckable(True)
            self.blinds.addButton(btn, i)

        btnAll = IDedButton(0)
        btnAll.setText("All")
        layout.addWidget(btnAll, 0, 6)
        btnAll.setCheckable(True)
        btnAll.setChecked(True)
        self.blinds.addButton(btnAll, 0)

        iconSize = QSize(96, 96)

        btnRaise = ExpandingButton()
        btnRaise.setText("Raise")
        btnRaise.setIcon(QIcon("icons/go-up.svg"))
        btnRaise.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        layout.addWidget(btnRaise, 1, 1, 1, 3)
        btnRaise.setIconSize(iconSize)
        btnRaise.clicked.connect(self.raiseUp)

        btnLower = ExpandingButton()
        btnLower.setText("Lower")
        btnLower.setIcon(QIcon("icons/go-down.svg"))
        btnLower.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        layout.addWidget(btnLower, 2, 1, 1, 3)
        btnLower.setIconSize(iconSize)
        btnLower.clicked.connect(self.lowerDown)

        btnStop = ExpandingButton()
        btnStop.setText("Stop")
        btnStop.setIcon(QIcon("icons/process-stop.svg"))
        btnStop.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        layout.addWidget(btnStop, 1, 4, 2, 2)
        btnStop.setIconSize(iconSize)
        btnStop.clicked.connect(self.stop)

        return layout
开发者ID:staldates,项目名称:aldatesx,代码行数:46,代码来源:BlindsControl.py


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