v0.2.1: sync status readable in the corner; Device menu right of Track
The QProgressBar overlay text didn't fit at 160-220px and clipped to two broken lines. Split it: a plain label "Copying to Rabbit R1 · 1.2 GB / 3.4 GB" next to a textless bar, both permanent right-side widgets hidden when idle. And the Device menu now sits to the right of Track (trav's intended spot). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,9 @@ When a round closes, move its finished items to `tasks-done.md`.
|
|||||||
totals middle, sync right).
|
totals middle, sync right).
|
||||||
|
|
||||||
Tests in `tests/test_round26.py`. Feature round → minor bump **0.2.0**.
|
Tests in `tests/test_round26.py`. Feature round → minor bump **0.2.0**.
|
||||||
|
Follow-up polish (**0.2.1**): sync status split into a plain "Copying to
|
||||||
|
Rabbit R1 · X / Y" label + textless bar (overlay text didn't fit), and the
|
||||||
|
Device menu moved to the right of Track per trav.
|
||||||
|
|
||||||
## Round 25 — folder highlight while dragging a playlist (v0.1.6)
|
## Round 25 — folder highlight while dragging a playlist (v0.1.6)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
"""LinTunes — iTunes-style music library manager and player for Linux."""
|
"""LinTunes — iTunes-style music library manager and player for Linux."""
|
||||||
|
|
||||||
__version__ = "0.2.0"
|
__version__ = "0.2.1"
|
||||||
|
|||||||
+22
-10
@@ -104,13 +104,18 @@ class MainWindow(QMainWindow):
|
|||||||
self._updater.start_checking()
|
self._updater.start_checking()
|
||||||
# Device-sync progress, right-justified: permanent widgets sit on the
|
# Device-sync progress, right-justified: permanent widgets sit on the
|
||||||
# status bar's right and survive showMessage. No stretch (see above)
|
# status bar's right and survive showMessage. No stretch (see above)
|
||||||
# and hidden while idle so it costs no space.
|
# and hidden while idle so it costs no space. Text lives in its own
|
||||||
|
# label — QProgressBar's overlay can't fit a sentence at this width.
|
||||||
|
self._sync_label = QLabel()
|
||||||
|
self._sync_label.hide()
|
||||||
|
self.statusBar().addPermanentWidget(self._sync_label)
|
||||||
self._sync_progress = QProgressBar()
|
self._sync_progress = QProgressBar()
|
||||||
self._sync_progress.setFixedWidth(220)
|
self._sync_progress.setFixedWidth(160)
|
||||||
self._sync_progress.setTextVisible(True)
|
self._sync_progress.setTextVisible(False)
|
||||||
self._sync_progress.hide()
|
self._sync_progress.hide()
|
||||||
self.statusBar().addPermanentWidget(self._sync_progress)
|
self.statusBar().addPermanentWidget(self._sync_progress)
|
||||||
self._sync_worker = None
|
self._sync_worker = None
|
||||||
|
self._sync_device_name = ""
|
||||||
|
|
||||||
# Wiring
|
# Wiring
|
||||||
self._transport.play_clicked.connect(self.play_pause)
|
self._transport.play_clicked.connect(self.play_pause)
|
||||||
@@ -236,6 +241,11 @@ class MainWindow(QMainWindow):
|
|||||||
self._add_action(view_menu, "Toggle Column Browser", "Ctrl+B",
|
self._add_action(view_menu, "Toggle Column Browser", "Ctrl+B",
|
||||||
self._library_view.toggle_browser)
|
self._library_view.toggle_browser)
|
||||||
|
|
||||||
|
track_menu = bar.addMenu("&Track")
|
||||||
|
self._add_action(track_menu, "Get Info", "Ctrl+I", self._info_for_current_view)
|
||||||
|
self._add_action(track_menu, "Go to Current Song", "Ctrl+L",
|
||||||
|
self._go_to_current_song)
|
||||||
|
|
||||||
device_menu = bar.addMenu("&Device")
|
device_menu = bar.addMenu("&Device")
|
||||||
self._sync_action = self._add_action(
|
self._sync_action = self._add_action(
|
||||||
device_menu, "Sync Playlist to Rabbit", "",
|
device_menu, "Sync Playlist to Rabbit", "",
|
||||||
@@ -245,11 +255,6 @@ class MainWindow(QMainWindow):
|
|||||||
# always reflects plug/unplug and the current view.
|
# always reflects plug/unplug and the current view.
|
||||||
device_menu.aboutToShow.connect(self._refresh_device_actions)
|
device_menu.aboutToShow.connect(self._refresh_device_actions)
|
||||||
|
|
||||||
track_menu = bar.addMenu("&Track")
|
|
||||||
self._add_action(track_menu, "Get Info", "Ctrl+I", self._info_for_current_view)
|
|
||||||
self._add_action(track_menu, "Go to Current Song", "Ctrl+L",
|
|
||||||
self._go_to_current_song)
|
|
||||||
|
|
||||||
def _add_action(self, menu, text, shortcut, slot):
|
def _add_action(self, menu, text, shortcut, slot):
|
||||||
action = QAction(text, self)
|
action = QAction(text, self)
|
||||||
if shortcut:
|
if shortcut:
|
||||||
@@ -311,18 +316,24 @@ class MainWindow(QMainWindow):
|
|||||||
self._sync_worker.progress.connect(self._on_sync_progress)
|
self._sync_worker.progress.connect(self._on_sync_progress)
|
||||||
self._sync_worker.finished.connect(self._on_sync_finished)
|
self._sync_worker.finished.connect(self._on_sync_finished)
|
||||||
self._sync_worker.failed.connect(self._on_sync_failed)
|
self._sync_worker.failed.connect(self._on_sync_failed)
|
||||||
|
self._sync_device_name = device.name
|
||||||
|
self._sync_label.setText(f"Copying to {device.name}")
|
||||||
self._sync_progress.setRange(0, max(plan.bytes_to_copy // 1024, 1))
|
self._sync_progress.setRange(0, max(plan.bytes_to_copy // 1024, 1))
|
||||||
self._sync_progress.setValue(0)
|
self._sync_progress.setValue(0)
|
||||||
self._sync_progress.setFormat(f"Syncing “{playlist.name}”…")
|
self._sync_label.show()
|
||||||
self._sync_progress.show()
|
self._sync_progress.show()
|
||||||
self._sync_worker.start()
|
self._sync_worker.start()
|
||||||
|
|
||||||
def _on_sync_progress(self, done_kib, total_kib, label):
|
def _on_sync_progress(self, done_kib, total_kib, label):
|
||||||
self._sync_progress.setRange(0, total_kib)
|
self._sync_progress.setRange(0, total_kib)
|
||||||
self._sync_progress.setValue(done_kib)
|
self._sync_progress.setValue(done_kib)
|
||||||
self._sync_progress.setFormat(f"Syncing {label} · %p%")
|
self._sync_label.setText(
|
||||||
|
f"Copying to {self._sync_device_name} · "
|
||||||
|
f"{device_sync.format_bytes(done_kib * 1024)} / "
|
||||||
|
f"{device_sync.format_bytes(total_kib * 1024)}")
|
||||||
|
|
||||||
def _on_sync_finished(self, summary):
|
def _on_sync_finished(self, summary):
|
||||||
|
self._sync_label.hide()
|
||||||
self._sync_progress.hide()
|
self._sync_progress.hide()
|
||||||
msg = (f"Synced “{summary['playlist']}” to the {summary['device']}: "
|
msg = (f"Synced “{summary['playlist']}” to the {summary['device']}: "
|
||||||
f"{summary['copied']} copied, {summary['kept']} up to date, "
|
f"{summary['copied']} copied, {summary['kept']} up to date, "
|
||||||
@@ -332,6 +343,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.statusBar().showMessage(msg, 8000)
|
self.statusBar().showMessage(msg, 8000)
|
||||||
|
|
||||||
def _on_sync_failed(self, message):
|
def _on_sync_failed(self, message):
|
||||||
|
self._sync_label.hide()
|
||||||
self._sync_progress.hide()
|
self._sync_progress.hide()
|
||||||
QMessageBox.warning(self, "Sync failed", message)
|
QMessageBox.warning(self, "Sync failed", message)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user