Exemplo n.º 1
0
    def __init__(self, parent=None):
        super(TouchSpinner, self).__init__(parent)
        self._value = 50
        self._max = 100
        self._min = 0

        layout = QHBoxLayout()

        self.btnMinus = ExpandingButton()
        self.btnMinus.setIcon(QIcon(":icons/list-remove"))
        self.btnMinus.setText("-")
        self.btnMinus.clicked.connect(lambda: self.setValue(self._value - 1))
        layout.addWidget(self.btnMinus, 1)

        self.lblValue = QLabel(self.formattedValue(self._value))
        self.lblValue.setAlignment(Qt.AlignHCenter)
        layout.addWidget(self.lblValue, 1)

        self.btnPlus = ExpandingButton()
        self.btnPlus.setIcon(QIcon(":icons/list-add"))
        self.btnPlus.setText("+")
        self.btnPlus.clicked.connect(lambda: self.setValue(self._value + 1))
        layout.addWidget(self.btnPlus, 1)

        self.setLayout(layout)
Exemplo n.º 2
0
    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, ftb, atem, parent=None):
        super(FadeToBlackControl, self).__init__(parent)
        self.atem = atem
        self.ftb = ftb

        layout = QGridLayout()

        lblRate = QLabel("Rate")
        lblRate.setAlignment(Qt.AlignHCenter | Qt.AlignBottom)
        layout.addWidget(lblRate, 0, 0)

        self.rate = FrameRateTouchSpinner()
        self.rate.setValue(self.ftb.rate)

        layout.addWidget(self.rate, 1, 0)

        self.btnFade = ExpandingButton()
        self.btnFade.setText("Fade to Black")
        self.btnFade.setCheckable(True)
        self.btnFade.setChecked(self.ftb.active)
        layout.addWidget(self.btnFade, 1, 1)

        self.ftb.rateChanged.connect(self.rate.setValue)
        self.ftb.activeChanged.connect(self.btnFade.setChecked)

        if self.atem:
            self.rate.valueChanged.connect(self.atem.setFadeToBlackRate)
            self.btnFade.clicked.connect(self.atem.performFadeToBlack)

        layout.setRowStretch(0, 1)
        layout.setRowStretch(1, 1)

        self.setLayout(layout)
Exemplo n.º 4
0
    def makeContent(self):
        layout = QVBoxLayout()

        lblVersion = QLabel()
        lblVersion.setText("av-control version {0} (avx version {1})".format(_ui_version, _avx_version))
        layout.addWidget(lblVersion)

        self.lv = LogViewer(self.controller, self.mainWindow)

        log = ExpandingButton()
        log.setText("Log")
        log.clicked.connect(self.showLog)
        layout.addWidget(log)

        btnAutoTrack = ExpandingButton()
        btnAutoTrack.setText("Recalibrate Extras scan converter")
        btnAutoTrack.clicked.connect(handlePyroErrors(lambda: self.controller["Extras Scan Converter"].recalibrate()))
        layout.addWidget(btnAutoTrack)

        btnQuit = ExpandingButton()
        btnQuit.setText("Exit AV Control")
        btnQuit.clicked.connect(self.mainWindow.close)
        layout.addWidget(btnQuit)

        return layout
Exemplo n.º 5
0
def _make_button(caption, icon, onclick):
    b = ExpandingButton()
    b.setIcon(QIcon(icon))
    b.setText(caption)
    b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextUnderIcon)
    b.clicked.connect(onclick)
    return b
Exemplo n.º 6
0
    def makeContent(self):
        layout = QHBoxLayout()

        prefs = PreferencesWidget(self.controller, self.transition)
        layout.addWidget(prefs, 1)

        rhs = QVBoxLayout()

        lblVersion = QLabel()
        lblVersion.setText("av-control version {0} (avx version {1})".format(_ui_version, _avx_version))
        rhs.addWidget(lblVersion)

        self.lv = LogViewer(self.controller, self.mainWindow)

        log = ExpandingButton()
        log.setText("Log")
        log.clicked.connect(self.showLog)
        rhs.addWidget(log)

        btnQuit = ExpandingButton()
        btnQuit.setText("Exit AV Control")
        btnQuit.clicked.connect(self.mainWindow.close)
        rhs.addWidget(btnQuit)

        layout.addLayout(rhs, 1)

        return layout
