parent
cb2017e953
commit
2ca1d30609
@ -79,7 +79,6 @@ class Config(object):
|
|||||||
SCROLL_TOP_MARGIN = 3
|
SCROLL_TOP_MARGIN = 3
|
||||||
TEXT_NO_TRACK_NO_NOTE = "[Section header]"
|
TEXT_NO_TRACK_NO_NOTE = "[Section header]"
|
||||||
TOD_TIME_FORMAT = "%H:%M:%S"
|
TOD_TIME_FORMAT = "%H:%M:%S"
|
||||||
TIMER_MS = 10
|
|
||||||
TRACK_TIME_FORMAT = "%H:%M:%S"
|
TRACK_TIME_FORMAT = "%H:%M:%S"
|
||||||
VOLUME_VLC_DEFAULT = 75
|
VOLUME_VLC_DEFAULT = 75
|
||||||
VOLUME_VLC_DROP3db = 65
|
VOLUME_VLC_DROP3db = 65
|
||||||
|
|||||||
@ -319,8 +319,9 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
self.timer: QTimer = QTimer()
|
self.timer10: QTimer = QTimer()
|
||||||
self.clock_counter: int = 0
|
self.timer500: QTimer = QTimer()
|
||||||
|
self.timer1000: QTimer = QTimer()
|
||||||
|
|
||||||
self.music: music.Music = music.Music()
|
self.music: music.Music = music.Music()
|
||||||
self.playing: bool = False
|
self.playing: bool = False
|
||||||
@ -360,7 +361,9 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.carts_init()
|
self.carts_init()
|
||||||
self.enable_play_next_controls()
|
self.enable_play_next_controls()
|
||||||
self.clock_counter = 0
|
self.clock_counter = 0
|
||||||
self.timer.start(Config.TIMER_MS)
|
self.timer10.start(10)
|
||||||
|
self.timer500.start(500)
|
||||||
|
self.timer1000.start(1000)
|
||||||
self.connect_signals_slots()
|
self.connect_signals_slots()
|
||||||
|
|
||||||
def about(self) -> None:
|
def about(self) -> None:
|
||||||
@ -671,7 +674,9 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.tabBar.tabMoved.connect(self.move_tab)
|
self.tabBar.tabMoved.connect(self.move_tab)
|
||||||
self.txtSearch.returnPressed.connect(self.search_playlist_return)
|
self.txtSearch.returnPressed.connect(self.search_playlist_return)
|
||||||
|
|
||||||
self.timer.timeout.connect(self.tick)
|
self.timer10.timeout.connect(self.tick_10ms)
|
||||||
|
self.timer500.timeout.connect(self.tick_500ms)
|
||||||
|
self.timer1000.timeout.connect(self.tick_1000ms)
|
||||||
|
|
||||||
def create_playlist(
|
def create_playlist(
|
||||||
self, session: scoped_session, playlist_name: Optional[str] = None
|
self, session: scoped_session, playlist_name: Optional[str] = None
|
||||||
@ -812,8 +817,8 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
- Enable controls
|
- Enable controls
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Set flag to say we're not playing a track so that tick()
|
# Set flag to say we're not playing a track so that timer ticks
|
||||||
# doesn't see player=None and kick off end-of-track actions
|
# don't see player=None and kick off end-of-track actions
|
||||||
self.playing = False
|
self.playing = False
|
||||||
|
|
||||||
# Tell playlist_tab track has finished
|
# Tell playlist_tab track has finished
|
||||||
@ -831,8 +836,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
# Reset clocks
|
# Reset clocks
|
||||||
self.frame_fade.setStyleSheet("")
|
self.frame_fade.setStyleSheet("")
|
||||||
self.frame_silent.setStyleSheet("")
|
self.frame_silent.setStyleSheet("")
|
||||||
self.label_elapsed_timer.setText("00:00")
|
self.label_elapsed_timer.setText("00:00 / 00:00")
|
||||||
self.label_end_timer.setText("00:00")
|
|
||||||
self.label_fade_timer.setText("00:00")
|
self.label_fade_timer.setText("00:00")
|
||||||
self.label_silent_timer.setText("00:00")
|
self.label_silent_timer.setText("00:00")
|
||||||
|
|
||||||
@ -1668,24 +1672,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.next_track.playlist_tab, QColor(Config.COLOUR_NEXT_TAB)
|
self.next_track.playlist_tab, QColor(Config.COLOUR_NEXT_TAB)
|
||||||
)
|
)
|
||||||
|
|
||||||
def tick(self) -> None:
|
|
||||||
"""
|
|
||||||
Called every Config.TIMER_MS milliseconds. Call periodic functions
|
|
||||||
as required.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Get current number of milliseconds
|
|
||||||
self.clock_counter += Config.TIMER_MS
|
|
||||||
self.clock_counter %= 1000
|
|
||||||
|
|
||||||
# Call periodic functions
|
|
||||||
if self.clock_counter % 10 == 0:
|
|
||||||
self.tick_10ms()
|
|
||||||
if self.clock_counter % 500 == 0:
|
|
||||||
self.tick_500ms()
|
|
||||||
if self.clock_counter == 0:
|
|
||||||
self.tick_1000ms()
|
|
||||||
|
|
||||||
def tick_10ms(self) -> None:
|
def tick_10ms(self) -> None:
|
||||||
"""
|
"""
|
||||||
Called every 10ms
|
Called every 10ms
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user