Example #1
0
 def __init__(self, stepper):
     QWidget.__init__(self)
     button_layout = QGridLayout()
     self.setLayout(button_layout)
     button_layout.setColumnStretch(0, 0)
     button_layout.setColumnStretch(1, 0)
     button_layout.setColumnStretch(3, 0)
     button_layout.setRowStretch(0, 0)
     button_layout.setRowStretch(1, 0)
     button_layout.setRowStretch(3, 0)
     button_layout.setRowStretch(4, 0)
     qmy_button(button_layout, stepper.go_to_previous_turn, "pre", the_row=0, the_col=0)
     qmy_button(button_layout, stepper.go_to_next_turn, "next", the_row=0, the_col=1)
     qmy_button(button_layout, stepper.insert_before, "ins before", the_row=1, the_col=0)
     qmy_button(button_layout, stepper.insert_after, "ins after", the_row=1, the_col=1)
     qmy_button(button_layout, stepper.delete_current_turn, "delete turn", the_row=1, the_col=2)
     qmy_button(button_layout, stepper.commit, "commit", the_row=2, the_col=0)
     qmy_button(button_layout, stepper.commit_all, "commit all", the_row=2, the_col=1)
     qmy_button(button_layout, stepper.revert_current_and_redisplay, "revert", the_row=2, the_col=2)
     qmy_button(button_layout, stepper.save_file, "save", the_row=3, the_col=0)
     qmy_button(button_layout, stepper.save_file_as, "save as ...", the_row=3, the_col=1)
     qmy_button(button_layout, stepper.fill_time_code, "fill time", the_row=4, the_col=0)
     qmy_button(button_layout, stepper.sync_video, "sync video", the_row=4, the_col=1)
     button_layout.addWidget(QWidget(), 2, 3)
     button_layout.addWidget(QWidget(), 5, 0)
Example #2
0
    def realize(self):
        """This function is part of initialization where it handles
           ModuleAgent creation and wiring and subclass view placement.
        """
        # Create and wire the Agent into the Boxfish tree
        self.agent = self.agent_type(self.parent_frame.agent, self.parent_frame.agent.datatree)
        self.agent.module_scene = self.scene_type(self.agent_type, self.display_name)
        self.parent_frame.agent.registerChild(self.agent)

        # Create and place the module-specific view elements
        self.view = self.createView()
        self.centralWidget = QWidget()

        layout = QGridLayout()
        if isinstance(self.parent(), BFDockWidget):
            layout.addWidget(DragDockLabel(self.parent()), 0, 0, 1, 2)

        # TODO: Replace magic number with not-magic constant
        layout.addWidget(self.view, 100, 0, 1, 2)  # Add view at bottom
        layout.setRowStretch(100, 5)  # view has most row stretch

        left, top, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(0, 0, 0, 0)
        self.centralWidget.setLayout(layout)

        self.setCentralWidget(self.centralWidget)

        # Tab Dialog stuff
        self.enable_tab_dialog = True
        self.dialog = list()
    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)
Example #4
0
    def realize(self):
        """This function is part of initialization where it handles
           ModuleAgent creation and wiring and subclass view placement.
        """
        # Create and wire the Agent into the Boxfish tree
        self.agent = self.agent_type(self.parent_frame.agent,
                                     self.parent_frame.agent.datatree)
        self.agent.module_scene = self.scene_type(self.agent_type,
                                                  self.display_name)
        self.parent_frame.agent.registerChild(self.agent)

        # Create and place the module-specific view elements
        self.view = self.createView()
        self.centralWidget = QWidget()

        layout = QGridLayout()
        if isinstance(self.parent(), BFDockWidget):
            layout.addWidget(DragDockLabel(self.parent()), 0, 0, 1, 2)

        # TODO: Replace magic number with not-magic constant
        layout.addWidget(self.view, 100, 0, 1, 2)  # Add view at bottom
        layout.setRowStretch(100, 5)  # view has most row stretch

        left, top, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(0, 0, 0, 0)
        self.centralWidget.setLayout(layout)

        self.setCentralWidget(self.centralWidget)

        # Tab Dialog stuff
        self.enable_tab_dialog = True
        self.dialog = list()
    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)