Exemplo n.º 7
0
    def __init__(self, dsk, atem, parent=None):
        super(OverlayControl, self).__init__(parent)
        self.atem = atem
        self.dsk = dsk

        dsk.changedState.connect(self.update_from_dsk)

        layout = QGridLayout()

        lbl = QLabel("Overlay on main output:")
        lbl.setAlignment(Qt.AlignHCenter)
        layout.addWidget(lbl, 0, 0, 2, 1)

        self.onAirButton = ExpandingButton()
        self.onAirButton.setText("On Air")
        self.onAirButton.setCheckable(True)
        self.onAirButton.clicked.connect(self.setOnAir)

        layout.addWidget(self.onAirButton, 0, 1, 2, 1)

        self.autoButton = ExpandingButton()
        self.autoButton.setText("Auto Fade")
        self.autoButton.clicked.connect(self.takeAuto)

        layout.addWidget(self.autoButton, 2, 1, 2, 1)

        lblRate = QLabel("Rate:")
        lblRate.setAlignment(Qt.AlignHCenter | Qt.AlignBottom)
        layout.addWidget(lblRate, 2, 0)

        self.rate = FrameRateTouchSpinner()
        self.rate.setMinimum(1)
        self.rate.setMaximum(250)
        self.rate.setValue(25)
        self.rate.valueChanged.connect(self.setRate)
        layout.addWidget(self.rate, 3, 0)

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

        self.resetParams()
        self.update_from_dsk()

        self.setLayout(layout)
Exemplo n.º 8
0
def _make_button(caption, icon, onclick):
    b = ExpandingButton()
    b.setIcon(QIcon(icon))
    b.setText(caption)
    b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextUnderIcon)
    b.clicked.connect(onclick)
    return b
Exemplo n.º 9
0
    def __init__(self, switcherState, parent=None):
        super(OutputsGrid, self).__init__(parent)

        self.signalMapper = QSignalMapper(self)
        self.longPressSignalMapper = QSignalMapper(self)

        layout = QGridLayout()

        mainMixFrame = MainMixControl()
        mainMixFrame.cut.connect(self.cut.emit)
        mainMixFrame.take.connect(self.take.emit)

        layout.addWidget(mainMixFrame, 0, 0, 1, 2)

        self.aux_buttons = []

        for idx, output in switcherState.outputs.iteritems():
            ob = OutputButton(output)
            layout.addWidget(ob, 1 + (idx / 2), idx % 2)
            ob.clicked.connect(self.signalMapper.map)
            self.signalMapper.setMapping(ob, idx)

            ob.longpress.connect(self.longPressSignalMapper.map)
            self.longPressSignalMapper.setMapping(ob, idx)
            self.aux_buttons.append(ob)

        self.signalMapper.mapped.connect(self.registerClick)
        self.longPressSignalMapper.mapped.connect(self.longPress)

        btnAll = ExpandingButton()
        btnAll.setProperty("class", "mainMix")
        btnAll.setText("Mix to all")
        btnAll.clicked.connect(self.mainToAll.emit)
        layout.addWidget(btnAll, 4, 0)

        self.btnAll = ExpandingButton()
        self.btnAll.setText("All")
        self.btnAll.clicked.connect(self.all.emit)
        layout.addWidget(self.btnAll, 4, 1)

        layout.setColumnMinimumWidth(0, 100)
        layout.setColumnMinimumWidth(1, 100)
        layout.setColumnStretch(0, 1)
        layout.setColumnStretch(1, 1)

        layout.setRowStretch(0, 2)
        for i in range(1, 5):
            layout.setRowStretch(i, 1)

        self.setLayout(layout)
Exemplo n.º 10
0
    def __init__(self, parent=None):
        super(PowerNotificationDialog, self).__init__(parent)
        self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)

        layout = QGridLayout()

        spinBox = QLabel()
        spinner = QMovie(":icons/spinner")
        spinner.start()
        spinBox.setMovie(spinner)
        layout.addWidget(spinBox, 0, 0)

        self.textBox = QLabel()

        layout.addWidget(self.textBox, 0, 1, 1, 3)

        btnOK = ExpandingButton()
        btnOK.setText("OK")
        btnOK.clicked.connect(self.accept)
        layout.addWidget(btnOK, 1, 1, 1, 2)

        self.setLayout(layout)
Exemplo n.º 11
0
    def __init__(self, parent=None):
        super(PowerNotificationDialog, self).__init__(parent)
        self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)

        layout = QGridLayout()

        spinBox = QLabel()
        spinner = QMovie(":icons/spinner")
        spinner.start()
        spinBox.setMovie(spinner)
        layout.addWidget(spinBox, 0, 0)

        self.textBox = QLabel()

        layout.addWidget(self.textBox, 0, 1, 1, 3)

        btnOK = ExpandingButton()
        btnOK.setText("OK")
        btnOK.clicked.connect(self.accept)
        layout.addWidget(btnOK, 1, 1, 1, 2)

        self.setLayout(layout)
Exemplo n.º 12
0
    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)
