Use dialog box to check for unintended play next track
This commit is contained in:
parent
50b051a864
commit
cf66cef60a
@ -238,13 +238,13 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
else:
|
else:
|
||||||
self.carts_init()
|
self.carts_init()
|
||||||
self.disable_selection_timing = False
|
self.disable_selection_timing = False
|
||||||
self.enable_play_next_controls()
|
|
||||||
self.clock_counter = 0
|
self.clock_counter = 0
|
||||||
self.timer10.start(10)
|
self.timer10.start(10)
|
||||||
self.timer500.start(500)
|
self.timer500.start(500)
|
||||||
self.timer1000.start(1000)
|
self.timer1000.start(1000)
|
||||||
self.signals = MusicMusterSignals()
|
self.signals = MusicMusterSignals()
|
||||||
self.connect_signals_slots()
|
self.connect_signals_slots()
|
||||||
|
self.catch_return_key = False
|
||||||
self.load_last_playlists()
|
self.load_last_playlists()
|
||||||
|
|
||||||
def about(self) -> None:
|
def about(self) -> None:
|
||||||
@ -517,7 +517,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.actionDownload_CSV_of_played_tracks.triggered.connect(
|
self.actionDownload_CSV_of_played_tracks.triggered.connect(
|
||||||
self.download_played_tracks
|
self.download_played_tracks
|
||||||
)
|
)
|
||||||
self.actionEnable_controls.triggered.connect(self.enable_play_next_controls)
|
|
||||||
self.actionExport_playlist.triggered.connect(self.export_playlist_tab)
|
self.actionExport_playlist.triggered.connect(self.export_playlist_tab)
|
||||||
self.actionFade.triggered.connect(self.fade)
|
self.actionFade.triggered.connect(self.fade)
|
||||||
self.actionImport.triggered.connect(self.import_track)
|
self.actionImport.triggered.connect(self.import_track)
|
||||||
@ -652,14 +651,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
else:
|
else:
|
||||||
log.error("Failed to retrieve playlist")
|
log.error("Failed to retrieve playlist")
|
||||||
|
|
||||||
def disable_play_next_controls(self) -> None:
|
|
||||||
"""
|
|
||||||
Disable "play next" keyboard controls
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.actionPlay_next.setEnabled(False)
|
|
||||||
self.show_status_message("Play controls: Disabled", 0)
|
|
||||||
|
|
||||||
def download_played_tracks(self) -> None:
|
def download_played_tracks(self) -> None:
|
||||||
"""Download a CSV of played tracks"""
|
"""Download a CSV of played tracks"""
|
||||||
|
|
||||||
@ -705,14 +696,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
self.action_Clear_selection.setEnabled(enabled)
|
self.action_Clear_selection.setEnabled(enabled)
|
||||||
|
|
||||||
def enable_play_next_controls(self) -> None:
|
|
||||||
"""
|
|
||||||
Enable "play next" keyboard controls
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.actionPlay_next.setEnabled(True)
|
|
||||||
self.show_status_message("Play controls: Enabled", 0)
|
|
||||||
|
|
||||||
def export_playlist_tab(self) -> None:
|
def export_playlist_tab(self) -> None:
|
||||||
"""Export the current playlist to an m3u file"""
|
"""Export the current playlist to an m3u file"""
|
||||||
|
|
||||||
@ -1106,6 +1089,16 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
- Update headers
|
- Update headers
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Check for inadvertent press of 'return'
|
||||||
|
if self.catch_return_key:
|
||||||
|
if not helpers.ask_yes_no(
|
||||||
|
"Track playing",
|
||||||
|
"Really play next track now?",
|
||||||
|
default_yes=True,
|
||||||
|
parent=self,
|
||||||
|
):
|
||||||
|
return
|
||||||
|
|
||||||
log.info(f"play_next({position=})")
|
log.info(f"play_next({position=})")
|
||||||
|
|
||||||
# If there is no next track set, return.
|
# If there is no next track set, return.
|
||||||
@ -1148,7 +1141,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.playing = True
|
self.playing = True
|
||||||
|
|
||||||
# Disable play next controls
|
# Disable play next controls
|
||||||
self.disable_play_next_controls()
|
self.catch_return_key = True
|
||||||
|
|
||||||
# Notify model
|
# Notify model
|
||||||
self.active_proxy_model().current_track_started()
|
self.active_proxy_model().current_track_started()
|
||||||
@ -1170,22 +1163,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
break
|
break
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
|
|
||||||
# Try making playing the last thing we do here to see whether
|
|
||||||
# the occasional short pause at the start of the track can be
|
|
||||||
# eliminated.
|
|
||||||
|
|
||||||
# # Notify model
|
|
||||||
# self.active_proxy_model().current_track_started()
|
|
||||||
|
|
||||||
# # Note that track is now playing
|
|
||||||
# self.playing = True
|
|
||||||
|
|
||||||
# # Disable play next controls
|
|
||||||
# self.disable_play_next_controls()
|
|
||||||
|
|
||||||
# # Update headers
|
|
||||||
# self.update_headers()
|
|
||||||
|
|
||||||
def preview(self) -> None:
|
def preview(self) -> None:
|
||||||
"""
|
"""
|
||||||
Preview selected or next track. We use a different mechanism to
|
Preview selected or next track. We use a different mechanism to
|
||||||
@ -1291,7 +1268,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Disable play controls so that 'return' in search box doesn't
|
# Disable play controls so that 'return' in search box doesn't
|
||||||
# play next track
|
# play next track
|
||||||
self.disable_play_next_controls()
|
self.catch_return_key = True
|
||||||
self.txtSearch.setHidden(False)
|
self.txtSearch.setHidden(False)
|
||||||
self.txtSearch.setFocus()
|
self.txtSearch.setFocus()
|
||||||
# Select any text that may already be there
|
# Select any text that may already be there
|
||||||
@ -1498,7 +1475,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.update_headers()
|
self.update_headers()
|
||||||
|
|
||||||
# Enable controls
|
# Enable controls
|
||||||
self.enable_play_next_controls()
|
self.catch_return_key = False
|
||||||
|
|
||||||
def tab_change(self):
|
def tab_change(self):
|
||||||
"""Called when active tab changed"""
|
"""Called when active tab changed"""
|
||||||
@ -1578,7 +1555,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
css_silence = f"background: {Config.COLOUR_ENDING_TIMER}"
|
css_silence = f"background: {Config.COLOUR_ENDING_TIMER}"
|
||||||
if self.frame_silent.styleSheet() != css_silence:
|
if self.frame_silent.styleSheet() != css_silence:
|
||||||
self.frame_silent.setStyleSheet(css_silence)
|
self.frame_silent.setStyleSheet(css_silence)
|
||||||
self.enable_play_next_controls()
|
self.catch_return_key = False
|
||||||
# Set warning colour on time to silence box when fade starts
|
# Set warning colour on time to silence box when fade starts
|
||||||
elif time_to_fade <= 500:
|
elif time_to_fade <= 500:
|
||||||
css_fade = f"background: {Config.COLOUR_WARNING_TIMER}"
|
css_fade = f"background: {Config.COLOUR_WARNING_TIMER}"
|
||||||
@ -1590,7 +1567,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.frame_fade.setStyleSheet(
|
self.frame_fade.setStyleSheet(
|
||||||
f"background: {Config.COLOUR_WARNING_TIMER}"
|
f"background: {Config.COLOUR_WARNING_TIMER}"
|
||||||
)
|
)
|
||||||
self.enable_play_next_controls()
|
self.catch_return_key = False
|
||||||
else:
|
else:
|
||||||
self.frame_silent.setStyleSheet("")
|
self.frame_silent.setStyleSheet("")
|
||||||
self.frame_fade.setStyleSheet("")
|
self.frame_fade.setStyleSheet("")
|
||||||
|
|||||||
@ -775,8 +775,6 @@ padding-left: 8px;</string>
|
|||||||
<addaction name="actionSetNext"/>
|
<addaction name="actionSetNext"/>
|
||||||
<addaction name="action_Clear_selection"/>
|
<addaction name="action_Clear_selection"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionEnable_controls"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionMark_for_moving"/>
|
<addaction name="actionMark_for_moving"/>
|
||||||
<addaction name="actionPaste"/>
|
<addaction name="actionPaste"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# Form implementation generated from reading ui file 'app/ui/main_window.ui'
|
# Form implementation generated from reading ui file 'app/ui/main_window.ui'
|
||||||
#
|
#
|
||||||
# Created by: PyQt6 UI code generator 6.6.0
|
# Created by: PyQt6 UI code generator 6.6.1
|
||||||
#
|
#
|
||||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||||
# run again. Do not edit this file unless you know what you are doing.
|
# run again. Do not edit this file unless you know what you are doing.
|
||||||
@ -487,8 +487,6 @@ class Ui_MainWindow(object):
|
|||||||
self.menuPlaylist.addAction(self.actionSetNext)
|
self.menuPlaylist.addAction(self.actionSetNext)
|
||||||
self.menuPlaylist.addAction(self.action_Clear_selection)
|
self.menuPlaylist.addAction(self.action_Clear_selection)
|
||||||
self.menuPlaylist.addSeparator()
|
self.menuPlaylist.addSeparator()
|
||||||
self.menuPlaylist.addAction(self.actionEnable_controls)
|
|
||||||
self.menuPlaylist.addSeparator()
|
|
||||||
self.menuPlaylist.addAction(self.actionMark_for_moving)
|
self.menuPlaylist.addAction(self.actionMark_for_moving)
|
||||||
self.menuPlaylist.addAction(self.actionPaste)
|
self.menuPlaylist.addAction(self.actionPaste)
|
||||||
self.menuSearc_h.addAction(self.actionSearch)
|
self.menuSearc_h.addAction(self.actionSearch)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user