From c11573906af216eefe0449dad39eb5ac7147bae4 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Sat, 6 Jul 2024 19:01:27 +0100 Subject: [PATCH] Make tick_100ms more efficient --- app/musicmuster.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/musicmuster.py b/app/musicmuster.py index 4b9a5ae..86b94ab 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -1591,16 +1591,18 @@ class Window(QMainWindow, Ui_MainWindow): # Update intro counter if applicable and, if updated, return # because playing an intro takes precedence over timing a # preview. - remaining_ms = track_sequence.current.time_remaining_intro() - if remaining_ms > 0: - self.label_intro_timer.setText(f"{remaining_ms / 1000:.1f}") - if remaining_ms <= Config.INTRO_SECONDS_WARNING_MS: + intro_ms_remaining = track_sequence.current.time_remaining_intro() + if intro_ms_remaining > 0: + self.label_intro_timer.setText(f"{intro_ms_remaining / 1000:.1f}") + if intro_ms_remaining <= Config.INTRO_SECONDS_WARNING_MS: self.label_intro_timer.setStyleSheet( f"background: {Config.COLOUR_WARNING_TIMER}" ) return else: - self.label_intro_timer.setStyleSheet("") + if self.label_intro_timer.styleSheet() != "": + self.label_intro_timer.setStyleSheet("") + self.label_intro_timer.setText("0.0") except AttributeError: # currnent track ended during servicing tick pass