Exemplo n.º 13
0
    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)
Exemplo n.º 14
0
    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
Exemplo n.º 15
0
    def __init__(self, title, mainWindow):
        super(ScreenWithBackButton, self).__init__()
        self.title = title
        self.mainWindow = mainWindow

        layout = QGridLayout()

        title = QLabel(title)
        title.setStyleSheet("font-size: 48px;")
        title.setAlignment(Qt.AlignCenter)
        layout.addWidget(title, 0, 0, 1, 7)

        layout.addLayout(self.makeContent(), 1, 0, 1, 7)

        b = ExpandingButton()
        b.setText("Back")
        b.setIcon(QIcon(":icons/go-previous"))
        b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        b.clicked.connect(mainWindow.stepBack)
        layout.addWidget(b, 2, 0, 1, 3)
        layout.setRowStretch(0, 1)
        layout.setRowStretch(1, 6)
        layout.setRowStretch(2, 1)
        self.setLayout(layout)
Exemplo n.º 16
0
class AllInputsPanel(QWidget):

    inputSelected = Signal(Input)

    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 setSources(self):
        self.sources = [
            vs for vs in VideoSource if vs in self.switcherState.inputs.keys()
        ]

    def displayInputs(self):

        idx = 0
        start = self.page * 15
        end = start + 15

        self.input_buttons.setExclusive(False)
        for btn in self.input_buttons.buttons():
            btn.hide()
            btn.setChecked(False)
        self.input_buttons.setExclusive(True)

        for vs in self.sources[start:end]:
            inp = self.switcherState.inputs[vs]
            row = (idx / 5) * 2
            col = idx % 5

            btn = self.layout.itemAtPosition(row, col).widget()
            btn.setInput(inp)
            btn.setChecked(inp == self.selectedInput)
            btn.show()

            idx += 1

        self.btnPageUp.setEnabled(self.page > 0)
        self.btnPageDown.setEnabled(end < len(self.switcherState.inputs))

    def setPage(self, page):
        self.page = page
        self.displayInputs()

    def selectInput(self):
        inputBtn = self.sender()
        self.selectedInput = inputBtn.input
        self.inputSelected.emit(inputBtn.input)
Exemplo n.º 17
0
    def __init__(self, controller, joystickAdapter=None):
        super(MainWindow, self).__init__()
        self.controller = controller

        self.setWindowTitle("av-control")
        self.resize(1024, 600)
        self.setWindowIcon(QIcon(":icons/video-display"))

        atem = controller['ATEM']
        self.switcherState = SwitcherState(atem)

        self.mainScreen = VideoSwitcher(controller, self, self.switcherState, joystickAdapter)

        # This is possibly a bad / too complicated idea...
        # self.mainScreen.setEnabled(self.switcherState.connected)
        # self.switcherState.connectionChanged.connect(self.mainScreen.setEnabled)

        self.stack = QStackedWidget()
        self.stack.addWidget(self.mainScreen)

        outer = QWidget()
        mainLayout = QGridLayout()
        mainLayout.addWidget(self.stack, 0, 0, 1, 7)

        column = 0

        self.spc = SystemPowerWidget(controller, self)

        syspower = ExpandingButton()
        syspower.setText("Power")
        syspower.clicked.connect(self.showSystemPower)
        syspower.setIcon(QIcon(":icons/system-shutdown"))
        syspower.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        mainLayout.addWidget(syspower, 1, column)
        column += 1

        if controller.hasDevice("Blinds"):
            self.bc = BlindsControl(controller["Blinds"], self)

            blinds = ExpandingButton()
            blinds.setText("Blinds")
            blinds.clicked.connect(lambda: self.showScreen(self.bc))
            blinds.setIcon(QIcon(":icons/blinds"))
            blinds.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
            mainLayout.addWidget(blinds, 1, column)
            column += 1

        if controller.hasDevice("Lights"):
            self.lightsMenu = LightingControl(controller["Lights"], self)

            lights = ExpandingButton()
            lights.setText("Lights")
            lights.clicked.connect(lambda: self.showScreen(self.lightsMenu))
            lights.setIcon(QIcon(":icons/lightbulb_on"))
            lights.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
            mainLayout.addWidget(lights, 1, column)
            column += 1

        if controller.hasDevice("Recorder"):
            hyperdeck = controller['Recorder']
            self.hyperdeckState = HyperdeckState(hyperdeck)
            self.recorderScreen = RecorderControl(hyperdeck, atem, self.hyperdeckState, self)
            recorder = ExpandingButton()
            recorder.setText("Recorder")
            recorder.setIcon(QIcon(":icons/drive-optical"))
            recorder.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
            recorder.clicked.connect(lambda: self.showScreen(self.recorderScreen))
            mainLayout.addWidget(recorder, 1, column)
            column += 1

            def update_recorder_icon(transport):
                if 'status' in transport:
                    if transport['status'] == TransportState.RECORD:
                        recorder.setIcon(QIcon(":icons/media-record"))
                    elif transport['status'] == TransportState.PLAYING:
                        recorder.setIcon(QIcon(":icons/media-playback-start"))
                    else:
                        recorder.setIcon(QIcon(":icons/drive-optical"))
            self.hyperdeckState.transportChange.connect(update_recorder_icon)

        self.advMenu = AdvancedMenu(self.controller, self.switcherState.mixTransition, atem, self)

        adv = ExpandingButton()
        adv.setText("Advanced")
        adv.setIcon(QIcon(":icons/applications-system"))
        adv.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        adv.clicked.connect(lambda: self.showScreen(self.advMenu))
        mainLayout.addWidget(adv, 1, column)
        column += 1

        for i in range(column):
            mainLayout.setColumnStretch(i, 1)

        tray = QHBoxLayout()
        tray.addWidget(Clock())
        tray.addWidget(SystemStatus(controller))
        mainLayout.addLayout(tray, 1, column)

        mainLayout.setRowStretch(0, 8)
        mainLayout.setRowStretch(1, 0)

        outer.setLayout(mainLayout)

        self.setCentralWidget(outer)

        self.pnd = PowerNotificationDialog(self)
        self.pnd.accepted.connect(self.hidePowerDialog)
