Example #1
0
    def __init__(self):
        QFrame.__init__(self)
        layout = QGridLayout()

        self.btnMonitor1 = OutputButton(ID=2)
        self.btnMonitor1.setText("Monitor 1")
        layout.addWidget(self.btnMonitor1, 0, 1)

        self.btnChurch = OutputButton(ID=4)
        self.btnChurch.setText("Church")
        layout.addWidget(self.btnChurch, 1, 0)
        self.btnSpecial = OutputButton(ID=7)
        self.btnSpecial.setText("Stage")
        layout.addWidget(self.btnSpecial, 1, 1)

        self.btnGallery = OutputButton(ID=6)
        self.btnGallery.setText("Gallery")
        layout.addWidget(self.btnGallery, 2, 0)
        self.btnWelcome = OutputButton(ID=5)
        self.btnWelcome.setText("Welcome")
        layout.addWidget(self.btnWelcome, 2, 1)

        self.btnFont = OutputButton(ID=3)
        self.btnFont.setText("Font")
        layout.addWidget(self.btnFont, 3, 0)
        self.btnRecord = OutputButton(ID=8)
        self.btnRecord.setText("Record")
        layout.addWidget(self.btnRecord, 3, 1)

        self.btnPCMix = OutputButton(ID=2)
        self.btnPCMix.setText("PC Mix")
        layout.addWidget(self.btnPCMix, 4, 0)
        self.btnAll = IDedButton(ID=0)
        self.btnAll.setText("All")
        layout.addWidget(self.btnAll, 4, 1)

        self.outputButtons = {
            2: self.btnMonitor1,
            3: self.btnFont,
            4: self.btnChurch,
            5: self.btnWelcome,
            6: self.btnGallery,
            7: self.btnSpecial,
            8: self.btnRecord,
        }

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

        self.setLayout(layout)
Example #2
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)
Example #3
0
    def testOutputButton(self):
        some_input = Input(VideoSource.INPUT_1, "My input", None)
        main_mix = Input(VideoSource.ME_1_PROGRAM, "Main mix", None)

        my_output = Output("Some Output", VideoSource.AUX_1)

        ob = OutputButton(my_output)
        ob_state = ob.stateDisplay

        self.assertEqual('-', ob_state.text())
        self.assertFalse(ob_state.property("highlight"))

        my_output.set_source(some_input)
        self.assertEqual('My input', ob_state.text())
        self.assertTrue(ob_state.property("highlight"))

        my_output.set_source(main_mix)
        self.assertEqual('Main mix', ob_state.text())
        self.assertFalse(ob_state.property("highlight"))
Example #4
0
class OutputsGrid(QFrame):
    """
    Grid of output buttons.
    """

    inputNames = {0: "Blank", 1: "Camera 1", 2: "Camera 2", 3: "Camera 3", 4: "DVD", 5: "Extras", 6: "Visuals PC"}

    def __init__(self):
        QFrame.__init__(self)
        layout = QGridLayout()

        self.btnMonitor1 = OutputButton(ID=2)
        self.btnMonitor1.setText("Monitor 1")
        layout.addWidget(self.btnMonitor1, 0, 1)

        self.btnChurch = OutputButton(ID=4)
        self.btnChurch.setText("Church")
        layout.addWidget(self.btnChurch, 1, 0)
        self.btnSpecial = OutputButton(ID=7)
        self.btnSpecial.setText("Stage")
        layout.addWidget(self.btnSpecial, 1, 1)

        self.btnGallery = OutputButton(ID=6)
        self.btnGallery.setText("Gallery")
        layout.addWidget(self.btnGallery, 2, 0)
        self.btnWelcome = OutputButton(ID=5)
        self.btnWelcome.setText("Welcome")
        layout.addWidget(self.btnWelcome, 2, 1)

        self.btnFont = OutputButton(ID=3)
        self.btnFont.setText("Font")
        layout.addWidget(self.btnFont, 3, 0)
        self.btnRecord = OutputButton(ID=8)
        self.btnRecord.setText("Record")
        layout.addWidget(self.btnRecord, 3, 1)

        self.btnPCMix = OutputButton(ID=2)
        self.btnPCMix.setText("PC Mix")
        layout.addWidget(self.btnPCMix, 4, 0)
        self.btnAll = IDedButton(ID=0)
        self.btnAll.setText("All")
        layout.addWidget(self.btnAll, 4, 1)

        self.outputButtons = {
            2: self.btnMonitor1,
            3: self.btnFont,
            4: self.btnChurch,
            5: self.btnWelcome,
            6: self.btnGallery,
            7: self.btnSpecial,
            8: self.btnRecord,
        }

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

        self.setLayout(layout)

    def connectMainOutputs(self, function):
        self.btnMonitor1.clicked.connect(function)
        self.btnChurch.clicked.connect(function)
        self.btnSpecial.clicked.connect(function)
        self.btnGallery.clicked.connect(function)
        self.btnWelcome.clicked.connect(function)
        self.btnFont.clicked.connect(function)
        self.btnRecord.clicked.connect(function)
        self.btnAll.clicked.connect(function)

    def connectPreviewOutputs(self, function):
        self.btnPCMix.clicked.connect(function)

    def updateOutputMappings(self, mapping):
        if "Main" in mapping:
            for outp, inp in mapping["Main"].iteritems():
                if outp in self.outputButtons.keys():
                    self.outputButtons[outp].setInputText(self.inputNames[inp])
                elif outp == 0:
                    for button in self.outputButtons.values():
                        button.setInputText(self.inputNames[inp])
        if "Preview" in mapping:
            if 2 in mapping["Preview"]:
                inp = mapping["Preview"][2]
                if inp == 6:  # HACK HACK HACK because of crossed wiring in church
                    inp = 5
                self.btnPCMix.setInputText(self.inputNames[inp])