Example #6
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)
    def initLayout(self):

        layout = QGridLayout()
        self.setLayout(layout)

        layout.addWidget(self.upButton, 0, 0)
        layout.addWidget(self.caption, 1, 0)
        layout.addWidget(self.downButton, 2, 0)

        layout.setRowStretch(0, 2)
        layout.setRowStretch(1, 2)
        layout.setRowStretch(2, 2)
Example #8
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)
    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 __init__(self, parent=None):
        QWidget.__init__(self, parent)

        # Widgets, layouts and signals
        self._group = QButtonGroup()

        layout = QGridLayout()
        layout.setSpacing(0)

        for i in range(18):
            layout.setColumnMinimumWidth(i, 40)
            layout.setColumnStretch(i, 0)
        for i in list(range(7)) + [8, 9]:
            layout.setRowMinimumHeight(i, 40)
            layout.setRowStretch(i, 0)

        ## Element
        for z, position in _ELEMENT_POSITIONS.items():
            widget = ElementPushButton(z)
            widget.setCheckable(True)
            layout.addWidget(widget, *position)
            self._group.addButton(widget, z)

        ## Labels
        layout.addWidget(QLabel(''), 7, 0) # Dummy
        layout.addWidget(QLabel('*'), 5, 2, Qt.AlignCenter)
        layout.addWidget(QLabel('*'), 8, 2, Qt.AlignCenter)
        layout.addWidget(QLabel('**'), 6, 2, Qt.AlignCenter)
        layout.addWidget(QLabel('**'), 9, 2, Qt.AlignCenter)

        for row in [0, 1, 2, 3, 4, 5, 6, 8, 9]:
            layout.setRowStretch(row, 1)

        self.setLayout(layout)

        # Signals
        self._group.buttonClicked.connect(self.selectionChanged)

        # Default
        self.setColorFunction(_category_color_function)
Example #11
0
    def __init__(self):
        super(window, self).__init__()

        self.resize(1024,720)
        self.centralWidget = QWidget(self)
        self.setWindowTitle('Plotting Points (Google Maps)')
        
        self.layout = QHBoxLayout(self.centralWidget)
        
        self.frame = QFrame(self.centralWidget)
        self.frameLayout = QVBoxLayout(self.frame)
        
        self.web = QtWebKit.QWebView()
        
        group_left = QGroupBox('Data Preparation')
        groupLeft_layout = QGridLayout()
        
        self.openButton = QPushButton("Open file")
        self.openButton.clicked.connect(self.openfile)
        
        self.optUTM = QCheckBox('UTM Data')
        
        
        groupLeft_layout.addWidget(self.optUTM,0,0)
        groupLeft_layout.addWidget(self.openButton,1,0)
        
        groupLeft_layout.setRowStretch(2,1)
        group_left.setLayout(groupLeft_layout)
        
        self.frameLayout.addWidget(self.web)
        self.layout.addWidget(group_left)
        self.layout.addWidget(self.frame)
        self.layout.setStretch(1,1)
        self.setCentralWidget(self.centralWidget)
        
        url = 'http://maps.google.com'
        
        self.showMap(url)   
Example #12
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)
Example #13
0
    def createDragOverlay(self, tags, texts, images=None):
        """Creates a DragOverlay for this ModuleFrame with the given
           text and optional images. When DataIndexMimes (DataTree indices)
           are dropped on the text/images of this overlay, they are
           associated with the tag of the same index of the text/image.

           This is a user interface for when a ModuleFrame wants to
           accept drops for multiple purposes.
        """
        self.dragOverlay = True

        self.overlay = OverlayFrame(self)

        layout = QGridLayout(self.overlay)
        layout.setAlignment(Qt.AlignCenter)
        layout.setColumnStretch(0, 5)
        if images is not None:
            for i, tag, text, image in zip(range(len(tags)), tags, texts,
                                           images):
                layout.addWidget(
                    DropPanel(tag, text, self.overlay, self.overlayDroppedData,
                              image), i, 0, 1, 1)
                layout.setRowStretch(i, 5)
        else:
            for i, tag, text in zip(range(len(tags)), tags, texts):
                layout.addWidget(
                    DropPanel(tag, text, self.overlay,
                              self.overlayDroppedData), i, 0, 1, 1)
                layout.setRowStretch(i, 5)

        # Add a Close button to deal with lack of cancel signal
        # for drag/drop
        class CloseLabel(QLabel):

            closeSignal = Signal()

            def __init__(self):
                super(CloseLabel, self).__init__("Close")

                self.setStyleSheet("QLabel { color : white; }")

            def mousePressEvent(self, e):
                self.closeSignal.emit()

        closeButton = CloseLabel()
        closeButton.closeSignal.connect(self.killRogueOverlays)
        layout.addWidget(closeButton, len(tags), 0, 1, 1)
        layout.setRowStretch(len(tags), 0)

        self.overlay.setLayout(layout)