Exemplo n.º 18
0
    def __init__(self, hyperdeck, state, mainWindow):
        super(RecorderClipSelectionScreen, self).__init__()
        self.hyperdeck = hyperdeck
        self.state = state
        self.mainWindow = mainWindow

        self.selected_clip = None

        layout = QGridLayout()

        lblTitle = TitleLabel("Select clip")
        layout.addWidget(lblTitle, 0, 0, 1, 3)

        self.clipTable = QTableWidget()
        self.clipTable.setColumnCount(2)
        self.clipTable.setHorizontalHeaderLabels(['ID', 'Clip name'])
        self.clipTable.horizontalHeader().setStretchLastSection(True)
        self.clipTable.setSelectionBehavior(
            QAbstractItemView.SelectionBehavior.SelectRows)

        self.clipTable.itemSelectionChanged.connect(self._onClipSelected)

        layout.addWidget(self.clipTable, 1, 0, 1, 3)

        b = ExpandingButton()
        b.setText("Back")
        b.setIcon(QIcon(":icons/go-previous"))
        b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        b.clicked.connect(mainWindow.stepBack)
        layout.addWidget(b, 2, 0)

        btnRefresh = ExpandingButton()
        btnRefresh.setText('Refresh')
        btnRefresh.setIcon(QIcon(':icons/refresh'))
        btnRefresh.setToolButtonStyle(
            Qt.ToolButtonStyle.ToolButtonTextBesideIcon)

        def refresh():
            self.populateClipsList({})
            hyperdeck.broadcastClipsList()

        btnRefresh.clicked.connect(refresh)

        layout.addWidget(btnRefresh, 2, 1)

        self.btnSelect = ExpandingButton()
        self.btnSelect.setText("Cue clip")
        self.btnSelect.clicked.connect(self._cueClip)
        layout.addWidget(self.btnSelect, 2, 2)

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

        self.setLayout(layout)

        self.populateClipsList(state.clip_listing)
