From acd63f570d50eafaa405e059d6afc273470a318b Mon Sep 17 00:00:00 2001 From: ThePendulum Date: Sun, 26 Jul 2026 04:19:55 +0200 Subject: [PATCH] Polish transport spacing, drop shortcut hints, add Detect Next Clap button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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. --- main.py | 9 +++++++++ player_panel.py | 6 +++--- scripts/smoke_test_interactions.py | 10 ++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 5f0cb1b..4e6971b 100644 --- a/main.py +++ b/main.py @@ -133,6 +133,11 @@ class MainWindow(QMainWindow): self.detect_all_button.clicked.connect(self._on_detect_all_clicked) 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) # Offset + preview + export row @@ -241,6 +246,7 @@ class MainWindow(QMainWindow): self.detect_all_action.setEnabled(True) self.detect_all_button.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. 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_button.setEnabled(False) self.detect_next_action.setEnabled(False) + self.detect_next_button.setEnabled(False) self.statusBar().showMessage(label) 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_button.setEnabled(True) self.detect_next_action.setEnabled(True) + self.detect_next_button.setEnabled(True) existing = set(self.source_panel.marker_strip.markers()) 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_button.setEnabled(True) self.detect_next_action.setEnabled(True) + self.detect_next_button.setEnabled(True) self.statusBar().showMessage("Detection failed (see log).", 8000) self.log_view.appendPlainText(f"Clap detection FAILED: {message}") diff --git a/player_panel.py b/player_panel.py index b645f9d..148a0e6 100644 --- a/player_panel.py +++ b/player_panel.py @@ -53,7 +53,7 @@ class PlayerPanel(QWidget): self._slider_being_dragged = False layout = QVBoxLayout(self) - layout.setContentsMargins(0, 0, 0, 0) + layout.setContentsMargins(0, 0, 0, 8) layout.addWidget(self.player, stretch=1) seek_row = QHBoxLayout() @@ -84,7 +84,7 @@ class PlayerPanel(QWidget): transport = QHBoxLayout() 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)) transport.addWidget(self.prev_frame_button) @@ -92,7 +92,7 @@ class PlayerPanel(QWidget): self.play_button.clicked.connect(self.toggle_play) 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)) transport.addWidget(self.next_frame_button) diff --git a/scripts/smoke_test_interactions.py b/scripts/smoke_test_interactions.py index f57325b..208663e 100644 --- a/scripts/smoke_test_interactions.py +++ b/scripts/smoke_test_interactions.py @@ -30,17 +30,19 @@ def main(): win.show() qapp.processEvents() - # -- Tools menu has the clap detection actions, AND Detect All Claps is - # also back as a button in the Sync markers panel (both should reflect - # the same enabled state, kept in sync explicitly since they're two + # -- Tools menu has the clap detection actions, AND both Detect All Claps + # and Detect Next Clap are also buttons in the Sync markers panel (each + # kept in sync with its menu action's enabled state, since they're two # separate widgets). menu_titles = [a.text() for a in win.menuBar().actions()] 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_next_action.text() == "Detect Next Clap" 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() - 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 mime = QMimeData()