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


Python QButtonGroup.checkedId方法代码示例

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


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

示例1: RadioButtons

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]
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,代码行数:37,代码来源:bridge.py

示例2: AdvancedCameraControl

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]
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,代码行数:55,代码来源:CameraControls.py

示例3: BlindsControl

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]
class BlindsControl(ScreenWithBackButton):
    '''
    Controls for the blinds.
    '''

    def __init__(self, blindsDevice, mainWindow):
        self.blindsDevice = blindsDevice
        ScreenWithBackButton.__init__(self, "Blinds", mainWindow)

    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)

        btnRaise = SvgButton(":icons/go-up", 96, 96)
        btnRaise.setText("Raise")
        btnRaise.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        layout.addWidget(btnRaise, 1, 1, 1, 3)
        btnRaise.clicked.connect(self.raiseUp)

        btnLower = SvgButton(":icons/go-down", 96, 96)
        btnLower.setText("Lower")
        btnLower.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        layout.addWidget(btnLower, 2, 1, 1, 3)
        btnLower.clicked.connect(self.lowerDown)

        btnStop = SvgButton(":icons/process-stop", 96, 96)
        btnStop.setText("Stop")
        btnStop.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextUnderIcon)
        layout.addWidget(btnStop, 1, 4, 2, 2)
        btnStop.clicked.connect(self.stop)

        return layout

    @handlePyroErrors
    def raiseUp(self):
        blindID = self.blinds.checkedId()
        self.blindsDevice.raiseUp(blindID)

    @handlePyroErrors
    def lowerDown(self):
        blindID = self.blinds.checkedId()
        self.blindsDevice.lower(blindID)

    @handlePyroErrors
    def stop(self):
        blindID = self.blinds.checkedId()
        self.blindsDevice.stop(blindID)
开发者ID:staldates,项目名称:av-control,代码行数:64,代码来源:BlindsControl.py

示例4: ProjectorScreensControl

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]
class ProjectorScreensControl(ScreenWithBackButton):
    '''
    Controls for the projector screens.
    '''

    def __init__(self, controller, mainWindow):
        self.controller = controller
        ScreenWithBackButton.__init__(self, "Projector Screens", mainWindow)

    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

    def raiseUp(self):
        screenID = self.screens.checkedId()
        try:
            self.controller.raiseUp("Screens", screenID)
        except NamingError:
            self.mainWindow.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.mainWindow.errorBox(StringConstants.protocolErrorText)

    def lowerDown(self):
        screenID = self.screens.checkedId()
        try:
            self.controller.lower("Screens", screenID)
        except NamingError:
            self.mainWindow.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.mainWindow.errorBox(StringConstants.protocolErrorText)

    def stop(self):
        screenID = self.screens.checkedId()
        try:
            self.controller.stop("Screens", screenID)
        except NamingError:
            self.mainWindow.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.mainWindow.errorBox(StringConstants.protocolErrorText)
开发者ID:staldates,项目名称:aldatesx,代码行数:89,代码来源:ProjectorScreensControl.py

示例5: MainWindow

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]

