Set intro timer background colour
This commit is contained in:
parent
afc3014b18
commit
8ebaa2798f
@ -61,6 +61,7 @@ class Config(object):
|
||||
HIDE_AFTER_PLAYING_OFFSET = 5000
|
||||
INFO_TAB_TITLE_LENGTH = 15
|
||||
INTRO_SECONDS_FORMAT = ".1f"
|
||||
INTRO_SECONDS_WARNING_MS = 3000
|
||||
LAST_PLAYED_TODAY_STRING = "Today"
|
||||
LAST_PLAYED_TOOLTIP_DATE_FORMAT = "%a, %d %b %Y"
|
||||
LOG_LEVEL_STDERR = logging.INFO
|
||||
|
||||
@ -1715,15 +1715,17 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
# Update intro counter if applicable and, if updated, return
|
||||
# because playing an intro takes precedence over timing a
|
||||
# preview.
|
||||
if (
|
||||
self.music.is_playing()
|
||||
and track_sequence.now.intro
|
||||
):
|
||||
|
||||
if self.music.is_playing() and track_sequence.now.intro:
|
||||
remaining_ms = track_sequence.now.intro - self.music.get_playtime()
|
||||
if remaining_ms > 0:
|
||||
self.label_intro_timer.setText(f"{remaining_ms / 1000:.1f}")
|
||||
if remaining_ms <= Config.INTRO_SECONDS_WARNING_MS:
|
||||
self.label_intro_timer.setStyleSheet(
|
||||
f"background: {Config.COLOUR_WARNING_TIMER}"
|
||||
)
|
||||
return
|
||||
else:
|
||||
self.label_intro_timer.setStyleSheet("")
|
||||
|
||||
# Ensure preview button is reset if preview finishes playing
|
||||
self.btnPreview.setChecked(self.preview_player.is_playing())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user