Example #14
0
    def createDragOverlay(self, tags, texts, images=None):
        """Creates a DragOverlay for this ModuleFrame with the given
           text and optional images. When DataIndexMimes (DataTree indices)
           are dropped on the text/images of this overlay, they are
           associated with the tag of the same index of the text/image.

           This is a user interface for when a ModuleFrame wants to
           accept drops for multiple purposes.
        """
        self.dragOverlay = True

        self.overlay = OverlayFrame(self)

        layout = QGridLayout(self.overlay)
        layout.setAlignment(Qt.AlignCenter)
        layout.setColumnStretch(0, 5)
        if images is not None:
            for i, tag, text, image in zip(range(len(tags)), tags, texts, images):
                layout.addWidget(DropPanel(tag, text, self.overlay, self.overlayDroppedData, image), i, 0, 1, 1)
                layout.setRowStretch(i, 5)
        else:
            for i, tag, text in zip(range(len(tags)), tags, texts):
                layout.addWidget(DropPanel(tag, text, self.overlay, self.overlayDroppedData), i, 0, 1, 1)
                layout.setRowStretch(i, 5)

        # Add a Close button to deal with lack of cancel signal
        # for drag/drop
        class CloseLabel(QLabel):

            closeSignal = Signal()

            def __init__(self):
                super(CloseLabel, self).__init__("Close")

                self.setStyleSheet("QLabel { color : white; }")

            def mousePressEvent(self, e):
                self.closeSignal.emit()

        closeButton = CloseLabel()
        closeButton.closeSignal.connect(self.killRogueOverlays)
        layout.addWidget(closeButton, len(tags), 0, 1, 1)
        layout.setRowStretch(len(tags), 0)

        self.overlay.setLayout(layout)
    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
