v0.90.1: the visualizer's sync delay is a box with 1 ms arrows instead of a slider

This commit is contained in:
2026-11-06 02:55:16 -08:00
parent 95bbcf9601
commit 15f1ed5c96
3 changed files with 39 additions and 16 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
"""LinTunes — iTunes-style music library manager and player for Linux."""
__version__ = "0.90.0"
__version__ = "0.90.1"
+18 -15
View File
@@ -1081,37 +1081,40 @@ class PreferencesDialog(QDialog):
form.addRow("Frequency range:", row)
return slider
def _sync_delay_slider(self, form, style: str) -> QSlider:
def _sync_delay_slider(self, form, style: str) -> "QSpinBox":
"""This style's sync delay — this machine's speakers' latency plus
the style's own lag, so one per style, in config.json."""
the style's own lag, so one per style, in config.json. A box with
1 ms arrows (Round 125): a slider was too fidgety to set it by."""
from PyQt6.QtWidgets import QSpinBox
lo, hi = visualizer_styles.SYNC_DELAY_LIMITS
slider = _viz_slider_widget()
slider.setRange(lo, hi)
slider.setSingleStep(5)
slider.setPageStep(25)
slider.setToolTip(
box = QSpinBox()
box.setRange(lo, hi)
box.setSingleStep(1)
box.setSuffix(" ms")
box.setKeyboardTracking(False) # typing saves on Enter/leaving
box.setToolTip(
"If the visualizer runs ahead of what you hear — Bluetooth "
"headphones especially — hold it back this much. Below zero it "
"reacts sooner, by up to as much audio as the player has decoded "
"ahead (usually a few tens of ms). Set per computer and per "
"style, since each style lags in its own way.")
slider.setValue(visualizer_styles.sync_delay_ms(load_config(), style))
text = QLabel(_sync_text(slider.value()))
text.setMinimumWidth(max(_VALUE_WIDTH, text.fontMetrics().horizontalAdvance(
_sync_text(visualizer_styles.SYNC_DELAY_LIMITS[0])) + 4))
box.setValue(visualizer_styles.sync_delay_ms(load_config(), style))
text = QLabel(_sync_text(box.value()))
text.setEnabled(False)
def changed(value):
text.setText(_sync_text(value))
self._sync_save_timer.start()
slider.valueChanged.connect(changed)
self._sync_sliders[style] = slider
box.valueChanged.connect(changed)
self._sync_sliders[style] = box
row = QHBoxLayout()
row.addWidget(slider, stretch=1)
row.addWidget(box)
row.addSpacing(8)
row.addWidget(text)
row.addStretch(1)
form.addRow("Sync delay:", row)
return slider
return box
def _save_sync_delay(self):
config = load_config()
+20
View File
@@ -0,0 +1,20 @@
"""Round 125: the visualizer's sync delay is a box with 1 ms arrows, not a
slider (too fidgety to set to the millisecond)."""
from PyQt6.QtWidgets import QSpinBox
from lintunes.gui import visualizer_styles as vs
from lintunes.preferences import Preferences
from test_round108 import _dialog
def test_every_styles_sync_delay_is_a_1_ms_spin_box(qapp, tmp_path, monkeypatch):
monkeypatch.setenv("XDG_CONFIG_HOME", str(tmp_path / "cfg"))
dialog = _dialog(Preferences(tmp_path))
assert set(dialog._sync_sliders) == set(vs.STYLES)
for box in dialog._sync_sliders.values():
assert isinstance(box, QSpinBox)
assert box.singleStep() == 1
assert (box.minimum(), box.maximum()) == vs.SYNC_DELAY_LIMITS
before = box.value()
box.stepBy(1)
assert box.value() == before + 1