#.........这里部分代码省略.........
        '''
        When any rendering option is changed this method is invoked.  It polls
        the GUI for the selected setting values and passes them to the 2D
        world widget.
        '''
        self._worldWidget.setDrawActiveCells(self._openChk.isChecked())
        self._worldWidget.setDrawVisitedCells(self._visitedChk.isChecked())
        self._worldWidget.setDrawPath(self._pathChk.isChecked())
        self._worldWidget.setDrawCosts(self._costChk.isChecked())
        self._worldWidget.repaint()
    
    @Slot()
    def _onPercentSlideChange(self, value):
        '''
        Invoked every time the percent slider is changed.  Displays the percent
        value on the GUI.
        '''
        
        #Add extra padding to the front of the string to help prevent
        #gui layout resizing
        if value < 10:
            self._percentLbl.setText("  " + str(value) + "%")
        elif value < 100:
            self._percentLbl.setText(" " + str(value) + "%")
        else:
            self._percentLbl.setText(str(value) + "%")
    
    @Slot()
    def _onSpeedChange(self, value):
        '''
        Invoked every time one of the speed setting radio buttons are selected.
        Resets the algorithm iterating callback timer if it's currently running.
        '''
        self._spdSetting = self._speedGroup.checkedId()
        if self._timer.isActive():
            self._resetTimer()            
         
    @Slot()
    def _onSetup(self):
        '''
        Invoked when the setup button is pushed.  Re-initializes the world model
        and the algorithm.
        '''
        self._timer.stop()
        self._runBtn.setText('Run')
        self._model.reset(self._percentObstacleSldr.value() / 100.0)
        self._alg.reset()
        self._doneLbl.setText("No")
        self._solvableLbl.setText("Yes")
        self._doneLbl.setAutoFillBackground(False)
        self._solvableLbl.setAutoFillBackground(False)
        self._worldWidget.repaint()
    
    @Slot()
    def _onRun(self):
        '''
        Invoked when the run button is pushed.  Toggles the algorithm iterating
        timer on and off.
        '''
        if self._timer.isActive():
            self._timer.stop()
            self._runBtn.setText("Run")
        else:
            self._resetTimer()
            self._runBtn.setText("Stop")
    
开发者ID:tansir1,项目名称:ReverseAStar,代码行数:69,代码来源:gui.py

示例6: CameraControl

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]

#.........这里部分代码省略.........
        _safelyConnect(self.btnDown.clicked, self.deselectPreset)
        self.btnDown.setIcon(QIcon(":icons/go-down"))

        self.btnRight = CameraButton()
        layout.addWidget(self.btnRight, 1, 2, 2, 1)
        _safelyConnect(self.btnRight.pressed, lambda: self.camera.moveRight(self.panSpeed, self.tiltSpeed))
        _safelyConnect(self.btnRight.released, self.camera.stop)
        _safelyConnect(self.btnRight.clicked, self.deselectPreset)
        self.btnRight.setIcon(QIcon(":icons/go-next"))

        zoomInOut = PlusMinusButtons("Zoom")
        _safelyConnect(zoomInOut.upButton.pressed, lambda: self.camera.zoomIn(self.zoomSpeed))
        _safelyConnect(zoomInOut.upButton.released, self.camera.zoomStop)
        _safelyConnect(zoomInOut.upButton.clicked, self.deselectPreset)
        _safelyConnect(zoomInOut.downButton.pressed, lambda: self.camera.zoomOut(self.zoomSpeed))
        _safelyConnect(zoomInOut.downButton.released, self.camera.zoomStop)
        _safelyConnect(zoomInOut.downButton.clicked, self.deselectPreset)

        layout.addWidget(zoomInOut, 0, 3, 4, 1)

        focus = PlusMinusAutoButtons("Focus")
        _safelyConnect(focus.upButton.pressed, self.camera.focusFar)
        _safelyConnect(focus.upButton.released, self.camera.focusStop)
        _safelyConnect(focus.upButton.clicked, self.deselectPreset)
        _safelyConnect(focus.downButton.pressed, self.camera.focusNear)
        _safelyConnect(focus.downButton.released, self.camera.focusStop)
        _safelyConnect(focus.downButton.clicked, self.deselectPreset)

        def autoFocusAndDeselect():
            self.camera.focusAuto()
            self.deselectPreset()
        _safelyConnect(focus.autoButton.clicked, autoFocusAndDeselect)
        layout.addWidget(focus, 0, 4, 4, 1)

        brightness = PlusMinusAutoButtons("Bright")
        _safelyConnect(brightness.upButton.clicked, self.camera.brighter)
        _safelyConnect(brightness.downButton.clicked, self.camera.darker)
        _safelyConnect(brightness.autoButton.clicked, self.camera.setAutoExposure)
        layout.addWidget(brightness, 0, 5, 4, 1)

        presets = QGridLayout()
        presets.setRowStretch(0, 2)
        presets.setRowStretch(1, 1)

        self.presetGroup = QButtonGroup()

        for i in range(1, 7):
            btnPresetRecall = CameraButton()
            presets.addWidget(btnPresetRecall, 0, i, 1, 1)
            btnPresetRecall.setText(str(i))
            _safelyConnect(btnPresetRecall.clicked, lambda i=i: self.recallPreset(i))
            btnPresetRecall.setCheckable(True)
            self.presetGroup.addButton(btnPresetRecall, i)

            btnPresetSet = CameraButton()
            presets.addWidget(btnPresetSet, 1, i, 1, 1)
            btnPresetSet.setText("Set")
            _safelyConnect(btnPresetSet.clicked, lambda i=i: self.storePreset(i))

        layout.addLayout(presets, 4, 0, 3, 6)

    def keyPressEvent(self, e):
        if e.key() == Qt.Key_Left:
            self.btnLeft.pressed.emit()
        elif e.key() == Qt.Key_Right:
            self.btnRight.pressed.emit()
        elif e.key() == Qt.Key_Up:
            self.btnUp.pressed.emit()
        elif e.key() == Qt.Key_Down:
            self.btnDown.pressed.emit()

    def keyReleaseEvent(self, e):
        if e.key() == Qt.Key_Left:
            self.btnLeft.released.emit()
        elif e.key() == Qt.Key_Right:
            self.btnRight.released.emit()
        elif e.key() == Qt.Key_Up:
            self.btnUp.released.emit()
        elif e.key() == Qt.Key_Down:
            self.btnDown.released.emit()

    @handlePyroErrors
    def storePreset(self, index):
        print "Storing preset " + str(index)
        result = self.camera.storePreset(index)
        self.presetGroup.buttons()[index - 1].setChecked(True)
        return result

    @handlePyroErrors
    def recallPreset(self, index):
        print "Recalling preset " + str(index)
        return self.camera.recallPreset(index)

    def deselectPreset(self):
        if self.presetGroup.checkedId() >= 0:
            # Yuck.
            self.presetGroup.setExclusive(False)
            while (self.presetGroup.checkedId() >= 0):
                self.presetGroup.checkedButton().setChecked(False)
            self.presetGroup.setExclusive(True)