Example #17
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)
Example #18
0
    def setupUi(self):
        layout = QGridLayout()

        inputs_grid = QHBoxLayout()
        self.inputs = QButtonGroup()

        def ifDevice(deviceID, func):
            if self.controller.hasDevice(deviceID):
                return func()
            return (None, None, None, None)

        def setCamera(cam, cc):
            if self.joystickAdapter:
                self.joystickAdapter.set_camera(cam)
                self.joystickAdapter.set_on_move(cc.deselectPreset)

        def makeCamera(videoSource, cameraID):
            cam = self.controller[cameraID]
            cc = CameraControl(cam)

            return (
                videoSource,
                cc,
                AdvancedCameraControl(cameraID, cam, self.mainWindow),
                lambda: setCamera(cam, cc)
            )

        def deselectCamera():
            if self.joystickAdapter:
                self.joystickAdapter.set_camera(None)
                self.joystickAdapter.set_on_move(None)

        self.input_buttons_config = [
            ifDevice("Camera 1", lambda: makeCamera(VideoSource.INPUT_1, "Camera 1")),
            ifDevice("Camera 2", lambda: makeCamera(VideoSource.INPUT_2, "Camera 2")),
            ifDevice("Camera 3", lambda: makeCamera(VideoSource.INPUT_3, "Camera 3")),
            (VideoSource.INPUT_4, QLabel(StringConstants.noDevice), None, deselectCamera),
            (VideoSource.INPUT_5, OverlayControl(self.switcherState.dsks[0], self.atem), None, deselectCamera),
            (VideoSource.INPUT_6, QLabel(StringConstants.noDevice), None, deselectCamera)
        ]

        for source, panel, adv_panel, on_select_func in self.input_buttons_config:
            if source:
                btn = InputButton(self.switcherState.inputs[source])
                btn.setProperty("panel", panel)
                btn.setProperty("adv_panel", adv_panel)
                btn.clicked.connect(self.preview)
                btn.clicked.connect(self.displayPanel)
                if on_select_func:
                    btn.clicked.connect(on_select_func)
                btn.longpress.connect(self.displayAdvPanel)
                self.inputs.addButton(btn)
                inputs_grid.addWidget(btn)

        self.extrasBtn = InputButton(None)
        self.inputs.addButton(self.extrasBtn)
        self.extrasBtn.clicked.connect(self.preview)
        self.extrasBtn.clicked.connect(self.displayPanel)
        self.extrasBtn.clicked.connect(deselectCamera)

        # An empty menu means the button will be given a "down arrow" icon
        # without actually showing a menu when pressed.
        self.extrasBtn.setMenu(QMenu())

        self.allInputs = AllInputsPanel(self.switcherState)
        self.extrasBtn.setProperty("panel", self.allInputs)

        self.allInputs.inputSelected.connect(self.setExtraInput)

        inputs_grid.addWidget(self.extrasBtn)

        self.blackBtn = FlashingInputButton(self.switcherState.inputs[VideoSource.BLACK])
        inputs_grid.addWidget(self.blackBtn)
        self.inputs.addButton(self.blackBtn)
        self.blackBtn.clicked.connect(self.preview)
        self.blackBtn.clicked.connect(self.displayPanel)
        self.blackBtn.clicked.connect(deselectCamera)
        self.ftb = FadeToBlackControl(self.switcherState.ftb, self.atem)
        self.blackBtn.setProperty("panel", self.ftb)
        self.blackBtn.flashing = self.switcherState.ftb.active
        self.switcherState.ftb.activeChanged.connect(self.blackBtn.setFlashing)

        layout.addLayout(inputs_grid, 0, 0, 1, 7)

        self.og = OutputsGrid(self.switcherState)

        self.og.take.connect(self.take)
        self.og.cut.connect(self.cut)
        self.og.selected.connect(self.sendToAux)
        self.og.mainToAll.connect(self.sendMainToAllAuxes)
        self.og.all.connect(self.sendToAll)
        self.og.sendMain.connect(self.sendMainToAux)

        self.og.setAuxesEnabled(False)  # since we start off without an input selected

        layout.addWidget(self.og, 1, 5, 1, 2)

        self.blankWidget = QWidget()
        layout.addWidget(self.blankWidget, 1, 0, 1, 5)

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

        self.setLayout(layout)
Example #19
0
    def __init__(self, controller):
        super(MainWindow, self).__init__()
        self.controller = controller

        self.setWindowTitle("AldatesX")
        self.resize(1024, 600)

        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)

        self.spc = SystemPowerWidget(controller, self)

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

        self.bc = BlindsControl(controller, self)

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

        self.sc = ProjectorScreensControl(self.controller, self)

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

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

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

        mainLayout.addWidget(Clock(), 1, 6)

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

        outer.setLayout(mainLayout)

        self.setCentralWidget(outer)

        self.pnd = PowerNotificationDialog(self)
        self.pnd.accepted.connect(self.hidePowerDialog)
    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)
