Ejemplo n.º 1
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
Ejemplo n.º 2
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
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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)
Ejemplo n.º 8
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)
Ejemplo n.º 9
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)