开发者ID:staldates,项目名称:av-control,代码行数:104,代码来源:CameraControls.py

示例7: ExposureControl

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]
class ExposureControl(QWidget):

    class Mode(Enum):
        AUTO = 1
        TV = 2
        AV = 4
        MANUAL = 8

        def __or__(self, other):
            return self.value | other.value

    def __init__(self, camera):
        super(ExposureControl, self).__init__()
        self.camera = camera
        self.initUI()

    def initUI(self):
        layout = QGridLayout()

        title = QLabel("Exposure")
        title.setAlignment(Qt.AlignCenter)
        layout.addWidget(title, 0, 0, 1, 4)

        btnAuto = OptionButton()
        btnAuto.setText("Full Auto")
        _safelyConnect(btnAuto.clicked, self.camera.setAutoExposure)
        btnAuto.setChecked(True)

        layout.addWidget(btnAuto, 1, 0)

        btnTV = OptionButton()
        btnTV.setText("Tv")
        _safelyConnect(btnTV.clicked, self.camera.setShutterPriority)

        layout.addWidget(btnTV, 1, 1)

        btnAV = OptionButton()
        btnAV.setText("Av")
        _safelyConnect(btnAV.clicked, self.camera.setAperturePriority)

        layout.addWidget(btnAV, 1, 2)

        btnManual = OptionButton()
        btnManual.setText("M")
        _safelyConnect(btnManual.clicked, self.camera.setManualExposure)

        layout.addWidget(btnManual, 1, 3)

        layout.addWidget(QLabel("Aperture"), 2, 0)

        self.aperture = QComboBox(self)
        for a in list(Aperture):
            self.aperture.addItem(a.label, userData=a)
        self.aperture.currentIndexChanged.connect(self.setAperture)
        self.aperture.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.aperture.setEnabled(False)

        layout.addWidget(self.aperture, 2, 1, 1, 3)

        layout.addWidget(QLabel("Shutter"), 3, 0)

        self.shutter = QComboBox(self)
        for s in list(Shutter):
            self.shutter.addItem(s.label, userData=s)
        self.shutter.currentIndexChanged.connect(self.setShutter)
        self.shutter.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.shutter.setEnabled(False)

        layout.addWidget(self.shutter, 3, 1, 1, 3)

        layout.addWidget(QLabel("Gain"), 4, 0)

        self.gain = QComboBox(self)
        for g in list(Gain):
            self.gain.addItem(g.label, userData=g)
        self.gain.currentIndexChanged.connect(self.setGain)
        self.gain.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.gain.setEnabled(False)

        layout.addWidget(self.gain, 4, 1, 1, 3)

        self.exposureButtons = QButtonGroup()
        self.exposureButtons.addButton(btnAuto, self.Mode.AUTO.value)
        self.exposureButtons.addButton(btnTV, self.Mode.TV.value)
        self.exposureButtons.addButton(btnAV, self.Mode.AV.value)
        self.exposureButtons.addButton(btnManual, self.Mode.MANUAL.value)

        self.exposureButtons.buttonClicked.connect(self.onExposureMethodSelected)

        layout.setRowStretch(0, 0)
        layout.setRowStretch(1, 1)
        layout.setRowStretch(2, 1)
        layout.setRowStretch(3, 1)
        layout.setRowStretch(4, 1)

        self.setLayout(layout)

    def onExposureMethodSelected(self):
        checked = self.exposureButtons.checkedId()
        self.aperture.setEnabled(checked & (self.Mode.MANUAL | self.Mode.AV))