Example #21
0
    def setupUi(self):

        gridlayout = QGridLayout()
        self.setLayout(gridlayout)

        ''' Buttons added to inputs should have a numeric ID set equal to their input number on the Aldates main switcher. '''
        self.inputs = QButtonGroup()

        inputsGrid = QHBoxLayout()

        self.btnCamera1 = CameraSelectionButton(1)
        self.btnCamera1.setText("Camera 1")
        self.btnCamera1.setInput(VisualsSystem.camera1)
        inputsGrid.addWidget(self.btnCamera1)
        self.inputs.addButton(self.btnCamera1, 1)
        self.btnCamera1.setIcon(QIcon(":icons/camera-video"))

        self.btnCamera2 = CameraSelectionButton(2)
        self.btnCamera2.setText("Camera 2")
        self.btnCamera2.setInput(VisualsSystem.camera2)
        inputsGrid.addWidget(self.btnCamera2)
        self.inputs.addButton(self.btnCamera2, 2)
        self.btnCamera2.setIcon(QIcon(":icons/camera-video"))

        self.btnCamera3 = CameraSelectionButton(3)
        self.btnCamera3.setText("Camera 3")
        self.btnCamera3.setInput(VisualsSystem.camera3)
        inputsGrid.addWidget(self.btnCamera3)
        self.inputs.addButton(self.btnCamera3, 3)
        self.btnCamera3.setIcon(QIcon(":icons/camera-video"))

        self.btnDVD = InputButton()
        self.btnDVD.setText("DVD")
        self.btnDVD.setInput(VisualsSystem.dvd)
        inputsGrid.addWidget(self.btnDVD)
        self.inputs.addButton(self.btnDVD, 4)
        self.btnDVD.setIcon(QIcon(":icons/media-optical"))

        self.btnExtras = InputButton()
        self.btnExtras.setText("Extras")
        inputsGrid.addWidget(self.btnExtras)
        self.btnExtras.setIcon(QIcon(":icons/video-display"))
        self.inputs.addButton(self.btnExtras, 5)

        self.btnVisualsPC = InputButton()
        self.btnVisualsPC.setText("Visuals PC")
        self.btnVisualsPC.setInput(VisualsSystem.visualsPC)
        inputsGrid.addWidget(self.btnVisualsPC)
        self.inputs.addButton(self.btnVisualsPC, 6)
        self.btnVisualsPC.setIcon(QIcon(":icons/computer"))

        self.btnBlank = InputButton()
        self.btnBlank.setText("Blank")
        self.btnBlank.setInput(VisualsSystem.blank)
        inputsGrid.addWidget(self.btnBlank)
        self.inputs.addButton(self.btnBlank, 0)

        gridlayout.addLayout(inputsGrid, 0, 0, 1, 7)

        self.extrasSwitcher = ExtrasSwitcher(self.controller)
        self.extrasSwitcher.inputSelected.connect(self.handleExtrasSelect)
        self.btnExtras.setInput(ProxyInput(self.extrasSwitcher))
        self.blank = QWidget(self)
        gridlayout.addWidget(self.blank, 1, 0, 1, 5)

        self.outputsGrid = OutputsGrid()

        gridlayout.addWidget(self.outputsGrid, 1, 5, 1, 2)

        gridlayout.setRowStretch(0, 1)
        gridlayout.setRowStretch(1, 5)
        QMetaObject.connectSlotsByName(self)
        self.setInputClickHandlers()
        self.setOutputClickHandlers(self.outputsGrid)
        self.configureInnerControlPanels()
        self.gridlayout = gridlayout