Exemplo n.º 19
0
class RecorderClipSelectionScreen(QWidget):
    def __init__(self, hyperdeck, state, mainWindow):
        super(RecorderClipSelectionScreen, self).__init__()
        self.hyperdeck = hyperdeck
        self.state = state
        self.mainWindow = mainWindow

        self.selected_clip = None

        layout = QGridLayout()

        lblTitle = TitleLabel("Select clip")
        layout.addWidget(lblTitle, 0, 0, 1, 3)

        self.clipTable = QTableWidget()
        self.clipTable.setColumnCount(2)
        self.clipTable.setHorizontalHeaderLabels(['ID', 'Clip name'])
        self.clipTable.horizontalHeader().setStretchLastSection(True)
        self.clipTable.setSelectionBehavior(
            QAbstractItemView.SelectionBehavior.SelectRows)

        self.clipTable.itemSelectionChanged.connect(self._onClipSelected)

        layout.addWidget(self.clipTable, 1, 0, 1, 3)

        b = ExpandingButton()
        b.setText("Back")
        b.setIcon(QIcon(":icons/go-previous"))
        b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        b.clicked.connect(mainWindow.stepBack)
        layout.addWidget(b, 2, 0)

        btnRefresh = ExpandingButton()
        btnRefresh.setText('Refresh')
        btnRefresh.setIcon(QIcon(':icons/refresh'))
        btnRefresh.setToolButtonStyle(
            Qt.ToolButtonStyle.ToolButtonTextBesideIcon)

        def refresh():
            self.populateClipsList({})
            hyperdeck.broadcastClipsList()

        btnRefresh.clicked.connect(refresh)

        layout.addWidget(btnRefresh, 2, 1)

        self.btnSelect = ExpandingButton()
        self.btnSelect.setText("Cue clip")
        self.btnSelect.clicked.connect(self._cueClip)
        layout.addWidget(self.btnSelect, 2, 2)

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

        self.setLayout(layout)

        self.populateClipsList(state.clip_listing)

    def populateClipsList(self, clipsList):
        self.selected_clip = None
        self.btnSelect.setEnabled(False)
        self.clipTable.clearContents()
        self.clipTable.setRowCount(len(clipsList))
        for idx, (clip_id, val) in enumerate(clipsList.iteritems()):
            self.clipTable.setItem(idx, 0, QTableWidgetItem(str(clip_id)))
            self.clipTable.setItem(idx, 1, QTableWidgetItem(val['name']))

    def _updateClipSelectionFromState(self, state):
        if 'clip id' in state:
            clip_id = state['clip id']
            for row in range(self.clipTable.rowCount()):
                this_id = self.clipTable.item(row, 0)
                if this_id.text() == str(clip_id):
                    self.clipTable.selectRow(row)
                    break

    def _onClipSelected(self):
        selected_items = self.clipTable.selectedItems()
        if selected_items:
            self.selected_clip = int(selected_items[0].text())
            self.btnSelect.setEnabled(True)
        else:
            self.btnSelect.setEnabled(False)

    def _cueClip(self):
        if self.selected_clip:
            self.mainWindow.stepBack()
            self.hyperdeck.gotoClip(self.selected_clip)
Exemplo n.º 20
0
    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
Exemplo n.º 21
0
    def __init__(self, parent=None):
        super(MainMixControl, self).__init__(parent)
        layout = QGridLayout()

        label = QLabel('Main mix', None)
        label.setAlignment(Qt.AlignHCenter)
        layout.addWidget(label, 0, 0, 1, 2)

        btnTake = ExpandingButton()
        btnTake.setProperty("class", "mainMix")
        btnTake.setText("Cut")
        btnTake.clicked.connect(self.cut.emit)
        layout.addWidget(btnTake, 1, 0)

        btnFade = ExpandingButton()
        btnFade.setProperty("class", "mainMix")
        btnFade.setText("Fade")
        btnFade.clicked.connect(self.take.emit)
        layout.addWidget(btnFade, 1, 1)

        self.setLayout(layout)
Exemplo n.º 22
0
class OverlayControl(QWidget):
    def __init__(self, dsk, atem, parent=None):
        super(OverlayControl, self).__init__(parent)
        self.atem = atem
        self.dsk = dsk

        dsk.changedState.connect(self.update_from_dsk)

        layout = QGridLayout()

        lbl = QLabel("Overlay on main output:")
        lbl.setAlignment(Qt.AlignHCenter)
        layout.addWidget(lbl, 0, 0, 2, 1)

        self.onAirButton = ExpandingButton()
        self.onAirButton.setText("On Air")
        self.onAirButton.setCheckable(True)
        self.onAirButton.clicked.connect(self.setOnAir)

        layout.addWidget(self.onAirButton, 0, 1, 2, 1)

        self.autoButton = ExpandingButton()
        self.autoButton.setText("Auto Fade")
        self.autoButton.clicked.connect(self.takeAuto)

        layout.addWidget(self.autoButton, 2, 1, 2, 1)

        lblRate = QLabel("Rate:")
        lblRate.setAlignment(Qt.AlignHCenter | Qt.AlignBottom)
        layout.addWidget(lblRate, 2, 0)

        self.rate = FrameRateTouchSpinner()
        self.rate.setMinimum(1)
        self.rate.setMaximum(250)
        self.rate.setValue(25)
        self.rate.valueChanged.connect(self.setRate)
        layout.addWidget(self.rate, 3, 0)

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

        self.resetParams()
        self.update_from_dsk()

        self.setLayout(layout)

    def update_from_dsk(self):
        self.onAirButton.setChecked(self.dsk.onAir)
        self.onAirButton.setProperty("isLive", self.dsk.onAir)
        self.onAirButton.style().unpolish(self.onAirButton)
        self.onAirButton.style().polish(self.onAirButton)
        self.rate.setValue(self.dsk.rate)

    @with_atem
    def setOnAir(self):
        self.atem.setDSKOnAir(self.dsk.idx, self.onAirButton.isChecked())

    @with_atem
    def takeAuto(self):
        self.atem.performDSKAuto(self.dsk.idx)

    @with_atem
    def setRate(self, rate):
        self.atem.setDSKRate(self.dsk.idx, rate)

    @with_atem
    def resetParams(self):
        self.atem.setDSKFillSource(self.dsk.idx, VideoSource.INPUT_5)
        self.atem.setDSKKeySource(self.dsk.idx, VideoSource.INPUT_5)
        self.atem.setDSKParams(self.dsk.idx,
                               preMultiplied=False,
                               gain=500,
                               clip=210)