#.........这里部分代码省略.........
开发者ID:staldates,项目名称:av-control,代码行数:103,代码来源:CameraControls.py

示例8: VideoSwitcher

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]

#.........这里部分代码省略.........

    def setInputClickHandlers(self):
        self.btnCamera1.clicked.connect(self.handleInputSelect)
        self.btnCamera2.clicked.connect(self.handleInputSelect)
        self.btnCamera3.clicked.connect(self.handleInputSelect)
        self.btnDVD.clicked.connect(self.handleInputSelect)
        self.btnExtras.clicked.connect(self.handleInputSelect)
        self.btnVisualsPC.clicked.connect(self.handleInputSelect)
        self.btnBlank.clicked.connect(self.handleInputSelect)

    def setOutputClickHandlers(self, outputsGrid):
        outputsGrid.connectMainOutputs(self.handleOutputSelect)
        ''' btnPCMix is a special case since that's on a different switcher '''
        outputsGrid.connectPreviewOutputs(self.handlePCMixSelect)

    def keyPressEvent(self, e):
        if e.key() == Qt.Key_0:
            self.btnBlank.click()
        elif e.key() == Qt.Key_1:
            self.btnCamera1.click()
        elif e.key() == Qt.Key_2:
            self.btnCamera2.click()
        elif e.key() == Qt.Key_3:
            self.btnCamera3.click()
        elif e.key() == Qt.Key_4:
            self.btnDVD.click()
        elif e.key() == Qt.Key_5:
            self.btnExtras.click()
        elif e.key() == Qt.Key_6:
            self.btnVisualsPC.click()
        elif e.key() == Qt.Key_Space:
            self.outputsGrid.btnAll.click()
        else:
            self.panels[self.inputs.checkedId()].keyPressEvent(e)

    def keyReleaseEvent(self, e):
        self.panels[self.inputs.checkedId()].keyReleaseEvent(e)

    def handleInputSelect(self):
        inputID = self.inputs.checkedId()
        logging.debug("Input selected: " + str(inputID))
        if inputID > 0:
            try:
                # HACK HACK HACK someone wired these up the wrong way around
                if inputID == 5:
                    self.controller.switch("Preview", 6, 1)
                elif inputID == 6:
                    self.controller.switch("Preview", 5, 1)
                else:
                    self.controller.switch("Preview", inputID, 1)
            except NamingError:
                self.mainWindow.errorBox(StringConstants.nameErrorText)
            except ProtocolError:
                self.mainWindow.errorBox(StringConstants.protocolErrorText)
        self.gridlayout.removeWidget(self.gridlayout.itemAtPosition(1, 0).widget())
        for p in self.panels:
            p.hide()
        chosenPanel = self.panels[inputID]
        self.gridlayout.addWidget(chosenPanel, 1, 0, 1, 5)
        chosenPanel.show()

        # Prevent certain options from being selectable
        if inputID == 6 or inputID == 0:
            self.outputsGrid.btnPCMix.setEnabled(False)
        else:
            self.outputsGrid.btnPCMix.setEnabled(True)
