polish: preview failure dialog + clean audition temp on close + drop redundant Qt imports

This commit is contained in:
2026-07-02 16:35:53 +02:00
parent 14ec29dbbe
commit 43326730f2
+6 -3
View File
@@ -6659,16 +6659,16 @@ class MainWindow(QMainWindow):
self._merge_list.takeItem(row)
def _merge_paths(self) -> list[str]:
from PyQt6.QtCore import Qt
return [self._merge_list.item(i).data(Qt.ItemDataRole.UserRole)
for i in range(self._merge_list.count())]
def _merge_guard_ok(self, crossfade: float) -> bool:
"""False (+ status) if a clip with a KNOWN duration is <= the crossfade
(acrossfade needs each clip longer than the crossfade)."""
from PyQt6.QtCore import Qt
if crossfade <= 0:
return True
# Clips whose duration couldn't be probed (None) are not flagged here;
# if genuinely too short they surface as an ffmpeg error at render.
for i in range(self._merge_list.count()):
it = self._merge_list.item(i)
d = it.data(Qt.ItemDataRole.UserRole + 1)
@@ -6752,7 +6752,9 @@ class MainWindow(QMainWindow):
if ok:
self._play_file(tmp)
else:
self._show_status(f"Preview failed: {err}" if err else "Preview render failed", 5000)
self._show_status("Preview failed", 4000)
QMessageBox.warning(self, "Preview failed",
f"Could not render preview:\n\n{err}")
def _on_wave_refresh(self) -> None:
"""Decode the current audio area and repaint the waveform strip."""
@@ -6797,6 +6799,7 @@ class MainWindow(QMainWindow):
dur = self._spn_audio_len.value()
edit_filters = self._current_edit_filters()
tmp = os.path.join(tempfile.gettempdir(), "8cut_audition.wav")
self._merge_temps.add(tmp)
cmd = build_audio_clip_command(self._file_path, start, dur, tmp,
filters=edit_filters or None)
QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)