Exemplo n.º 23
0
class RecorderControl(ScreenWithBackButton):
    def __init__(self, hyperdeck, atem, state, mainWindow):
        self.hyperdeck = hyperdeck
        self.atem = atem
        self.state = state
        self.mainWindow = mainWindow
        super(RecorderControl, self).__init__("Recorder", mainWindow)
        self.state.transportChange.connect(self.updateState)
        if self.hyperdeck:
            self.updateState(state.transport)

    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 updateState(self, state):
        if 'status' in state:
            self.btnRecord.setChecked(state['status'] == TransportState.RECORD)
            self.btnPlay.setChecked(state['status'] == TransportState.PLAYING)
            self.btnStop.setChecked(state['status'] != TransportState.RECORD and state['status'] != TransportState.PLAYING)
        currentSlot = state.get('active slot', 1)
        self.btnGroupSDCard.button(currentSlot - 1).setChecked(True)

    def _setRecordMode(self, isRecordMode):
        if isRecordMode:
            self.btnSkipBack.setEnabled(False)
            self.btnSkipForward.setEnabled(False)
            self.btnPlay.setEnabled(False)
            self.btnPlay.setChecked(False)
            self.btnLoopPlay.setEnabled(False)
            self.btnRecord.setEnabled(True)
            self.hyperdeck.setTransportMode(TransportMode.RECORD)
        else:
            self.btnSkipBack.setEnabled(True)
            self.btnSkipForward.setEnabled(True)
            self.btnPlay.setEnabled(True)
            self.btnLoopPlay.setEnabled(True)
            self.btnRecord.setEnabled(False)
            self.btnRecord.setChecked(False)
            self.hyperdeck.setTransportMode(TransportMode.PLAYBACK)

    def _showClipSelection(self):
        self.hyperdeck.broadcastClipsList()
        self.mainWindow.showScreen(self.clipSelectionScreen)
Exemplo n.º 24
0
class TouchSpinner(QWidget):
    valueChanged = Signal(int)

    def __init__(self, parent=None):
        super(TouchSpinner, self).__init__(parent)
        self._value = 50
        self._max = 100
        self._min = 0

        layout = QHBoxLayout()

        self.btnMinus = ExpandingButton()
        self.btnMinus.setIcon(QIcon(":icons/list-remove"))
        self.btnMinus.setText("-")
        self.btnMinus.clicked.connect(lambda: self.setValue(self._value - 1))
        layout.addWidget(self.btnMinus, 1)

        self.lblValue = QLabel(self.formattedValue(self._value))
        self.lblValue.setAlignment(Qt.AlignHCenter)
        layout.addWidget(self.lblValue, 1)

        self.btnPlus = ExpandingButton()
        self.btnPlus.setIcon(QIcon(":icons/list-add"))
        self.btnPlus.setText("+")
        self.btnPlus.clicked.connect(lambda: self.setValue(self._value + 1))
        layout.addWidget(self.btnPlus, 1)

        self.setLayout(layout)

    def setValue(self, value):
        if value > self._max:
            newValue = self._max
        elif value < self._min:
            newValue = self._min
        else:
            newValue = value
        if value != self._value:
            self._value = newValue
            self.valueChanged.emit(newValue)
            self.lblValue.setText(self.formattedValue(newValue))

            self.btnPlus.setEnabled(self._value < self._max)
            self.btnMinus.setEnabled(self._value > self._min)

    def setMaximum(self, maxi):
        self._max = maxi

    def setMinimum(self, mini):
        self._min = mini

    def value(self):
        return self._value

    def formattedValue(self, value):
        return "{}".format(value)
Exemplo n.º 25
0
    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