Example #22
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)
Example #23
0
  def initUI(self):
    '''
    Method to setup the buttons/entries of the Gui
    '''
    self.dateFrame    = dateFrame( );                                           # Initialize the dateFrame
    self.iopLabel     = QLabel('IOP Number');                                   # Initialize Entry widget for the IOP name
    self.iopName      = QLineEdit();                                            # Initialize Entry widget for the IOP name
    self.stationLabel = QLabel('Station Name');                                 # Initialize Entry widget for the IOP name
    self.stationName  = QLineEdit();                                            # Initialize Entry widget for the IOP name
    self.sourceButton = QPushButton('Source Directory');                        # Initialize button for selecting the source directory
    self.destButton   = QPushButton('Destination Directory');                   # Initialize button for selecting the destination directory
    self.sourcePath   = QLineEdit('');                                          # Initialize entry widget that will display the source directory path
    self.destPath     = QLineEdit('');                                          # Initialize entry widget that will display the destination directory path
    self.sourceSet    = indicator();                                            # Initialize an indictor that will appear when the source path is set
    self.destSet      = indicator();                                            # Initialize an indictor that will appear when the destination path is set
    
    self.sourcePath.setEnabled( False );                                        # Disable the sourcePath widget; that way no one can manually edit it
    self.destPath.setEnabled(   False );                                        # Disable the destPath widget; that way no one can manually edit it

    self.sourcePath.hide();                                                     # Hide the source directory path
    self.destPath.hide();                                                       # Hide the destination directory path
    self.sourceSet.hide();                                                      # Hide the source directory indicator
    self.destSet.hide();                                                        # Hide the destination directory indicator

    self.sourceButton.clicked.connect( self.select_source );                    # Set method to run when the source button is clicked 
    self.destButton.clicked.connect(   self.select_dest   );                    # Set method to run when the destination button is clicked

    self.copyButton = QPushButton( 'Copy Files' );                              # Create 'Copy Files' button
    self.copyButton.clicked.connect( self.copy_files );                         # Set method to run when 'Copy Files' button is clicked
    self.copyButton.setEnabled(False);                                          # Set enabled state to False; cannot click until after the source and destination directories set
    self.copySucces = indicator();                                              # Initialize an indictor that will appear when the copy complete successfuly
    self.copySucces.hide();

    self.procButton = QPushButton( 'Process Files' );                           # Create 'Process Files' button
    self.procButton.clicked.connect( self.proc_files );                         # Set method to run when 'Process Files' button is clicked
    self.procButton.setEnabled(False);                                          # Set enabled state to False; cannot click until after 'Copy Files' completes
    self.procSucces = indicator();                                              # Initialize an indictor that will appear when the processing complete successfuly
    self.procSucces.hide();

    self.genButton = QPushButton( 'Generate Sounding' );                        # Create 'Generate Sounding' button
    self.genButton.clicked.connect( self.gen_sounding );                        # Set method to run when 'Generate Sounding' button is clicked
    self.genButton.setEnabled(False);                                           # Set enabled state to False; cannot click until after 'Process Files' completes
    self.genSucces = indicator();                                               # Initialize an indictor that will appear when the sounding generation complete successfuly
    self.genSucces.hide();

    self.uploadButton = QPushButton( 'FTP Upload' );                            # Create 'FTP Upload' button
    self.uploadButton.clicked.connect( self.ftp_upload );                       # Set method to run when 'FTP Upload' button is clicked
    self.uploadButton.setEnabled(False);                                        # Set enabled state to False; cannot click until after 'Generate Sounding' completes
    self.uploadSucces = indicator();                                            # Initialize an indictor that will appear when the ftp upload complete successfuly
    self.uploadSucces.hide();

    self.checkButton = QPushButton( 'Check website' );                          # Create 'Check website' button
    self.checkButton.clicked.connect( self.check_site );                        # Set method to run when 'Check website' button is clicked
    self.checkButton.setEnabled(False);                                         # Set enabled state to False; cannot click until after 'FTP Upload' completes

    self.resetButton = QPushButton( 'Reset' );                                  # Create 'Check website' button
    self.resetButton.clicked.connect( self.reset_values );                      # Set method to run when 'Check website' button is clicked
    
    versionLabel = QLabel( 'version: {}'.format(__version__) );                 # Version label
    versionLabel.setAlignment( Qt.AlignHCenter );                               # Set alignment to center
    log_handler  = QLogger( );                                                  # Initialize a QLogger logging.Handler object
    logging.getLogger('Meso1819').addHandler( log_handler );                    # Get the Meso1819 root logger and add the handler to it

    grid = QGridLayout();                                                       # Initialize grid layout
    grid.setSpacing(10);                                                        # Set spacing to 10
    for i in range(4): 
      grid.setColumnStretch(i,  0);                                             # Set column stretch for ith column
      grid.setColumnMinimumWidth(i,  60);                                       # Set column min width for ith column
    grid.setColumnStretch(4,  0);                                               # Set column stretch for 5th column
    grid.setColumnMinimumWidth(4,  20);                                         # Set column min width for 5th column

    grid.setRowStretch(1,  0);                                                  # Set column stretch for 5th column
    grid.setRowStretch(3,  0);                                                  # Set column stretch for 5th column
    grid.setRowMinimumHeight(1,  25);                                           # Set column min width for 5th column
    grid.setRowMinimumHeight(3,  25);                                           # Set column min width for 5th column
    
    grid.addWidget( self.sourceButton,  0, 0, 1, 4 );                           # Place a widget in the grid
    grid.addWidget( self.sourceSet,     0, 4, 1, 1 );                           # Place a widget in the grid
    grid.addWidget( self.sourcePath,    1, 0, 1, 5 );                           # Place a widget in the grid

    grid.addWidget( self.destButton,    2, 0, 1, 4 );                           # Place a widget in the grid
    grid.addWidget( self.destSet,       2, 4, 1, 1 );                           # Place a widget in the grid
    grid.addWidget( self.destPath,      3, 0, 1, 5 );                           # Place a widget in the grid

    grid.addWidget( self.iopLabel,      4, 0, 1, 2 );                           # Place a widget in the grid
    grid.addWidget( self.iopName,       5, 0, 1, 2 );                           # Place a widget in the grid

    grid.addWidget( self.stationLabel,  4, 2, 1, 2 );                           # Place a widget in the grid
    grid.addWidget( self.stationName,   5, 2, 1, 2 );                           # Place a widget in the grid

    grid.addWidget( self.dateFrame,     6, 0, 1, 4 );                           # Place a widget in the grid
    grid.addWidget( self.copyButton,    7, 0, 1, 4 );                           # Place a widget in the grid
    grid.addWidget( self.copySucces,    7, 4, 1, 1 );                           # Place a widget in the grid
    grid.addWidget( self.procButton,    8, 0, 1, 4 );                           # Place a widget in the grid
    grid.addWidget( self.procSucces,    8, 4, 1, 1 );                           # Place a widget in the grid
    grid.addWidget( self.genButton,     9, 0, 1, 4 );                           # Place a widget in the grid
    grid.addWidget( self.genSucces,     9, 4, 1, 1 );                           # Place a widget in the grid
    grid.addWidget( self.uploadButton, 10, 0, 1, 4 );                           # Place a widget in the grid
    grid.addWidget( self.uploadSucces, 10, 4, 1, 1 );                           # Place a widget in the grid
    grid.addWidget( self.checkButton,  11, 0, 1, 4 );                           # Place a widget in the grid
    grid.addWidget( self.resetButton,  12, 0, 1, 4 );                           # Place a widget in the grid

    grid.addWidget( log_handler.frame, 0, 6, 13, 1);
    grid.addWidget( versionLabel, 20, 0, 1, 7)
    centralWidget = QWidget();                                                  # Create a main widget
    centralWidget.setLayout( grid );                                            # Set the main widget's layout to the grid
    self.setCentralWidget(centralWidget);                                       # Set the central widget of the base class to the main widget
    
    self.show( );                                                               # Show the main widget