开发者ID:staldates,项目名称:aldatesx,代码行数:70,代码来源:VideoSwitcher.py

示例9: BlindsControl

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]
class BlindsControl(ScreenWithBackButton):
    '''
    Controls for the blinds.
    '''

    def __init__(self, controller, mainWindow):
        self.controller = controller
        ScreenWithBackButton.__init__(self, "Blinds", mainWindow)

    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

    def raiseUp(self):
        blindID = self.blinds.checkedId()
        try:
            self.controller.raiseUp("Blinds", blindID)
        except NamingError:
            self.mainWindow.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.mainWindow.errorBox(StringConstants.protocolErrorText)

    def lowerDown(self):
        blindID = self.blinds.checkedId()
        try:
            self.controller.lower("Blinds", blindID)
        except NamingError:
            self.mainWindow.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.mainWindow.errorBox(StringConstants.protocolErrorText)

    def stop(self):
        blindID = self.blinds.checkedId()
        try:
            self.controller.stop("Blinds", blindID)
        except NamingError:
            self.mainWindow.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.mainWindow.errorBox(StringConstants.protocolErrorText)
开发者ID:staldates,项目名称:aldatesx,代码行数:84,代码来源:BlindsControl.py

示例10: CameraControl

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]

#.........这里部分代码省略.........
    def move(self):
        sender = self.sender()
        try:
            result = self.controller.move(self.cameraID, sender.cameraBinding)
            self.deselectPreset()
            return result
        except NamingError:
            self.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.errorBox(StringConstants.protocolErrorText)

    def stop(self):
        try:
            self.controller.move(self.cameraID, CameraMove.Stop)
        except NamingError:
            self.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.errorBox(StringConstants.protocolErrorText)

    def focus(self):
        sender = self.sender()
        try:
            result = self.controller.focus(self.cameraID, sender.cameraBinding)
            self.deselectPreset()
            return result
        except NamingError:
            self.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.errorBox(StringConstants.protocolErrorText)

    def stopFocus(self):
        try:
            self.controller.focus(self.cameraID, CameraFocus.Stop)
        except NamingError:
            self.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.errorBox(StringConstants.protocolErrorText)

    def zoom(self):
        sender = self.sender()
        try:
            result = self.controller.zoom(self.cameraID, sender.cameraBinding)
            self.deselectPreset()
            return result
        except NamingError:
            self.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.errorBox(StringConstants.protocolErrorText)

    def stopZoom(self):
        try:
            self.controller.zoom(self.cameraID, CameraZoom.Stop)
        except NamingError:
            self.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.errorBox(StringConstants.protocolErrorText)

    def exposure(self):
        sender = self.sender()
        try:
            result = self.controller.backlightComp(self.cameraID, sender.cameraBinding)
            self.deselectPreset()
            return result
        except NamingError:
            self.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.errorBox(StringConstants.protocolErrorText)

    def storePreset(self):
        sender = self.sender()
        try:
            result = self.controller.savePreset(self.cameraID, sender.cameraBinding)
            self.presetGroup.buttons()[sender.cameraBinding].setChecked(True)
            return result
        except NamingError:
            self.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.errorBox(StringConstants.protocolErrorText)

    def recallPreset(self):
        sender = self.sender()
        try:
            return self.controller.recallPreset(self.cameraID, sender.cameraBinding)
        except NamingError:
            self.errorBox(StringConstants.nameErrorText)
        except ProtocolError:
            self.errorBox(StringConstants.protocolErrorText)

    def deselectPreset(self):
        # Yuck.
        self.presetGroup.setExclusive(False)
        while (self.presetGroup.checkedId() >= 0):
            self.presetGroup.checkedButton().setChecked(False)
        self.presetGroup.setExclusive(True)

    def errorBox(self, text):
        msgBox = QMessageBox()
        msgBox.setText(text)
        msgBox.setIcon(QMessageBox.Critical)
        msgBox.exec_()
