Make tick_100ms more efficient

This commit is contained in:
Keith Edmunds 2024-07-06 19:01:27 +01:00
parent 87d2d7adae
commit c11573906a

View File

@ -1591,16 +1591,18 @@ class Window(QMainWindow, Ui_MainWindow):
# Update intro counter if applicable and, if updated, return # Update intro counter if applicable and, if updated, return
# because playing an intro takes precedence over timing a # because playing an intro takes precedence over timing a
# preview. # preview.
remaining_ms = track_sequence.current.time_remaining_intro() intro_ms_remaining = track_sequence.current.time_remaining_intro()
if remaining_ms > 0: if intro_ms_remaining > 0:
self.label_intro_timer.setText(f"{remaining_ms / 1000:.1f}") self.label_intro_timer.setText(f"{intro_ms_remaining / 1000:.1f}")
if remaining_ms <= Config.INTRO_SECONDS_WARNING_MS: if intro_ms_remaining <= Config.INTRO_SECONDS_WARNING_MS:
self.label_intro_timer.setStyleSheet( self.label_intro_timer.setStyleSheet(
f"background: {Config.COLOUR_WARNING_TIMER}" f"background: {Config.COLOUR_WARNING_TIMER}"
) )
return return
else: 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: except AttributeError:
# currnent track ended during servicing tick # currnent track ended during servicing tick
pass pass