Exemplo n.º 26
0
    def __init__(self, hyperdeck, state, mainWindow):
        super(RecorderClipSelectionScreen, self).__init__()
        self.hyperdeck = hyperdeck
        self.state = state
        self.mainWindow = mainWindow

        self.selected_clip = None

        layout = QGridLayout()

        lblTitle = TitleLabel("Select clip")
        layout.addWidget(lblTitle, 0, 0, 1, 3)

        self.clipTable = QTableWidget()
        self.clipTable.setColumnCount(2)
        self.clipTable.setHorizontalHeaderLabels(['ID', 'Clip name'])
        self.clipTable.horizontalHeader().setStretchLastSection(True)
        self.clipTable.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)

        self.clipTable.itemSelectionChanged.connect(self._onClipSelected)

        layout.addWidget(self.clipTable, 1, 0, 1, 3)

        b = ExpandingButton()
        b.setText("Back")
        b.setIcon(QIcon(":icons/go-previous"))
        b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        b.clicked.connect(mainWindow.stepBack)
        layout.addWidget(b, 2, 0)

        btnRefresh = ExpandingButton()
        btnRefresh.setText('Refresh')
        btnRefresh.setIcon(QIcon(':icons/refresh'))
        btnRefresh.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)

        def refresh():
            self.populateClipsList({})
            hyperdeck.broadcastClipsList()

        btnRefresh.clicked.connect(refresh)

        layout.addWidget(btnRefresh, 2, 1)

        self.btnSelect = ExpandingButton()
        self.btnSelect.setText("Cue clip")
        self.btnSelect.clicked.connect(self._cueClip)
        layout.addWidget(self.btnSelect, 2, 2)

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

        self.setLayout(layout)

        self.populateClipsList(state.clip_listing)
Exemplo n.º 27
0
    def __init__(self, controller):
        super(MainWindow, self).__init__()
        self.controller = controller

        self.setWindowTitle("av-control")
        self.resize(1024, 600)
        self.setWindowIcon(QIcon(":icons/video-display"))

        self.mainScreen = VideoSwitcher(controller, self)
        self.stack = QStackedWidget()
        self.stack.addWidget(self.mainScreen)

        outer = QWidget()
        mainLayout = QGridLayout()
        mainLayout.addWidget(self.stack, 0, 0, 1, 7)

        column = 0

        self.spc = SystemPowerWidget(controller, self)

        syspower = ExpandingButton()
        syspower.setText("Power")
        syspower.clicked.connect(self.showSystemPower)
        syspower.setIcon(QIcon(":icons/system-shutdown"))
        syspower.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        mainLayout.addWidget(syspower, 1, column)
        column += 1

        self.bc = BlindsControl(controller["Blinds"], self)

        blinds = ExpandingButton()
        blinds.setText("Blinds")
        blinds.clicked.connect(lambda: self.showScreen(self.bc))
        blinds.setIcon(QIcon(":icons/blinds"))
        blinds.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        mainLayout.addWidget(blinds, 1, column)
        column += 1

        self.sc = ProjectorScreensControl(controller["Screens"], self)

        screens = ExpandingButton()
        screens.setText("Screens")
        screens.clicked.connect(lambda: self.showScreen(self.sc))
        screens.setIcon(QIcon(":icons/screens"))
        screens.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        mainLayout.addWidget(screens, 1, column)
        column += 1

        if controller.hasDevice("Lights"):
            self.lightsMenu = LightingControl(controller["Lights"], self)

            lights = ExpandingButton()
            lights.setText("Lights")
            lights.clicked.connect(lambda: self.showScreen(self.lightsMenu))
            lights.setIcon(QIcon(":icons/lightbulb_on"))
            lights.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
            mainLayout.addWidget(lights, 1, column)
            column += 1

        self.advMenu = AdvancedMenu(self.controller, self)

        adv = ExpandingButton()
        adv.setText("Advanced")
        adv.setIcon(QIcon(":icons/applications-system"))
        adv.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        adv.clicked.connect(lambda: self.showScreen(self.advMenu))
        mainLayout.addWidget(adv, 1, column)
        column += 1

        for i in range(column):
            mainLayout.setColumnStretch(i, 1)

        tray = QHBoxLayout()
        tray.addWidget(Clock())
        tray.addWidget(SystemStatus(controller))
        mainLayout.addLayout(tray, 1, column)

        mainLayout.setRowStretch(0, 8)
        mainLayout.setRowStretch(1, 0)

        outer.setLayout(mainLayout)

        self.setCentralWidget(outer)

        self.pnd = PowerNotificationDialog(self)
        self.pnd.accepted.connect(self.hidePowerDialog)
Exemplo n.º 28
0
    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
