Polish transport spacing, drop shortcut hints, add Detect Next Clap button

- PlayerPanel now leaves an 8px bottom margin so the transport row
  isn't flush against the tab's edge.
- Frame-step buttons read '⏮ Frame' / 'Frame ⏭' instead of
  '⏮ Frame (,)' / 'Frame ⏭ (.)' -- the shortcuts still work, just not
  spelled out on the buttons.
- Detect Next Clap is now a button in the Sync markers panel next to
  Detect All Claps (still also in the Tools menu), kept in sync with
  its menu action's enabled state the same way Detect All Claps was.
This commit is contained in:
ThePendulum
2026-07-26 04:19:55 +02:00
parent 8c34a0f0c2
commit acd63f570d
3 changed files with 18 additions and 7 deletions
+9
View File
@@ -133,6 +133,11 @@ class MainWindow(QMainWindow):
self.detect_all_button.clicked.connect(self._on_detect_all_clicked) self.detect_all_button.clicked.connect(self._on_detect_all_clicked)
marker_layout.addWidget(self.detect_all_button) marker_layout.addWidget(self.detect_all_button)
self.detect_next_button = QPushButton("Detect Next Clap")
self.detect_next_button.setEnabled(False)
self.detect_next_button.clicked.connect(self._on_detect_next_clicked)
marker_layout.addWidget(self.detect_next_button)
layout.addWidget(marker_group) layout.addWidget(marker_group)
# Offset + preview + export row # Offset + preview + export row
@@ -241,6 +246,7 @@ class MainWindow(QMainWindow):
self.detect_all_action.setEnabled(True) self.detect_all_action.setEnabled(True)
self.detect_all_button.setEnabled(True) self.detect_all_button.setEnabled(True)
self.detect_next_action.setEnabled(True) self.detect_next_action.setEnabled(True)
self.detect_next_button.setEnabled(True)
# A loaded preview belongs to the *previous* source/offset -- drop it. # A loaded preview belongs to the *previous* source/offset -- drop it.
if self._preview_temp_path and os.path.exists(self._preview_temp_path): if self._preview_temp_path and os.path.exists(self._preview_temp_path):
@@ -357,6 +363,7 @@ class MainWindow(QMainWindow):
self.detect_all_action.setEnabled(False) self.detect_all_action.setEnabled(False)
self.detect_all_button.setEnabled(False) self.detect_all_button.setEnabled(False)
self.detect_next_action.setEnabled(False) self.detect_next_action.setEnabled(False)
self.detect_next_button.setEnabled(False)
self.statusBar().showMessage(label) self.statusBar().showMessage(label)
self._detect_worker = DetectWorker(self.input_path, start_offset=start_offset, max_results=max_results) self._detect_worker = DetectWorker(self.input_path, start_offset=start_offset, max_results=max_results)
@@ -368,6 +375,7 @@ class MainWindow(QMainWindow):
self.detect_all_action.setEnabled(True) self.detect_all_action.setEnabled(True)
self.detect_all_button.setEnabled(True) self.detect_all_button.setEnabled(True)
self.detect_next_action.setEnabled(True) self.detect_next_action.setEnabled(True)
self.detect_next_button.setEnabled(True)
existing = set(self.source_panel.marker_strip.markers()) existing = set(self.source_panel.marker_strip.markers())
existing.update(e.time_sec for e in events) existing.update(e.time_sec for e in events)
@@ -386,6 +394,7 @@ class MainWindow(QMainWindow):
self.detect_all_action.setEnabled(True) self.detect_all_action.setEnabled(True)
self.detect_all_button.setEnabled(True) self.detect_all_button.setEnabled(True)
self.detect_next_action.setEnabled(True) self.detect_next_action.setEnabled(True)
self.detect_next_button.setEnabled(True)
self.statusBar().showMessage("Detection failed (see log).", 8000) self.statusBar().showMessage("Detection failed (see log).", 8000)
self.log_view.appendPlainText(f"Clap detection FAILED: {message}") self.log_view.appendPlainText(f"Clap detection FAILED: {message}")
+3 -3
View File
@@ -53,7 +53,7 @@ class PlayerPanel(QWidget):
self._slider_being_dragged = False self._slider_being_dragged = False
layout = QVBoxLayout(self) layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0) layout.setContentsMargins(0, 0, 0, 8)
layout.addWidget(self.player, stretch=1) layout.addWidget(self.player, stretch=1)
seek_row = QHBoxLayout() seek_row = QHBoxLayout()
@@ -84,7 +84,7 @@ class PlayerPanel(QWidget):
transport = QHBoxLayout() transport = QHBoxLayout()
transport.addStretch(1) transport.addStretch(1)
self.prev_frame_button = QPushButton("⏮ Frame (,)") self.prev_frame_button = QPushButton("⏮ Frame")
self.prev_frame_button.clicked.connect(lambda: self.step_frame(-1)) self.prev_frame_button.clicked.connect(lambda: self.step_frame(-1))
transport.addWidget(self.prev_frame_button) transport.addWidget(self.prev_frame_button)
@@ -92,7 +92,7 @@ class PlayerPanel(QWidget):
self.play_button.clicked.connect(self.toggle_play) self.play_button.clicked.connect(self.toggle_play)
transport.addWidget(self.play_button) transport.addWidget(self.play_button)
self.next_frame_button = QPushButton("Frame ⏭ (.)") self.next_frame_button = QPushButton("Frame ⏭")
self.next_frame_button.clicked.connect(lambda: self.step_frame(1)) self.next_frame_button.clicked.connect(lambda: self.step_frame(1))
transport.addWidget(self.next_frame_button) transport.addWidget(self.next_frame_button)
+6 -4
View File
@@ -30,17 +30,19 @@ def main():
win.show() win.show()
qapp.processEvents() qapp.processEvents()
# -- Tools menu has the clap detection actions, AND Detect All Claps is # -- Tools menu has the clap detection actions, AND both Detect All Claps
# also back as a button in the Sync markers panel (both should reflect # and Detect Next Clap are also buttons in the Sync markers panel (each
# the same enabled state, kept in sync explicitly since they're two # kept in sync with its menu action's enabled state, since they're two
# separate widgets). # separate widgets).
menu_titles = [a.text() for a in win.menuBar().actions()] menu_titles = [a.text() for a in win.menuBar().actions()]
assert "&Tools" in menu_titles, f"expected a Tools menu, got {menu_titles}" assert "&Tools" in menu_titles, f"expected a Tools menu, got {menu_titles}"
assert win.detect_all_action.text() == "Detect All Claps" assert win.detect_all_action.text() == "Detect All Claps"
assert win.detect_next_action.text() == "Detect Next Clap" assert win.detect_next_action.text() == "Detect Next Clap"
assert win.detect_all_button.text() == "Detect All Claps" assert win.detect_all_button.text() == "Detect All Claps"
assert win.detect_next_button.text() == "Detect Next Clap"
assert win.detect_all_action.isEnabled() == win.detect_all_button.isEnabled() assert win.detect_all_action.isEnabled() == win.detect_all_button.isEnabled()
print("PASS: Tools menu has plain-labeled clap detection actions, button back in sync markers panel") assert win.detect_next_action.isEnabled() == win.detect_next_button.isEnabled()
print("PASS: Tools menu has plain-labeled clap detection actions, both buttons back in sync markers panel")
# -- Load via drag-and-drop simulation on the player widget # -- Load via drag-and-drop simulation on the player widget
mime = QMimeData() mime = QMimeData()