Example #1
0
    def start_timecode(self, cue):
        """Start the timecode, using the given cue."""
        # Test and create client, if needed, return on fail
        if not self.__client:
            try:
                self.__client = OlaClient()
            except OLADNotRunningException:
                logging.debug('TIMECODE: Cannot track cue, OLA not running.')
                return

        # Load cue settings, if enabled, otherwise return
        if not cue.timecode['enabled']:
            return

        # Stop the currently "running" timecode
        self.stop_timecode()

        # Reload format settings
        self.__hres = config['Timecode'].getboolean('hres')
        self.__format = TcFormat[config['Timecode']['format']].format
        self.__millis = TcFormat[config['Timecode']['format']].millis

        # Setup new cue and options
        self.__cue = cue
        self.__cue_time = HRCueTime(cue) if self.__hres else CueTime(cue)
        self.__replace_hours = cue.timecode['replace_hours']
        self.__track = cue.timecode['track']

        # Start watching the new cue
        self.__cue_time.notify.connect(self.__send_timecode,
                                       Connection.QtQueued)
Example #2
0
    def __init__(self, cue, *args):
        super().__init__(cue, *args)
        self.show_zero_duration = True

        self.cue.changed('next_action').connect(self._next_action_changed,
                                                Connection.QtQueued)

        self.wait_time = CueWaitTime(self.cue, mode=CueWaitTime.Mode.Post)
        self.cue_time = CueTime(self.cue)

        self._next_action_changed(self.cue.next_action)
Example #3
0
    def _set_cue(self, cue):
        self.cue = cue

        # Cue properties changes
        self.cue.changed('name').connect(
            self._update_name, Connection.QtQueued)
        self.cue.changed('stylesheet').connect(
            self._update_style, Connection.QtQueued)
        self.cue.changed('duration').connect(
            self._update_duration, Connection.QtQueued)
        self.cue.changed('description').connect(
            self._update_description, Connection.QtQueued)

        # Fade enter/exit
        self.cue.fadein_start.connect(self._enter_fadein, Connection.QtQueued)
        self.cue.fadein_end.connect(self._exit_fade, Connection.QtQueued)
        self.cue.fadeout_start.connect(self._enter_fadeout, Connection.QtQueued)
        self.cue.fadeout_end.connect(self._exit_fade, Connection.QtQueued)

        # Cue status changed
        self.cue.interrupted.connect(self._status_stopped, Connection.QtQueued)
        self.cue.started.connect(self._status_playing, Connection.QtQueued)
        self.cue.stopped.connect(self._status_stopped, Connection.QtQueued)
        self.cue.paused.connect(self._status_paused, Connection.QtQueued)
        self.cue.error.connect(self._status_error, Connection.QtQueued)
        self.cue.end.connect(self._status_stopped, Connection.QtQueued)

        # DbMeter connections
        if isinstance(cue, MediaCue):
            self.cue.media.elements_changed.connect(
                self._media_updated, Connection.QtQueued)

            self.cue.paused.connect(self.dbMeter.reset, Connection.QtQueued)
            self.cue.stopped.connect(self.dbMeter.reset, Connection.QtQueued)
            self.cue.end.connect(self.dbMeter.reset, Connection.QtQueued)
            self.cue.error.connect(self.dbMeter.reset, Connection.QtQueued)

            self.seekSlider.sliderMoved.connect(self.cue.media.seek)
            self.seekSlider.sliderJumped.connect(self.cue.media.seek)

        self._cue_time = CueTime(self.cue)
        self._cue_time.notify.connect(self._update_time, Connection.QtQueued)

        self._update_name(cue.name)
        self._update_style(cue.stylesheet)
        self._update_duration(self.cue.duration)
Example #4
0
    def __init__(self, cue, *args):
        super().__init__(cue, *args)

        self.cue.interrupted.connect(self._stop, Connection.QtQueued)
        self.cue.started.connect(self._running, Connection.QtQueued)
        self.cue.stopped.connect(self._stop, Connection.QtQueued)
        self.cue.paused.connect(self._pause, Connection.QtQueued)
        self.cue.error.connect(self._error, Connection.QtQueued)
        self.cue.end.connect(self._stop, Connection.QtQueued)
        self.cue.changed('duration').connect(self._update_duration,
                                             Connection.QtQueued)

        self.cue_time = CueTime(self.cue)
        self.cue_time.notify.connect(self._update_time, Connection.QtQueued)

        if cue.state & CueState.Running:
            self._running()
        elif cue.state & CueState.Pause:
            self._pause()
        elif cue.state & CueState.Error:
            self._error()
        else:
            self._stop()