开发者ID:staldates,项目名称:aldatesx,代码行数:104,代码来源:CameraControls.py

示例11: AdvancedCameraControl

# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedId [as 别名]
class AdvancedCameraControl(ScreenWithBackButton):

    def __init__(self, controller, cameraID, mainScreen):
        self.controller = controller
        self.cameraID = cameraID
        super(AdvancedCameraControl, self).__init__(cameraID, mainScreen)

    def makeContent(self):
        layout = QGridLayout()

        self.posDisplay = QGridLayout()

        self.posDisplay.addWidget(QLabel("Pan:"), 0, 0)
        self.posDisplay.addWidget(QLabel("Tilt:"), 1, 0)
        self.posDisplay.addWidget(QLabel("Zoom:"), 2, 0)

        self.posDisplay.addWidget(QLabel(), 0, 1)
        self.posDisplay.addWidget(QLabel(), 1, 1)
        self.posDisplay.addWidget(QLabel(), 2, 1)

        layout.addLayout(self.posDisplay, 1, 0)

        btnGetPos = ExpandingButton()
        btnGetPos.setText("Get Position")
        btnGetPos.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        layout.addWidget(btnGetPos, 2, 0)
        btnGetPos.clicked.connect(self.displayPosition)

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

        btnAuto = OptionButton()
        btnAuto.setText("Auto")
        btnAuto.clicked.connect(lambda: self.controller.whiteBalance(self.cameraID, CameraWhiteBalance.Auto))
        whiteBalanceGrid.addWidget(btnAuto, 1, 0)

        btnIndoor = OptionButton()
        btnIndoor.setText("Indoor")
        btnIndoor.clicked.connect(lambda: self.controller.whiteBalance(self.cameraID, CameraWhiteBalance.Indoor))
        whiteBalanceGrid.addWidget(btnIndoor, 2, 0)

        btnOutdoor = OptionButton()
        btnOutdoor.setText("Outdoor")
        btnOutdoor.clicked.connect(lambda: self.controller.whiteBalance(self.cameraID, CameraWhiteBalance.Outdoor))
        whiteBalanceGrid.addWidget(btnOutdoor, 3, 0)

        btnOnePush = OptionButton()
        btnOnePush.setText("One Push")
        btnOnePush.clicked.connect(lambda: self.controller.whiteBalance(self.cameraID, CameraWhiteBalance.OnePush))
        whiteBalanceGrid.addWidget(btnOnePush, 4, 0)

        btnOnePushTrigger = ExpandingButton()
        btnOnePushTrigger.setText("Set")
        btnOnePushTrigger.clicked.connect(lambda: self.controller.whiteBalance(self.cameraID, CameraWhiteBalance.Trigger))
        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, 1, 1, 2, 1)

        return layout

    def displayPosition(self):
        pos = self.controller.getPosition(self.cameraID)

        self.posDisplay.itemAtPosition(0, 1).widget().setText(str(pos.pan))
        self.posDisplay.itemAtPosition(1, 1).widget().setText(str(pos.tilt))
        self.posDisplay.itemAtPosition(2, 1).widget().setText(str(pos.zoom))
开发者ID:staldates,项目名称:aldatesx,代码行数:78,代码来源:CameraControls.py


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