本文整理汇总了Python中PySide.QtGui.QButtonGroup.checkedButton方法的典型用法代码示例。如果您正苦于以下问题:Python QButtonGroup.checkedButton方法的具体用法?Python QButtonGroup.checkedButton怎么用?Python QButtonGroup.checkedButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QButtonGroup
的用法示例。
在下文中一共展示了QButtonGroup.checkedButton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: VideoSwitcher
# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedButton [as 别名]
#.........这里部分代码省略.........
self.blackBtn = FlashingInputButton(self.switcherState.inputs[VideoSource.BLACK])
inputs_grid.addWidget(self.blackBtn)
self.inputs.addButton(self.blackBtn)
self.blackBtn.clicked.connect(self.preview)
self.blackBtn.clicked.connect(self.displayPanel)
self.blackBtn.clicked.connect(deselectCamera)
self.ftb = FadeToBlackControl(self.switcherState.ftb, self.atem)
self.blackBtn.setProperty("panel", self.ftb)
self.blackBtn.flashing = self.switcherState.ftb.active
self.switcherState.ftb.activeChanged.connect(self.blackBtn.setFlashing)
layout.addLayout(inputs_grid, 0, 0, 1, 7)
self.og = OutputsGrid(self.switcherState)
self.og.take.connect(self.take)
self.og.cut.connect(self.cut)
self.og.selected.connect(self.sendToAux)
self.og.mainToAll.connect(self.sendMainToAllAuxes)
self.og.all.connect(self.sendToAll)
self.og.sendMain.connect(self.sendMainToAux)
self.og.setAuxesEnabled(False) # since we start off without an input selected
layout.addWidget(self.og, 1, 5, 1, 2)
self.blankWidget = QWidget()
layout.addWidget(self.blankWidget, 1, 0, 1, 5)
layout.setRowStretch(0, 1)
layout.setRowStretch(1, 5)
self.setLayout(layout)
def setExtraInput(self, inp):
self.extrasBtn.setInput(inp)
self.preview()
@with_atem
def preview(self):
checkedButton = self.inputs.checkedButton()
if checkedButton and checkedButton.input:
self.og.setAuxesEnabled(True)
if self.atem:
self.atem.setPreview(checkedButton.input.source)
else:
self.og.setAuxesEnabled(False)
@with_atem
def cut(self):
self.atem.performCut()
@with_atem
def take(self):
self.atem.setNextTransition(TransitionStyle.MIX, bkgd=True, key1=False, key2=False, key3=False, key4=False)
self.atem.performAutoTake()
@with_atem
def sendToAux(self, auxIndex):
if self.inputs.checkedButton().input:
self.atem.setAuxSource(auxIndex + 1, self.inputs.checkedButton().input.source)
@with_atem
def sendToAll(self):
if self.inputs.checkedButton().input:
self.atem.setProgram(self.inputs.checkedButton().input.source)
for aux in self.switcherState.outputs.keys():
self.sendToAux(aux)
@with_atem
def sendMainToAux(self, auxIndex):
self.atem.setAuxSource(auxIndex + 1, VideoSource.ME_1_PROGRAM)
@with_atem
def sendMainToAllAuxes(self):
for aux in self.switcherState.outputs.keys():
self.atem.setAuxSource(aux + 1, VideoSource.ME_1_PROGRAM)
def displayPanel(self):
panel = self.inputs.checkedButton().property("panel")
layout = self.layout()
existing = layout.itemAtPosition(1, 0)
if existing:
widget = existing.widget()
widget.hide()
layout.removeWidget(widget)
if panel:
# display panel
layout.addWidget(panel, 1, 0, 1, 5)
panel.show()
else:
# hide panel
layout.addWidget(self.blankWidget, 1, 0, 1, 5)
self.blankWidget.show()
def displayAdvPanel(self):
panel = self.sender().property("adv_panel")
if panel:
self.mainWindow.showScreen(panel)
示例2: CameraControl
# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedButton [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)
示例3: CameraControl
# 需要导入模块: from PySide.QtGui import QButtonGroup [as 别名]
# 或者: from PySide.QtGui.QButtonGroup import checkedButton [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_()