Example #24
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
Example #25
0
    def setupUi(self):

        scene = QGraphicsScene(self)
        self.view = QGraphicsView(scene, self)
        self.view.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.view.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.view.setVisible(True)
        self.view.setInteractive(True)

        self.createPixmapIcon()

        self.mapWidget = MapWidget(self.mapManager)
        scene.addItem(self.mapWidget)
        self.mapWidget.setCenter(QGeoCoordinate(-8.1, -34.95))
        self.mapWidget.setZoomLevel(5)

        #...
        self.slider = QSlider(Qt.Vertical, self)
        self.slider.setTickInterval(1)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setMaximum(self.mapManager.maximumZoomLevel())
        self.slider.setMinimum(self.mapManager.minimumZoomLevel())

        self.slider.valueChanged[int].connect(self.sliderValueChanged)
        self.mapWidget.zoomLevelChanged[float].connect(self.mapZoomLevelChanged)

        mapControlLayout = QVBoxLayout()

        self.mapWidget.mapTypeChanged.connect(self.mapTypeChanged)

        for mapType in self.mapWidget.supportedMapTypes():
            radio = QRadioButton(self)
            if mapType == QGraphicsGeoMap.StreetMap:
                radio.setText('Street')
            elif mapType == QGraphicsGeoMap.SatelliteMapDay:
                radio.setText('Sattelite')
            elif mapType == QGraphicsGeoMap.SatelliteMapNight:
                radio.setText('Sattelite - Night')
            elif mapType == QGraphicsGeoMap.TerrainMap:
                radio.setText('Terrain')

            if mapType == self.mapWidget.mapType():
                radio.setChecked(True)

            radio.toggled[bool].connect(self.mapTypeToggled)

            self.mapControlButtons.append(radio)
            self.mapControlTypes.append(mapType)
            mapControlLayout.addWidget(radio)

        self.latitudeEdit = QLineEdit()
        self.longitudeEdit = QLineEdit()

        formLayout = QFormLayout()
        formLayout.addRow('Latitude', self.latitudeEdit)
        formLayout.addRow('Longitude', self.longitudeEdit)

        self.captureCoordsButton = QToolButton()
        self.captureCoordsButton.setText('Capture coordinates')
        self.captureCoordsButton.setCheckable(True)

        self.captureCoordsButton.toggled[bool].connect(
                self.mapWidget.setMouseClickCoordQuery)
        self.mapWidget.coordQueryResult.connect(self.updateCoords)

        self.setCoordsButton = QPushButton()
        self.setCoordsButton.setText('Set coordinates')
        self.setCoordsButton.clicked.connect(self.setCoordsClicked)

        buttonLayout = QHBoxLayout()

        buttonLayout.addWidget(self.captureCoordsButton)
        buttonLayout.addWidget(self.setCoordsButton)

        coordControlLayout = QVBoxLayout()
        coordControlLayout.addLayout(formLayout)
        coordControlLayout.addLayout(buttonLayout)

        widget = QWidget(self)
        layout = QGridLayout()
        layout.setRowStretch(0, 1)
        layout.setRowStretch(1, 0)

        topLayout = QGridLayout()
        bottomLayout = QGridLayout()

        topLayout.setColumnStretch(0, 0)
        topLayout.setColumnStretch(1, 1)

        bottomLayout.setColumnStretch(0, 0)
        bottomLayout.setColumnStretch(1, 1)

        topLayout.addWidget(self.slider, 0, 0)
        topLayout.addWidget(self.view, 0, 1)

        bottomLayout.addLayout(mapControlLayout, 0, 0)
        bottomLayout.addLayout(coordControlLayout, 0, 1)

        layout.addLayout(topLayout, 0, 0)
        layout.addLayout(bottomLayout, 1, 0)

        self.layout = layout
        widget.setLayout(layout)
        self.setCentralWidget(widget)

        self.view.setContextMenuPolicy(Qt.CustomContextMenu)

        self.view.customContextMenuRequested.connect(self.customContextMenuRequest)
