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
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, choices, help_texts=[], parent=None): super(ChoiceWidget, self).__init__(parent) title = "select one from choices" self.setWindowTitle(title) layout = QVBoxLayout(self) self.choiceButtonGroup = QButtonGroup(self) # it is not a visible UI self.choiceButtonGroup.setExclusive(True) if choices and len(choices) >= 1: if len(help_texts) < len(choices): help_texts = choices self.choices = choices for id, choice in enumerate(self.choices): rb = QRadioButton(choice) rb.setToolTip(help_texts[id]) self.choiceButtonGroup.addButton(rb) self.choiceButtonGroup.setId( rb, id) # negative id if not specified layout.addWidget(rb) if id == 0: rb.setChecked(True) self.choiceButtonGroup.buttonClicked.connect(self.choiceChanged) self.setLayout(layout)
def __init__(self, switcherState, parent=None): super(AllInputsPanel, self).__init__(parent) self.switcherState = switcherState self.selectedInput = None self.page = 0 self.sources = [] self.layout = QGridLayout() self.input_buttons = QButtonGroup() self.btnPageUp = ExpandingButton() self.btnPageUp.setIcon(QIcon(":icons/go-up")) self.btnPageUp.clicked.connect(lambda: self.setPage(self.page - 1)) self.layout.addWidget(self.btnPageUp, 0, 5, 3, 1) self.btnPageDown = ExpandingButton() self.btnPageDown.setIcon(QIcon(":icons/go-down")) self.btnPageDown.clicked.connect(lambda: self.setPage(self.page + 1)) self.layout.addWidget(self.btnPageDown, 3, 5, 3, 1) for col in range(5): self.layout.setColumnStretch(col, 1) for row in range(3): btn = InputButton(None) self.layout.addWidget(btn, row * 2, col, 2, 1) self.input_buttons.addButton(btn) btn.clicked.connect(self.selectInput) btn.setFixedWidth(120) self.setLayout(self.layout) self.switcherState.inputsChanged.connect(self.setSources) self.setSources() self.displayInputs()
def __init__(self): super(ColorChoiceWidget, self).__init__() self.buttons = [] self.buttonGroup = QButtonGroup() self.buttonGroup.setExclusive(True) self.buttonGroup.buttonClicked.connect(self.selectColor)
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
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)
def _createChoiceGroup(valueTypes, valueTypeTips): _buttonGroupLayout = QHBoxLayout() buttonGroupValueType = QButtonGroup() buttonGroupValueType.setExclusive(True) for id, choice in enumerate(valueTypes): rb = QRadioButton(choice) rb.setToolTip(valueTypeTips[id]) buttonGroupValueType.addButton(rb, id) _buttonGroupLayout.addWidget(rb) if id == 0: rb.setChecked(True) return buttonGroupValueType, _buttonGroupLayout
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
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
def __init__(self, parent): super(PickerTypeDialog, self).__init__(parent) self.pickerType = None self.pickerTypes = [(SurfaceType, "Surface picker"), (TwoStepType, "Two step picker")] self.radioButtons = [] for picker in self.pickerTypes: self.radioButtons.append(QRadioButton(picker[1])) # self.radioButtons[0].setChecked(True) self.buttonGroup = QButtonGroup() ind = 0 for button in self.radioButtons: self.buttonGroup.addButton(button) self.buttonGroup.setId(button, ind) ind += 1 self.nextButton = QPushButton("Choose") self.nextButton.clicked.connect(self.choose) self.cancelButton = QPushButton("Cancel") self.cancelButton.clicked.connect(self.cancel) groupLayout = QVBoxLayout() for radioButton in self.radioButtons: groupLayout.addWidget(radioButton) self.groupBox = QGroupBox("Choose picker type:") self.groupBox.setLayout(groupLayout) self.setModal(True) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(self.groupBox, 0, 0, 1, 2) layout.addWidget(self.cancelButton, 1, 0) layout.addWidget(self.nextButton, 1, 1) self.setLayout(layout)
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 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 createWidgets(self): settings = QSettings() self.searchLabel = QLabel("Search For") self.searchLineEdit = QLineEdit() self.tooltips.append((self.searchLineEdit, """\ <p><b>Search For editor</b></p> <p>The text or regular expression to search for.</p>""")) self.searchLabel.setBuddy(self.searchLineEdit) self.replaceLabel = QLabel("Replace With") self.replaceLineEdit = QLineEdit() self.tooltips.append((self.replaceLineEdit, """\ <p><b>Replace With editor</b></p> <p>The replacement text (which may include backreferences, \\1, \\2, etc., if a regular expression search is being made).</p>""")) self.replaceLabel.setBuddy(self.replaceLineEdit) self.allEntriesRadioButton = QRadioButton("All Entries") self.allEntriesRadioButton.setChecked( bool(int(settings.value("RP/All", 1)))) self.tooltips.append((self.allEntriesRadioButton, """\ <p><b>All Entries</b></p> <p>If checked, the search will consider every entry in the index.</p>""")) self.filteredEntriesRadioButton = QRadioButton("Filtered Entries") self.filteredEntriesRadioButton.setChecked( bool(int(settings.value("RP/Filtered", 0)))) self.tooltips.append((self.filteredEntriesRadioButton, """\ <p><b>Filtered Entries</b></p> <p>If checked, the search will consider only those entries that are in the current filtered view.</p>""")) self.considerLabel = QLabel("Consider") self.scopeGroup = QButtonGroup() self.scopeGroup.addButton(self.allEntriesRadioButton) self.scopeGroup.addButton(self.filteredEntriesRadioButton) self.literalRadioButton = QRadioButton("Literal") self.literalRadioButton.setChecked( bool(int(settings.value("RP/Literal", 1)))) self.tooltips.append((self.literalRadioButton, """<p><b>Literal</b></p> <p>If checked, the <b>Search For</b> text will be searched for literally.</p>""")) self.regexRadioButton = QRadioButton("Regex") self.regexRadioButton.setChecked( bool(int(settings.value("RP/Regex", 0)))) self.tooltips.append((self.regexRadioButton, """<p><b>Regex</b></p> <p>If checked, the <b>Search For</b> text will be searched for as a regular expression pattern.</p>""")) self.matchAsGroup = QButtonGroup() self.matchAsGroup.addButton(self.literalRadioButton) self.matchAsGroup.addButton(self.regexRadioButton) self.ignoreCaseCheckBox = QCheckBox("Ignore Case") self.ignoreCaseCheckBox.setChecked( bool(int(settings.value("RP/ICase", 0)))) self.tooltips.append((self.ignoreCaseCheckBox, """\ <p><b>Ignore Case</b></p> <p>If checked, the <b>Search For</b> text will be searched for case-insensitively.</p>""")) self.wholeWordsCheckBox = QCheckBox("Whole Words") self.wholeWordsCheckBox.setChecked( bool(int(settings.value("RP/WW", 0)))) self.tooltips.append((self.wholeWordsCheckBox, """\ <p><b>Whole Words</b></p> <p>If checked—and when <b>Literal</b> is checked—the <b>Search For</b> text will be matched as whole words.</p> <p>For example, “habit” will not match “habitat” when whole words is checked.</p> <p>(For regular expressions use \\b before and after each word to get whole word matches.)</p>""")) self.replaceInLabel = QLabel("Look In") self.replaceInTermsCheckBox = QCheckBox("Terms") self.replaceInTermsCheckBox.setChecked( bool(int(settings.value("RP/Terms", 1)))) self.tooltips.append((self.replaceInTermsCheckBox, """\ <p><b>Terms</b></p> <p>If checked, the search will look in term texts.</p>""")) self.replaceInPagesCheckBox = QCheckBox("Pages") self.replaceInPagesCheckBox.setChecked( bool(int(settings.value("RP/Pages", 0)))) self.tooltips.append((self.replaceInPagesCheckBox, """\ <p><b>Pages</b></p> <p>If checked, the search will look in pages texts.</p>""")) self.replaceInNotesCheckBox = QCheckBox("Notes") self.replaceInNotesCheckBox.setChecked( bool(int(settings.value("RP/Notes", 0)))) self.tooltips.append((self.replaceInNotesCheckBox, """\ <p><b>Notes</b></p> <p>If checked, the search will look in notes texts.</p>""")) self.startButton = QPushButton(QIcon(":/edit-find.svg"), "Start Search") self.tooltips.append((self.startButton, """<p><b>Start Search</b></p> <p>Start the search from the first entry in the index or the first entry in the filtered view's entries.</p>""")) self.replaceButton = QPushButton(QIcon(":/edit-find-replace.svg"), "Replace") self.tooltips.append((self.replaceButton, """<p><b>Replace</b></p> <p>Replace the highlighted text with the <b>Replace With</b> text (using backreferences if they are in the replacement text and a <b>Regex</b> search is underway), and then try to find the next matching text.</p>""")) self.skipButton = QPushButton(QIcon(":/skip.svg"), "S&kip") self.tooltips.append((self.skipButton, """<p><b>Skip</b></p> <p>Skip the highlighted text and try to find the next matching text.</p>""")) self.stopButton = QPushButton(QIcon(":/process-stop.svg"), "Stop Search") self.tooltips.append((self.stopButton, """<p><b>Stop Search</b></p> <p>Stop the current search. This allows the search options to be changed.</p>""")) self.closeButton = QToolButton() self.closeButton.setIcon(QIcon(":/hide.svg")) self.closeButton.setFocusPolicy(Qt.NoFocus) self.tooltips.append((self.closeButton, """<p><b>Hide</b></p> <p>Hide the Search and Replace panel.</p> <p>Press <b>Ctrl+H</b> or click <img src=":/edit-find-replace.svg" width={0} height={0}> or click <b>Edit→Search and Replace</b> to show it again.</p>""".format(TOOLTIP_IMAGE_SIZE))) self.helpButton = QToolButton() self.helpButton.setIcon(QIcon(":/help.svg")) self.helpButton.setFocusPolicy(Qt.NoFocus) self.tooltips.append( (self.helpButton, "Help on the Search and Replace panel."))
def initUI(self): layout = QGridLayout() self.setLayout(layout) self.btnUp = CameraButton() layout.addWidget(self.btnUp, 0, 1, 2, 1) _safelyConnect(self.btnUp.pressed, lambda: self.camera.moveUp(self.panSpeed, self.tiltSpeed)) _safelyConnect(self.btnUp.released, self.camera.stop) _safelyConnect(self.btnUp.clicked, self.deselectPreset) self.btnUp.setIcon(QIcon(":icons/go-up")) self.btnLeft = CameraButton() layout.addWidget(self.btnLeft, 1, 0, 2, 1) _safelyConnect(self.btnLeft.pressed, lambda: self.camera.moveLeft(self.panSpeed, self.tiltSpeed)) _safelyConnect(self.btnLeft.released, self.camera.stop) _safelyConnect(self.btnLeft.clicked, self.deselectPreset) self.btnLeft.setIcon(QIcon(":icons/go-previous")) self.btnDown = CameraButton() layout.addWidget(self.btnDown, 2, 1, 2, 1) _safelyConnect(self.btnDown.pressed, lambda: self.camera.moveDown(self.panSpeed, self.tiltSpeed)) _safelyConnect(self.btnDown.released, self.camera.stop) _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 makeContent(self): layout = QGridLayout() self.btnGroupSDCard = QButtonGroup() self.sdSlotMapper = QSignalMapper() for i in range(2): btn = ExpandingButton() btn.setCheckable(True) btn.setText("SD card {}".format(i + 1)) btn.clicked.connect(self.sdSlotMapper.map) self.sdSlotMapper.setMapping(btn, i + 1) self.btnGroupSDCard.addButton(btn, i) layout.addWidget(btn, 0, i) self.sdSlotMapper.mapped.connect(self.hyperdeck.selectSlot) self.btnSetPreview = ExpandingButton() self.btnSetPreview.setText("To preview") self.btnSetPreview.clicked.connect( lambda: self.atem.setPreview(VideoSource.INPUT_7)) layout.addWidget(self.btnSetPreview, 0, 4) btnClearPeaks = ExpandingButton() btnClearPeaks.setText("Clear VU peaks") btnClearPeaks.clicked.connect(self.atem.resetAudioMixerPeaks) layout.addWidget(btnClearPeaks, 0, 5) self.btnGroupTransportMode = QButtonGroup() self.btnPlaybackMode = ExpandingButton() self.btnPlaybackMode.setCheckable(True) self.btnPlaybackMode.setChecked(True) self.btnPlaybackMode.setText("Playback mode") self.btnGroupTransportMode.addButton(self.btnPlaybackMode) self.btnPlaybackMode.clicked.connect( lambda: self._setRecordMode(False)) layout.addWidget(self.btnPlaybackMode, 1, 1, 1, 2) self.btnRecordMode = ExpandingButton() self.btnRecordMode.setCheckable(True) self.btnRecordMode.setText("Record mode") self.btnGroupTransportMode.addButton(self.btnRecordMode) self.btnRecordMode.clicked.connect(lambda: self._setRecordMode(True)) layout.addWidget(self.btnRecordMode, 1, 3, 1, 2) self.btnSkipBack = _make_button("Back", ":icons/media-skip-backward", self.hyperdeck.prev) layout.addWidget(self.btnSkipBack, 2, 0) self.btngroup = QButtonGroup() self.btnPlay = _make_button("Play", ":icons/media-playback-start", self.hyperdeck.play) self.btnPlay.setCheckable(True) self.btngroup.addButton(self.btnPlay) layout.addWidget(self.btnPlay, 2, 1) self.btnLoopPlay = _make_button("Loop", ":icons/media-playback-loop", lambda: self.hyperdeck.play(loop=True)) layout.addWidget(self.btnLoopPlay, 2, 2) self.btnSkipForward = _make_button("Forward", ":icons/media-skip-forward", self.hyperdeck.next) layout.addWidget(self.btnSkipForward, 2, 3) self.btnStop = _make_button("Stop", ":icons/media-playback-stop", self.hyperdeck.stop) self.btnStop.setCheckable(True) self.btngroup.addButton(self.btnStop) layout.addWidget(self.btnStop, 2, 4) self.btnRecord = _make_button("Record", ":icons/media-record", self.hyperdeck.record) self.btnRecord.setCheckable(True) self.btnRecord.setEnabled(False) self.btngroup.addButton(self.btnRecord) layout.addWidget(self.btnRecord, 2, 5) self.clipSelectionScreen = RecorderClipSelectionScreen( self.hyperdeck, self.state, self.mainWindow) self.state.clipsListChange.connect( self.clipSelectionScreen.populateClipsList) self.state.transportChange.connect( self.clipSelectionScreen._updateClipSelectionFromState) self.btnChooseClip = ExpandingButton() self.btnChooseClip.setText("Select clip") self.btnChooseClip.clicked.connect(self._showClipSelection) layout.addWidget(self.btnChooseClip, 3, 1, 1, 2) layout.setRowStretch(0, 1) layout.setRowStretch(1, 1) layout.setRowStretch(2, 2) layout.setRowStretch(3, 1) return layout
def __init__(self, config, playerpaths, error): from syncplay import utils self.config = config self.datacleared = False if config['clearGUIData'] == True: settings = QSettings("Syncplay","PlayerList") settings.clear() settings = QSettings("Syncplay","MediaBrowseDialog") settings.clear() settings = QSettings("Syncplay","MainWindow") settings.clear() settings = QSettings("Syncplay","MoreSettings") settings.clear() self.datacleared = True self.QtGui = QtGui self.error = error if sys.platform.startswith('linux'): resourcespath = utils.findWorkingDir() + "/resources/" else: resourcespath = utils.findWorkingDir() + "\\resources\\" self.resourcespath = resourcespath super(ConfigDialog, self).__init__() self.setWindowTitle(getMessage("en", "config-window-title")) self.setWindowFlags(self.windowFlags() & Qt.WindowCloseButtonHint & ~Qt.WindowContextHelpButtonHint) self.setWindowIcon(QtGui.QIcon(resourcespath + "syncplay.png")) if(config['host'] == None): host = "" elif(":" in config['host']): host = config['host'] else: host = config['host']+":"+str(config['port']) self.connectionSettingsGroup = QtGui.QGroupBox(getMessage("en", "connection-group-title")) self.hostTextbox = QLineEdit(host, self) self.hostLabel = QLabel(getMessage("en", "host-label"), self) self.usernameTextbox = QLineEdit(config['name'],self) self.serverpassLabel = QLabel(getMessage("en", "password-label"), self) self.defaultroomTextbox = QLineEdit(config['room'],self) self.usernameLabel = QLabel(getMessage("en", "username-label"), self) self.serverpassTextbox = QLineEdit(config['password'],self) self.defaultroomLabel = QLabel(getMessage("en", "room-label"), self) if (constants.SHOW_TOOLTIPS == True): self.hostLabel.setToolTip(getMessage("en", "host-tooltip")) self.hostTextbox.setToolTip(getMessage("en", "host-tooltip")) self.usernameLabel.setToolTip(getMessage("en", "username-tooltip")) self.usernameTextbox.setToolTip(getMessage("en", "username-tooltip")) self.serverpassLabel.setToolTip(getMessage("en", "password-tooltip")) self.serverpassTextbox.setToolTip(getMessage("en", "password-tooltip")) self.defaultroomLabel.setToolTip(getMessage("en", "room-tooltip")) self.defaultroomTextbox.setToolTip(getMessage("en", "room-tooltip")) self.connectionSettingsLayout = QtGui.QGridLayout() self.connectionSettingsLayout.addWidget(self.hostLabel, 0, 0) self.connectionSettingsLayout.addWidget(self.hostTextbox, 0, 1) self.connectionSettingsLayout.addWidget(self.serverpassLabel, 1, 0) self.connectionSettingsLayout.addWidget(self.serverpassTextbox, 1, 1) self.connectionSettingsLayout.addWidget(self.usernameLabel, 2, 0) self.connectionSettingsLayout.addWidget(self.usernameTextbox, 2, 1) self.connectionSettingsLayout.addWidget(self.defaultroomLabel, 3, 0) self.connectionSettingsLayout.addWidget(self.defaultroomTextbox, 3, 1) self.connectionSettingsGroup.setLayout(self.connectionSettingsLayout) self.mediaplayerSettingsGroup = QtGui.QGroupBox(getMessage("en", "media-setting-title")) self.executableiconImage = QtGui.QImage() self.executableiconLabel = QLabel(self) self.executableiconLabel.setMinimumWidth(16) self.executablepathCombobox = QtGui.QComboBox(self) self.executablepathCombobox.setEditable(True) self.executablepathCombobox.currentIndexChanged.connect(self.updateExecutableIcon) self.executablepathCombobox.setEditText(self._tryToFillPlayerPath(config['playerPath'], playerpaths)) self.executablepathCombobox.setMinimumWidth(200) self.executablepathCombobox.setMaximumWidth(200) self.executablepathCombobox.editTextChanged.connect(self.updateExecutableIcon) self.executablepathLabel = QLabel(getMessage("en", "executable-path-label"), self) self.executablebrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'),getMessage("en", "browse-label")) self.executablebrowseButton.clicked.connect(self.browsePlayerpath) self.mediapathTextbox = QLineEdit(config['file'], self) self.mediapathLabel = QLabel(getMessage("en", "media-path-label"), self) self.mediabrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'),getMessage("en", "browse-label")) self.mediabrowseButton.clicked.connect(self.browseMediapath) if (constants.SHOW_TOOLTIPS == True): self.executablepathLabel.setToolTip(getMessage("en", "executable-path-tooltip")) self.executablepathCombobox.setToolTip(getMessage("en", "executable-path-tooltip")) self.mediapathLabel.setToolTip(getMessage("en", "media-path-tooltip")) self.mediapathTextbox.setToolTip(getMessage("en", "media-path-tooltip")) if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True: self.rewindCheckbox = QCheckBox(getMessage("en", "rewind-label")) if (constants.SHOW_TOOLTIPS == True): self.rewindCheckbox.setToolTip(getMessage("en", "rewind-tooltip")) self.mediaplayerSettingsLayout = QtGui.QGridLayout() self.mediaplayerSettingsLayout.addWidget(self.executablepathLabel, 0, 0) self.mediaplayerSettingsLayout.addWidget(self.executableiconLabel, 0, 1) self.mediaplayerSettingsLayout.addWidget(self.executablepathCombobox, 0, 2) self.mediaplayerSettingsLayout.addWidget(self.executablebrowseButton, 0, 3) self.mediaplayerSettingsLayout.addWidget(self.mediapathLabel, 1, 0) self.mediaplayerSettingsLayout.addWidget(self.mediapathTextbox , 1, 2) self.mediaplayerSettingsLayout.addWidget(self.mediabrowseButton , 1, 3) self.mediaplayerSettingsGroup.setLayout(self.mediaplayerSettingsLayout) self.moreSettingsGroup = QtGui.QGroupBox(getMessage("en", "more-title")) self.moreSettingsGroup.setCheckable(True) self.malSettingsSplit = QtGui.QSplitter(self) self.malusernameTextbox = QLineEdit(config['malUsername'],self) self.malusernameTextbox.setMaximumWidth(115) self.malusernameLabel = QLabel(getMessage("en", "mal-username-label"), self) self.malpasswordTextbox = QLineEdit(config['malPassword'],self) self.malpasswordTextbox.setEchoMode(QtGui.QLineEdit.Password) self.malpasswordLabel = QLabel(getMessage("en", "mal-password-label"), self) ### <MAL DISABLE> self.malpasswordTextbox.hide() self.malpasswordLabel.hide() self.malusernameTextbox.hide() self.malusernameLabel.hide() ### </MAL DISABLE> self.filenameprivacyLabel = QLabel(getMessage("en", "filename-privacy-label"), self) self.filenameprivacyButtonGroup = QButtonGroup() self.filenameprivacySendRawOption = QRadioButton(getMessage("en", "privacy-sendraw-option")) self.filenameprivacySendHashedOption = QRadioButton(getMessage("en", "privacy-sendhashed-option")) self.filenameprivacyDontSendOption = QRadioButton(getMessage("en", "privacy-dontsend-option")) self.filenameprivacyButtonGroup.addButton(self.filenameprivacySendRawOption) self.filenameprivacyButtonGroup.addButton(self.filenameprivacySendHashedOption) self.filenameprivacyButtonGroup.addButton(self.filenameprivacyDontSendOption) self.filesizeprivacyLabel = QLabel(getMessage("en", "filesize-privacy-label"), self) self.filesizeprivacyButtonGroup = QButtonGroup() self.filesizeprivacySendRawOption = QRadioButton(getMessage("en", "privacy-sendraw-option")) self.filesizeprivacySendHashedOption = QRadioButton(getMessage("en", "privacy-sendhashed-option")) self.filesizeprivacyDontSendOption = QRadioButton(getMessage("en", "privacy-dontsend-option")) self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacySendRawOption) self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacySendHashedOption) self.filesizeprivacyButtonGroup.addButton(self.filesizeprivacyDontSendOption) self.slowdownCheckbox = QCheckBox(getMessage("en", "slowdown-label")) self.pauseonleaveCheckbox = QCheckBox(getMessage("en", "pauseonleave-label")) self.alwaysshowCheckbox = QCheckBox(getMessage("en", "alwayshow-label")) self.donotstoreCheckbox = QCheckBox(getMessage("en", "donotstore-label")) filenamePrivacyMode = config['filenamePrivacyMode'] if filenamePrivacyMode == constants.PRIVACY_DONTSEND_MODE: self.filenameprivacyDontSendOption.setChecked(True) elif filenamePrivacyMode == constants.PRIVACY_SENDHASHED_MODE: self.filenameprivacySendHashedOption.setChecked(True) else: self.filenameprivacySendRawOption.setChecked(True) filesizePrivacyMode = config['filesizePrivacyMode'] if filesizePrivacyMode == constants.PRIVACY_DONTSEND_MODE: self.filesizeprivacyDontSendOption.setChecked(True) elif filesizePrivacyMode == constants.PRIVACY_SENDHASHED_MODE: self.filesizeprivacySendHashedOption.setChecked(True) else: self.filesizeprivacySendRawOption.setChecked(True) if config['slowOnDesync'] == True: self.slowdownCheckbox.setChecked(True) if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True and config['rewindOnDesync'] == True: self.rewindCheckbox.setChecked(True) if config['pauseOnLeave'] == True: self.pauseonleaveCheckbox.setChecked(True) if (constants.SHOW_TOOLTIPS == True): self.malusernameLabel.setToolTip(getMessage("en", "mal-username-tooltip")) self.malusernameTextbox.setToolTip(getMessage("en", "mal-username-tooltip")) self.malpasswordLabel.setToolTip(getMessage("en", "mal-password-tooltip")) self.malpasswordTextbox.setToolTip(getMessage("en", "mal-password-tooltip")) self.filenameprivacyLabel.setToolTip(getMessage("en", "filename-privacy-tooltip")) self.filenameprivacySendRawOption.setToolTip(getMessage("en", "privacy-sendraw-tooltip")) self.filenameprivacySendHashedOption.setToolTip(getMessage("en", "privacy-sendhashed-tooltip")) self.filenameprivacyDontSendOption.setToolTip(getMessage("en", "privacy-dontsend-tooltip")) self.filesizeprivacyLabel.setToolTip(getMessage("en", "filesize-privacy-tooltip")) self.filesizeprivacySendRawOption.setToolTip(getMessage("en", "privacy-sendraw-tooltip")) self.filesizeprivacySendHashedOption.setToolTip(getMessage("en", "privacy-sendhashed-tooltip")) self.filesizeprivacyDontSendOption.setToolTip(getMessage("en", "privacy-dontsend-tooltip")) self.slowdownCheckbox.setToolTip(getMessage("en", "slowdown-tooltip")) self.pauseonleaveCheckbox.setToolTip(getMessage("en", "pauseonleave-tooltip")) self.alwaysshowCheckbox.setToolTip(getMessage("en", "alwayshow-tooltip")) self.donotstoreCheckbox.setToolTip(getMessage("en", "donotstore-tooltip")) self.slowdownCheckbox.setToolTip(getMessage("en", "slowdown-tooltip")) self.moreSettingsLayout = QtGui.QGridLayout() self.privacySettingsLayout = QtGui.QGridLayout() self.privacyFrame = QtGui.QFrame() self.privacyFrame.setLineWidth(0) self.privacyFrame.setMidLineWidth(0) self.privacySettingsLayout.setContentsMargins(0,0,0,0) self.privacySettingsLayout.addWidget(self.filenameprivacyLabel, 0, 0) self.privacySettingsLayout.addWidget(self.filenameprivacySendRawOption, 0, 1, Qt.AlignRight) self.privacySettingsLayout.addWidget(self.filenameprivacySendHashedOption, 0,2, Qt.AlignRight) self.privacySettingsLayout.addWidget(self.filenameprivacyDontSendOption, 0, 3, Qt.AlignRight) self.privacySettingsLayout.addWidget(self.filesizeprivacyLabel, 1, 0) self.privacySettingsLayout.addWidget(self.filesizeprivacySendRawOption, 1, 1, Qt.AlignRight) self.privacySettingsLayout.addWidget(self.filesizeprivacySendHashedOption, 1, 2, Qt.AlignRight) self.privacySettingsLayout.addWidget(self.filesizeprivacyDontSendOption, 1, 3, Qt.AlignRight) self.privacyFrame.setLayout(self.privacySettingsLayout) self.moreSettingsLayout.addWidget(self.privacyFrame, 0, 0, 1, 4) self.moreSettingsLayout.addWidget(self.malusernameLabel , 1, 0) self.moreSettingsLayout.addWidget(self.malusernameTextbox, 1, 1) self.moreSettingsLayout.addWidget(self.malpasswordLabel , 1, 2) self.moreSettingsLayout.addWidget(self.malpasswordTextbox, 1, 3) self.moreSettingsLayout.addWidget(self.slowdownCheckbox, 2, 0,1,4) if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True: self.moreSettingsLayout.addWidget(self.rewindCheckbox, 3, 0, 1, 4) self.moreSettingsLayout.addWidget(self.pauseonleaveCheckbox, 4, 0, 1, 4) self.moreSettingsLayout.addWidget(self.alwaysshowCheckbox, 5, 0, 1, 4) self.moreSettingsLayout.addWidget(self.donotstoreCheckbox, 6, 0, 1, 4) self.moreSettingsGroup.setLayout(self.moreSettingsLayout) self.showmoreCheckbox = QCheckBox(getMessage("en", "more-title")) if self.getMoreState() == False: self.showmoreCheckbox.setChecked(False) self.moreSettingsGroup.hide() else: self.showmoreCheckbox.hide() self.showmoreCheckbox.toggled.connect(self.moreToggled) self.moreSettingsGroup.toggled.connect(self.moreToggled) if config['forceGuiPrompt'] == True: self.alwaysshowCheckbox.setChecked(True) if (constants.SHOW_TOOLTIPS == True): self.showmoreCheckbox.setToolTip(getMessage("en", "more-tooltip")) self.donotstoreCheckbox.toggled.connect(self.runButtonTextUpdate) self.mainLayout = QtGui.QVBoxLayout() if error: self.errorLabel = QLabel(error, self) self.errorLabel.setAlignment(Qt.AlignCenter) self.errorLabel.setStyleSheet("QLabel { color : red; }") self.mainLayout.addWidget(self.errorLabel) self.mainLayout.addWidget(self.connectionSettingsGroup) self.mainLayout.addSpacing(12) self.mainLayout.addWidget(self.mediaplayerSettingsGroup) self.mainLayout.addSpacing(12) self.mainLayout.addWidget(self.showmoreCheckbox) self.mainLayout.addWidget(self.moreSettingsGroup) self.mainLayout.addSpacing(12) self.topLayout = QtGui.QHBoxLayout() self.helpButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'help.png'),getMessage("en", "help-label")) if (constants.SHOW_TOOLTIPS == True): self.helpButton.setToolTip(getMessage("en", "help-tooltip")) self.helpButton.setMaximumSize(self.helpButton.sizeHint()) self.helpButton.pressed.connect(self.openHelp) self.runButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'),getMessage("en", "storeandrun-label")) self.runButton.pressed.connect(self._saveDataAndLeave) if config['noStore'] == True: self.donotstoreCheckbox.setChecked(True) self.runButton.setText(getMessage("en", "run-label")) self.topLayout.addWidget(self.helpButton, Qt.AlignLeft) self.topLayout.addWidget(self.runButton, Qt.AlignRight) self.mainLayout.addLayout(self.topLayout) self.mainLayout.addStretch(1) self.setLayout(self.mainLayout) self.runButton.setFocus() self.setFixedSize(self.sizeHint()) self.setAcceptDrops(True) if self.datacleared == True: QtGui.QMessageBox.information(self,"Syncplay", getMessage("en", "gui-data-cleared-notification"))