Example #5
0
    def __init__(self, cue, **kwargs):
        super().__init__(**kwargs)
        self.setGeometry(0, 0, self.parent().viewport().width(), 80)
        self.setFocusPolicy(Qt.NoFocus)
        self.setLayout(QHBoxLayout(self))
        self.layout().setContentsMargins(0, 0, 0, 1)

        self._accurate_time = False

        self.cue = cue
        self.cue_time = CueTime(cue)
        self.cue_time.notify.connect(self._time_updated, Connection.QtQueued)

        # Use this to avoid transparent background
        self.gridLayoutWidget = QWidget(self)
        self.gridLayout = QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setContentsMargins(3, 3, 3, 3)
        self.gridLayout.setSpacing(2)
        self.layout().addWidget(self.gridLayoutWidget)

        self.nameLabel = QLabel(self.gridLayoutWidget)
        self.nameLabel.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        self.nameLabel.setText(cue.name)
        self.nameLabel.setToolTip(cue.name)
        self.gridLayout.addWidget(self.nameLabel, 0, 0, 1, 2)

        self.controlButtons = CueControlButtons(parent=self.gridLayoutWidget)
        self.gridLayout.addWidget(self.controlButtons, 1, 0)

        if CueAction.Stop in cue.CueActions:
            self.controlButtons.stopButton.clicked.connect(self._stop)
        else:
            self.controlButtons.stopButton.setEnabled(False)
        if CueAction.Pause in cue.CueActions:
            self.controlButtons.pauseButton.clicked.connect(self._pause)
            self.controlButtons.startButton.clicked.connect(self._resume)
        else:
            self.controlButtons.pauseButton.setEnabled(False)
            self.controlButtons.startButton.setEnabled(False)
        if CueAction.FadeIn in cue.CueActions:
            self.controlButtons.fadeInButton.clicked.connect(self._fadein)
        else:
            self.controlButtons.fadeInButton.setEnabled(False)
        if CueAction.FadeOut in cue.CueActions:
            self.controlButtons.fadeOutButton.clicked.connect(self._fadeout)
        else:
            self.controlButtons.fadeOutButton.setEnabled(False)
        if CueAction.Interrupt in cue.CueActions:
            self.controlButtons.interruptButton.clicked.connect(
                self._interrupt)
        else:
            self.controlButtons.interruptButton.setEnabled(False)

        self.timeDisplay = QLCDNumber(self.gridLayoutWidget)
        self.timeDisplay.setStyleSheet('background-color: transparent')
        self.timeDisplay.setSegmentStyle(QLCDNumber.Flat)
        self.timeDisplay.setDigitCount(8)
        self.timeDisplay.display(strtime(cue.duration))
        self.gridLayout.addWidget(self.timeDisplay, 1, 1)

        self.gridLayout.setRowStretch(0, 1)
        self.gridLayout.setRowStretch(1, 3)
        self.gridLayout.setColumnStretch(0, 7)
        self.gridLayout.setColumnStretch(1, 5)

        cue.changed('name').connect(self.name_changed, Connection.QtQueued)
        cue.started.connect(self.controlButtons.pauseMode, Connection.QtQueued)
        cue.paused.connect(self.controlButtons.startMode, Connection.QtQueued)

        # Fade enter/exit
        cue.fadein_start.connect(self.enter_fadein, Connection.QtQueued)
        cue.fadein_end.connect(self.exit_fade, Connection.QtQueued)
        cue.fadeout_start.connect(self.enter_fadeout, Connection.QtQueued)
        cue.fadeout_end.connect(self.exit_fade, Connection.QtQueued)
Example #6
0
    def __init__(self, cue, **kwargs):
        super().__init__(**kwargs)
        self.setFocusPolicy(Qt.NoFocus)
        self.setGeometry(0, 0, self.parent().viewport().width(), 110)

        self.cue = cue
        self.cue_time = CueTime(cue)
        self.cue_time.notify.connect(self._time_updated, Connection.QtQueued)

        self._dbmeter_element = None
        self._accurate_time = False

        self.gridLayoutWidget = QWidget(self)
        self.gridLayoutWidget.setGeometry(self.geometry())
        self.gridLayout = QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setContentsMargins(3, 3, 3, 3)
        self.gridLayout.setSpacing(2)

        self.nameLabel = QLabel(self.gridLayoutWidget)
        self.nameLabel.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        self.nameLabel.setText(cue.name)
        self.nameLabel.setToolTip(cue.name)
        self.gridLayout.addWidget(self.nameLabel, 0, 0, 1, 2)

        self.controlButtons = CueControlButtons(parent=self.gridLayoutWidget)
        self.controlButtons.stopButton.clicked.connect(self._stop)
        self.controlButtons.pauseButton.clicked.connect(self._pause)
        self.controlButtons.startButton.clicked.connect(self._start)
        self.controlButtons.fadeInButton.clicked.connect(self._fadein)
        self.controlButtons.fadeOutButton.clicked.connect(self._fadeout)
        self.controlButtons.interruptButton.clicked.connect(self._interrupt)
        self.gridLayout.addWidget(self.controlButtons, 1, 0)

        self.timeDisplay = QLCDNumber(self.gridLayoutWidget)
        self.timeDisplay.setStyleSheet('background-color: transparent')
        self.timeDisplay.setSegmentStyle(QLCDNumber.Flat)
        self.timeDisplay.setDigitCount(8)
        self.timeDisplay.display(strtime(cue.media.duration))
        self.gridLayout.addWidget(self.timeDisplay, 1, 1)

        self.seekSlider = QClickSlider(self.gridLayoutWidget)
        self.seekSlider.setOrientation(Qt.Horizontal)
        self.seekSlider.setRange(0, cue.media.duration)
        self.seekSlider.setFocusPolicy(Qt.NoFocus)
        self.seekSlider.sliderMoved.connect(self._seek)
        self.seekSlider.sliderJumped.connect(self._seek)
        self.seekSlider.setVisible(False)

        self.dbmeter = QDbMeter(self.gridLayoutWidget)
        self.dbmeter.setVisible(False)

        self.gridLayout.setRowStretch(0, 1)
        self.gridLayout.setRowStretch(1, 3)
        self.gridLayout.setColumnStretch(0, 7)
        self.gridLayout.setColumnStretch(1, 5)

        cue.changed('name').connect(self.name_changed)
        cue.changed('duration').connect(self.update_duration)
        cue.started.connect(self.controlButtons.pauseMode)
        cue.paused.connect(self.controlButtons.startMode)

        # Fade enter/exit
        cue.fadein_start.connect(self.enter_fadein, Connection.QtQueued)
        cue.fadein_end.connect(self.exit_fade, Connection.QtQueued)
        cue.fadeout_start.connect(self.enter_fadeout, Connection.QtQueued)
        cue.fadeout_end.connect(self.exit_fade, Connection.QtQueued)