def _update_icon(self, next_action): next_action = CueNextAction(next_action) pixmap = pixmap_from_icon('', self.SIZE) if next_action == CueNextAction.AutoNext: pixmap = pixmap_from_icon('auto-next', self.SIZE) self.setToolTip(CueNextAction.AutoNext.value) elif next_action == CueNextAction.AutoFollow: pixmap = pixmap_from_icon('auto-follow', self.SIZE) self.setToolTip(CueNextAction.AutoFollow.value) else: self.setToolTip('') self.setPixmap(pixmap)
def _status_error(self, cue, error, details): self.statusIcon.setPixmap( pixmap_from_icon('led-error', CueWidget.ICON_SIZE)) self.volumeSlider.setEnabled(False) self.reset_volume() QDetailedMessageBox.dcritical(self.cue.name, error, details)
def _stop(self): self.setPixmap(pixmap_from_icon('', self.SIZE))
def _error(self, *args): self.setPixmap(pixmap_from_icon('led-error', self.SIZE))
def _pause(self): self.setPixmap(pixmap_from_icon('led-pause', self.SIZE))
def _start(self): self.setPixmap(pixmap_from_icon('led-running', self.SIZE))
def __init__(self, cue, **kwargs): super().__init__(**kwargs) self.cue = None self._selected = False self._accurate_timing = False self._show_dbmeter = False self._show_volume = False self._countdown_mode = True self._dbmeter_element = None self._fade_element = None self._volume_element = None self.setAttribute(Qt.WA_TranslucentBackground) self.setLayout(QGridLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.layout().setSpacing(2) self.layout().setColumnStretch(0, 6) self.layout().setRowStretch(0, 4) self.nameButton = QClickLabel(self) self.nameButton.setObjectName('ButtonCueWidget') self.nameButton.setWordWrap(True) self.nameButton.setAlignment(Qt.AlignCenter) self.nameButton.setFocusPolicy(Qt.NoFocus) self.nameButton.clicked.connect(self._clicked) self.nameButton.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.layout().addWidget(self.nameButton, 0, 0) self.statusIcon = QLabel(self.nameButton) self.statusIcon.setStyleSheet('background-color: transparent') self.statusIcon.setPixmap( pixmap_from_icon('led-off', CueWidget.ICON_SIZE)) self.seekSlider = QClickSlider(self.nameButton) self.seekSlider.setOrientation(Qt.Horizontal) self.seekSlider.setFocusPolicy(Qt.NoFocus) self.seekSlider.setVisible(False) self.volumeSlider = QClickSlider(self.nameButton) self.volumeSlider.setObjectName('VolumeSlider') self.volumeSlider.setOrientation(Qt.Vertical) self.volumeSlider.setFocusPolicy(Qt.NoFocus) self.volumeSlider.setRange(0, CueWidget.SLIDER_RANGE) self.volumeSlider.setPageStep(10) self.volumeSlider.valueChanged.connect( self._change_volume, Qt.DirectConnection) self.volumeSlider.setVisible(False) self.dbMeter = QDbMeter(self) self.dbMeter.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.dbMeter.setVisible(False) self.timeBar = QProgressBar(self) self.timeBar.setTextVisible(False) self.timeBar.setLayout(QHBoxLayout()) self.timeBar.layout().setContentsMargins(0, 0, 0, 0) self.timeDisplay = QLCDNumber(self.timeBar) self.timeDisplay.setStyleSheet('background-color: transparent') self.timeDisplay.setSegmentStyle(QLCDNumber.Flat) self.timeDisplay.setDigitCount(8) self.timeDisplay.display('00:00:00') self.timeBar.layout().addWidget(self.timeDisplay) self.timeBar.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.timeBar.setVisible(False) self._set_cue(cue)
def _status_paused(self): self.statusIcon.setPixmap( pixmap_from_icon('led-pause', CueWidget.ICON_SIZE)) self.volumeSlider.setEnabled(False)
def _status_playing(self): self.statusIcon.setPixmap( pixmap_from_icon('led-running', CueWidget.ICON_SIZE)) self.volumeSlider.setEnabled(True)
def _status_stopped(self): self.statusIcon.setPixmap( pixmap_from_icon('led-off', CueWidget.ICON_SIZE)) self.volumeSlider.setEnabled(False) self._update_time(0, True) self.reset_volume()