Example #26
0
    def initUI(self):
        layout = QGridLayout()
        self.setLayout(layout)

        self.btnUp = CameraButton(CameraMove.Up)
        layout.addWidget(self.btnUp, 0, 1, 2, 1)
        self.btnUp.pressed.connect(self.move)
        self.btnUp.released.connect(self.stop)
        self.btnUp.setIcon(QIcon("icons/go-up.svg"))

        self.btnLeft = CameraButton(CameraMove.Left)
        layout.addWidget(self.btnLeft, 1, 0, 2, 1)
        self.btnLeft.pressed.connect(self.move)
        self.btnLeft.released.connect(self.stop)
        self.btnLeft.setIcon(QIcon("icons/go-previous.svg"))

        self.btnDown = CameraButton(CameraMove.Down)
        layout.addWidget(self.btnDown, 2, 1, 2, 1)
        self.btnDown.pressed.connect(self.move)
        self.btnDown.released.connect(self.stop)
        self.btnDown.setIcon(QIcon("icons/go-down.svg"))

        self.btnRight = CameraButton(CameraMove.Right)
        layout.addWidget(self.btnRight, 1, 2, 2, 1)
        self.btnRight.pressed.connect(self.move)
        self.btnRight.released.connect(self.stop)
        self.btnRight.setIcon(QIcon("icons/go-next.svg"))

        zoomInOut = PlusMinusButtons("Zoom", CameraZoom.Tele, CameraZoom.Wide)
        zoomInOut.connectPressed(self.zoom)
        zoomInOut.connectReleased(self.stopZoom)
        layout.addWidget(zoomInOut, 0, 3, 4, 1)

        focus = PlusMinusAutoButtons("Focus", CameraFocus.Far, CameraFocus.Near, CameraFocus.Auto)
        focus.connectPressed(self.focus)
        focus.connectReleased(self.stopFocus)
        focus.autoButton.clicked.connect(self.focus)
        layout.addWidget(focus, 0, 4, 4, 1)

        brightness = PlusMinusButtons("Brightness", True, False)
        brightness.connectClicked(self.exposure)
        layout.addWidget(brightness, 0, 5, 4, 1)

        presets = QGridLayout()
        presets.setRowStretch(0, 2)
        presets.setRowStretch(1, 1)

        self.presetGroup = QButtonGroup()

        for i in range(0, 6):
            btnPresetRecall = CameraButton(i)
            presets.addWidget(btnPresetRecall, 0, i, 1, 1)
            btnPresetRecall.setText(str(i + 1))
            btnPresetRecall.clicked.connect(self.recallPreset)
            btnPresetRecall.setCheckable(True)
            self.presetGroup.addButton(btnPresetRecall, i)

            btnPresetSet = CameraButton(i)
            presets.addWidget(btnPresetSet, 1, i, 1, 1)
            btnPresetSet.setText("Set")
            btnPresetSet.clicked.connect(self.storePreset)

        layout.addLayout(presets, 4, 0, 3, 6)