Exemplo n.º 29
0
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())
Exemplo n.º 30
0
class RecorderControl(ScreenWithBackButton):
    def __init__(self, hyperdeck, atem, state, mainWindow):
        self.hyperdeck = hyperdeck
        self.atem = atem
        self.state = state
        self.mainWindow = mainWindow
        super(RecorderControl, self).__init__("Recorder", mainWindow)
        self.state.transportChange.connect(self.updateState)
        if self.hyperdeck:
            self.updateState(state.transport)

    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 updateState(self, state):
        if 'status' in state:
            self.btnRecord.setChecked(state['status'] == TransportState.RECORD)
            self.btnPlay.setChecked(state['status'] == TransportState.PLAYING)
            self.btnStop.setChecked(
                state['status'] != TransportState.RECORD
                and state['status'] != TransportState.PLAYING)
        currentSlot = state.get('active slot', 1)
        self.btnGroupSDCard.button(currentSlot - 1).setChecked(True)

    def _setRecordMode(self, isRecordMode):
        if isRecordMode:
            self.btnSkipBack.setEnabled(False)
            self.btnSkipForward.setEnabled(False)
            self.btnPlay.setEnabled(False)
            self.btnPlay.setChecked(False)
            self.btnLoopPlay.setEnabled(False)
            self.btnRecord.setEnabled(True)
            self.hyperdeck.setTransportMode(TransportMode.RECORD)
        else:
            self.btnSkipBack.setEnabled(True)
            self.btnSkipForward.setEnabled(True)
            self.btnPlay.setEnabled(True)
            self.btnLoopPlay.setEnabled(True)
            self.btnRecord.setEnabled(False)
            self.btnRecord.setChecked(False)
            self.hyperdeck.setTransportMode(TransportMode.PLAYBACK)

    def _showClipSelection(self):
        self.hyperdeck.broadcastClipsList()
        self.mainWindow.showScreen(self.clipSelectionScreen)
Exemplo n.º 31
0
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())
Exemplo n.º 32
0
class RecorderClipSelectionScreen(QWidget):
    def __init__(self, hyperdeck, state, mainWindow):
        super(RecorderClipSelectionScreen, self).__init__()
        self.hyperdeck = hyperdeck
        self.state = state
        self.mainWindow = mainWindow

        self.selected_clip = None

        layout = QGridLayout()

        lblTitle = TitleLabel("Select clip")
        layout.addWidget(lblTitle, 0, 0, 1, 3)

        self.clipTable = QTableWidget()
        self.clipTable.setColumnCount(2)
        self.clipTable.setHorizontalHeaderLabels(['ID', 'Clip name'])
        self.clipTable.horizontalHeader().setStretchLastSection(True)
        self.clipTable.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)

        self.clipTable.itemSelectionChanged.connect(self._onClipSelected)

        layout.addWidget(self.clipTable, 1, 0, 1, 3)

        b = ExpandingButton()
        b.setText("Back")
        b.setIcon(QIcon(":icons/go-previous"))
        b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        b.clicked.connect(mainWindow.stepBack)
        layout.addWidget(b, 2, 0)

        btnRefresh = ExpandingButton()
        btnRefresh.setText('Refresh')
        btnRefresh.setIcon(QIcon(':icons/refresh'))
        btnRefresh.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)

        def refresh():
            self.populateClipsList({})
            hyperdeck.broadcastClipsList()

        btnRefresh.clicked.connect(refresh)

        layout.addWidget(btnRefresh, 2, 1)

        self.btnSelect = ExpandingButton()
        self.btnSelect.setText("Cue clip")
        self.btnSelect.clicked.connect(self._cueClip)
        layout.addWidget(self.btnSelect, 2, 2)

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

        self.setLayout(layout)

        self.populateClipsList(state.clip_listing)

    def populateClipsList(self, clipsList):
        self.selected_clip = None
        self.btnSelect.setEnabled(False)
        self.clipTable.clearContents()
        self.clipTable.setRowCount(len(clipsList))
        for idx, (clip_id, val) in enumerate(clipsList.iteritems()):
            self.clipTable.setItem(idx, 0, QTableWidgetItem(str(clip_id)))
            self.clipTable.setItem(idx, 1, QTableWidgetItem(val['name']))

    def _updateClipSelectionFromState(self, state):
        if 'clip id' in state:
            clip_id = state['clip id']
            for row in range(self.clipTable.rowCount()):
                this_id = self.clipTable.item(row, 0)
                if this_id.text() == str(clip_id):
                    self.clipTable.selectRow(row)
                    break

    def _onClipSelected(self):
        selected_items = self.clipTable.selectedItems()
        if selected_items:
            self.selected_clip = int(selected_items[0].text())
            self.btnSelect.setEnabled(True)
        else:
            self.btnSelect.setEnabled(False)

    def _cueClip(self):
        if self.selected_clip:
            self.mainWindow.stepBack()
            self.hyperdeck.gotoClip(self.selected_clip)