v0.63.1: nothing starts the main player in DJ mode; sync always clickable

Return or a double-click on a song started the regular player behind the
decks, with its controls greyed out and no way to stop it. DJ mode now
suspends the player. Sync to other track was only re-enabled when its own
deck changed, so loading the other deck afterwards left it grey; it's now
enabled whenever its deck has a song and explains what it can't do.
This commit is contained in:
2026-10-17 02:19:02 -07:00
parent 57cc5d5289
commit 8298450814
6 changed files with 91 additions and 12 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
"""LinTunes — iTunes-style music library manager and player for Linux."""
__version__ = "0.63.0"
__version__ = "0.63.1"
+18 -7
View File
@@ -513,8 +513,10 @@ class DjShelf(QWidget):
slider.setToolTip(f"Deck {v.name} speed (double-click: back to 0)")
slider.valueChanged.connect(lambda value, v=v: self._on_speed(v, value))
slider.mouseDoubleClickEvent = lambda e, s=slider: s.setValue(0)
label = QLabel("0.0%")
label.setStyleSheet(f"color: {v.color.name()};")
label = QLabel("+0.0%")
label.setStyleSheet(f"color: {v.color.name()}; font-size: 11px;")
label.setAlignment(Qt.AlignmentFlag.AlignCenter)
label.setMinimumWidth(60)
for w in (top, bottom):
w.setStyleSheet(f"color: {DIM}; font-size: 10px;")
for w in (top, slider, bottom, label):
@@ -522,7 +524,7 @@ class DjShelf(QWidget):
col.setStretch(1, 1)
holder = QWidget()
holder.setLayout(col)
holder.setFixedWidth(58)
holder.setFixedWidth(64)
self.speed[v.name] = slider
self.speed_label[v.name] = label
self._compact_hidden.append(holder)
@@ -555,6 +557,7 @@ class DjShelf(QWidget):
sync.clicked.connect(lambda _=False, v=v: self.sync(v))
for w in (play, sync):
w.setStyleSheet(_deck_button_qss(v.name))
w.setFocusPolicy(Qt.FocusPolicy.NoFocus) # Space/Return mean nothing here
buttons.addWidget(play)
buttons.addWidget(sync, stretch=1)
self.play_buttons[v.name] = play
@@ -616,6 +619,7 @@ class DjShelf(QWidget):
line.addLayout(nums)
pitch = QCheckBox("Keep pitch")
pitch.setChecked(True)
pitch.setFocusPolicy(Qt.FocusPolicy.NoFocus)
pitch.setStyleSheet(_deck_button_qss(v.name))
pitch.setToolTip("On: a faster song stays in its key. Off: pitch "
"follows speed, like a turntable")
@@ -857,11 +861,16 @@ class DjShelf(QWidget):
def sync(self, view: DeckView):
"""Tempo to the other deck's; while both play, the beats too."""
other = self.other(view)
if view.deck.source is None or other.deck.source is None:
self.message.emit("Sync needs a song on both decks.")
if view.deck.source is None:
return
if other.deck.source is None:
self.message.emit(f"Load a song on Deck {other.name} to sync to it."
if other.track is None else
f"Deck {other.name} is still loading.")
return
if not view.bpm or not other.bpm:
self.message.emit("Sync needs both songs' tempo, and one has no beat to find.")
missing = view if not view.bpm else other
self.message.emit(f"Can't sync: no beat was found in “{missing.track.name}”.")
return
target = other.bpm * other.deck.speed
view.deck.speed = analysis.sync_ratio(view.bpm, target)
@@ -928,7 +937,9 @@ class DjShelf(QWidget):
self.play_buttons[view.name].setIcon(QIcon(_play_icon(deck.playing)))
loaded = deck.source is not None
self.play_buttons[view.name].setEnabled(loaded)
self.sync_buttons[view.name].setEnabled(loaded and self.other(view).deck.source is not None)
# Always clickable once this deck has a song: whatever sync can't do
# yet (an empty other deck, a tempo still being worked out) it says.
self.sync_buttons[view.name].setEnabled(loaded)
self._refresh_note(view)
def _tick(self):
+2 -2
View File
@@ -2315,8 +2315,7 @@ class MainWindow(QMainWindow):
from lintunes.gui import track_table
if on:
shelf = self._ensure_dj()
if self.player.is_playing():
self.player.pause()
self.player.set_suspended(True) # pauses it, and keeps it so
target = self._dj_target_height()
self._transport.set_dj_mode(True, self._dj_titles())
track_table.deck_tag = self._deck_tag
@@ -2397,6 +2396,7 @@ class MainWindow(QMainWindow):
return # reopened mid-close
self._dj.stop()
self._dj.hide()
self.player.set_suspended(False)
self._transport.set_dj_mode(False)
def _on_dj_resize(self, dy: int):
+17 -1
View File
@@ -586,7 +586,19 @@ class Player(QObject):
# ---- queue ----
# DJ mode (Round 93) has its own decks; while it's open nothing may
# start this player — a double-click, Return or a media key would play
# behind the decks with the main transport greyed out, unstoppable.
suspended = False
def set_suspended(self, on: bool):
self.suspended = bool(on)
if on:
self.pause()
def play_queue(self, track_ids: list[int], start_index: int):
if self.suspended:
return
self._queue = list(track_ids)
self._index = start_index
self._reshuffle()
@@ -801,6 +813,8 @@ class Player(QObject):
# ---- transport ----
def toggle_play(self):
if self.suspended and not self.is_playing():
return
log_control("player", "toggle_play",
f"playing={self.is_playing()} pos={self.position_ms()}ms "
f"track={self._current_track.name if self._current_track else None!r}")
@@ -833,12 +847,14 @@ class Player(QObject):
self.track_changed.emit(None)
def next(self):
if self.suspended:
return
# When paused/stopped, skipping only cues the new track; audio
# starts only if we were already playing.
self._advance(autoplay=self.is_playing())
def previous(self):
if not self._queue:
if not self._queue or self.suspended:
return
prev_index = self._step_index(-1)
if self.position_ms() > RESTART_THRESHOLD_MS or prev_index is None: