Add issue 223 debugging and quicklog function
This commit is contained in:
parent
dc3b46d2d6
commit
87d2d7adae
@ -23,7 +23,9 @@ from PyQt6.QtCore import (
|
|||||||
from PyQt6.QtGui import (
|
from PyQt6.QtGui import (
|
||||||
QCloseEvent,
|
QCloseEvent,
|
||||||
QColor,
|
QColor,
|
||||||
|
QKeySequence,
|
||||||
QPalette,
|
QPalette,
|
||||||
|
QShortcut,
|
||||||
)
|
)
|
||||||
from PyQt6.QtWidgets import (
|
from PyQt6.QtWidgets import (
|
||||||
QApplication,
|
QApplication,
|
||||||
@ -297,6 +299,10 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
self.catch_return_key = False
|
self.catch_return_key = False
|
||||||
self.load_last_playlists()
|
self.load_last_playlists()
|
||||||
|
|
||||||
|
# Set up shortcut key for instant logging from keyboard
|
||||||
|
self.action_quicklog = QShortcut(QKeySequence("Ctrl+L"), self)
|
||||||
|
self.action_quicklog.activated.connect(self.quicklog)
|
||||||
|
|
||||||
def about(self) -> None:
|
def about(self) -> None:
|
||||||
"""Get git tag and database name"""
|
"""Get git tag and database name"""
|
||||||
|
|
||||||
@ -1052,6 +1058,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
Actions required:
|
Actions required:
|
||||||
- If there is no next track set, return.
|
- If there is no next track set, return.
|
||||||
|
- Check for inadvertent press of return
|
||||||
- If there's currently a track playing, fade it.
|
- If there's currently a track playing, fade it.
|
||||||
- Move next track to current track.
|
- Move next track to current track.
|
||||||
- Clear next track
|
- Clear next track
|
||||||
@ -1064,6 +1071,13 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
- Update headers
|
- Update headers
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
log.debug(f"issue223: play_next({position=})")
|
||||||
|
|
||||||
|
# If there is no next track set, return.
|
||||||
|
if track_sequence.next is None:
|
||||||
|
log.error("musicmuster.play_next(): no next track selected")
|
||||||
|
return
|
||||||
|
|
||||||
# Check for inadvertent press of 'return'
|
# Check for inadvertent press of 'return'
|
||||||
if track_sequence.current and self.catch_return_key:
|
if track_sequence.current and self.catch_return_key:
|
||||||
# Suppress inadvertent double press
|
# Suppress inadvertent double press
|
||||||
@ -1083,21 +1097,18 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
* 1000
|
* 1000
|
||||||
> Config.PLAY_NEXT_GUARD_MS
|
> Config.PLAY_NEXT_GUARD_MS
|
||||||
)
|
)
|
||||||
|
if default_yes:
|
||||||
|
msg = "Hit return to play next track now"
|
||||||
|
else:
|
||||||
|
msg = "Press tab to select Yes and hit return to play next track"
|
||||||
if not helpers.ask_yes_no(
|
if not helpers.ask_yes_no(
|
||||||
"Track playing",
|
"Play next track",
|
||||||
"Really play next track now?",
|
msg,
|
||||||
default_yes=default_yes,
|
default_yes=default_yes,
|
||||||
parent=self,
|
parent=self,
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
log.debug(f"play_next({position=})")
|
|
||||||
|
|
||||||
# If there is no next track set, return.
|
|
||||||
if track_sequence.next is None:
|
|
||||||
log.error("musicmuster.play_next(): no next track selected")
|
|
||||||
return
|
|
||||||
|
|
||||||
# Issue #223 concerns a very short pause (maybe 0.1s) sometimes
|
# Issue #223 concerns a very short pause (maybe 0.1s) sometimes
|
||||||
# when starting to play at track.
|
# when starting to play at track.
|
||||||
|
|
||||||
@ -1105,7 +1116,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
# seconds of playback. Re-enable in update_clocks.
|
# seconds of playback. Re-enable in update_clocks.
|
||||||
|
|
||||||
self.timer10.stop()
|
self.timer10.stop()
|
||||||
log.debug("10ms timer disabled")
|
log.debug("issue223: play_next: 10ms timer disabled")
|
||||||
|
|
||||||
# If there's currently a track playing, fade it.
|
# If there's currently a track playing, fade it.
|
||||||
if track_sequence.current:
|
if track_sequence.current:
|
||||||
@ -1121,32 +1132,35 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Restore volume if -3dB active
|
# Restore volume if -3dB active
|
||||||
if self.btnDrop3db.isChecked():
|
if self.btnDrop3db.isChecked():
|
||||||
log.debug("Reset -3db button")
|
log.debug("issue223: play_next: Reset -3db button")
|
||||||
self.btnDrop3db.setChecked(False)
|
self.btnDrop3db.setChecked(False)
|
||||||
|
|
||||||
# Play (new) current track
|
# Play (new) current track
|
||||||
track_sequence.current.play(position)
|
track_sequence.current.play(position)
|
||||||
|
|
||||||
# Update clocks now, don't wait for next tick
|
# Update clocks now, don't wait for next tick
|
||||||
|
log.debug("issue223: play_next: update_clocks()")
|
||||||
self.update_clocks()
|
self.update_clocks()
|
||||||
|
|
||||||
# Show closing volume graph
|
# Show closing volume graph
|
||||||
if track_sequence.current.fade_graph:
|
if track_sequence.current.fade_graph:
|
||||||
|
log.error("issue223: play_next: set up fade_graph")
|
||||||
track_sequence.current.fade_graph.GraphWidget = self.widgetFadeVolume
|
track_sequence.current.fade_graph.GraphWidget = self.widgetFadeVolume
|
||||||
track_sequence.current.fade_graph.clear()
|
track_sequence.current.fade_graph.clear()
|
||||||
track_sequence.current.fade_graph.plot()
|
track_sequence.current.fade_graph.plot()
|
||||||
else:
|
else:
|
||||||
log.error("No fade_graph")
|
log.error("issue223: play_next: No fade_graph")
|
||||||
|
|
||||||
# Disable play next controls
|
# Disable play next controls
|
||||||
self.catch_return_key = True
|
self.catch_return_key = True
|
||||||
self.show_status_message("Play controls: Disabled", 0)
|
self.show_status_message("Play controls: Disabled", 0)
|
||||||
|
|
||||||
# Notify model
|
# Notify model
|
||||||
|
log.debug("issue223: play_next: notify model")
|
||||||
self.active_proxy_model().current_track_started()
|
self.active_proxy_model().current_track_started()
|
||||||
|
|
||||||
# Update headers
|
# Update headers
|
||||||
log.debug("update headers")
|
log.debug("issue223: play_next: update headers")
|
||||||
self.update_headers()
|
self.update_headers()
|
||||||
with db.Session() as session:
|
with db.Session() as session:
|
||||||
last_played = Playdates.last_played_tracks(session)
|
last_played = Playdates.last_played_tracks(session)
|
||||||
@ -1227,6 +1241,22 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
self.preview_manager.restart()
|
self.preview_manager.restart()
|
||||||
|
|
||||||
|
def quicklog(self) -> None:
|
||||||
|
"""
|
||||||
|
Create log entry
|
||||||
|
"""
|
||||||
|
|
||||||
|
log.debug("quicklog")
|
||||||
|
|
||||||
|
# Get log text
|
||||||
|
dlg: QInputDialog = QInputDialog(self)
|
||||||
|
dlg.setInputMode(QInputDialog.InputMode.TextInput)
|
||||||
|
dlg.setLabelText("Log text:")
|
||||||
|
dlg.resize(500, 100)
|
||||||
|
ok = dlg.exec()
|
||||||
|
if ok:
|
||||||
|
log.debug("quicklog: " + dlg.textValue())
|
||||||
|
|
||||||
def rename_playlist(self) -> None:
|
def rename_playlist(self) -> None:
|
||||||
"""
|
"""
|
||||||
Rename current playlist
|
Rename current playlist
|
||||||
@ -1625,7 +1655,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
and not self.timer10.isActive()
|
and not self.timer10.isActive()
|
||||||
):
|
):
|
||||||
self.timer10.start(10)
|
self.timer10.start(10)
|
||||||
log.debug("10ms timer enabled")
|
log.debug("issue223: update_clocks: 10ms timer enabled")
|
||||||
|
|
||||||
# Elapsed time
|
# Elapsed time
|
||||||
self.label_elapsed_timer.setText(
|
self.label_elapsed_timer.setText(
|
||||||
|
|||||||
@ -119,10 +119,12 @@ class _FadeCurve:
|
|||||||
|
|
||||||
if self.region is None:
|
if self.region is None:
|
||||||
# Create the region now that we're into fade
|
# Create the region now that we're into fade
|
||||||
|
log.debug("issue223: _FadeCurve: create region")
|
||||||
self.region = pg.LinearRegionItem([0, 0], bounds=[0, len(self.graph_array)])
|
self.region = pg.LinearRegionItem([0, 0], bounds=[0, len(self.graph_array)])
|
||||||
self.GraphWidget.addItem(self.region)
|
self.GraphWidget.addItem(self.region)
|
||||||
|
|
||||||
# Update region position
|
# Update region position
|
||||||
|
log.debug("issue223: _FadeCurve: update region")
|
||||||
self.region.setRegion([0, ms_of_graph * self.ms_to_array_factor])
|
self.region.setRegion([0, ms_of_graph * self.ms_to_array_factor])
|
||||||
|
|
||||||
|
|
||||||
@ -499,6 +501,7 @@ class _TrackManager:
|
|||||||
def play(self, position: Optional[float] = None) -> None:
|
def play(self, position: Optional[float] = None) -> None:
|
||||||
"""Play track"""
|
"""Play track"""
|
||||||
|
|
||||||
|
log.debug(f"issue223: _TrackManager: play {self.track_id=}")
|
||||||
now = dt.datetime.now()
|
now = dt.datetime.now()
|
||||||
self.start_time = now
|
self.start_time = now
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user