polish: preview failure dialog + clean audition temp on close + drop redundant Qt imports
This commit is contained in:
@@ -6659,16 +6659,16 @@ class MainWindow(QMainWindow):
|
|||||||
self._merge_list.takeItem(row)
|
self._merge_list.takeItem(row)
|
||||||
|
|
||||||
def _merge_paths(self) -> list[str]:
|
def _merge_paths(self) -> list[str]:
|
||||||
from PyQt6.QtCore import Qt
|
|
||||||
return [self._merge_list.item(i).data(Qt.ItemDataRole.UserRole)
|
return [self._merge_list.item(i).data(Qt.ItemDataRole.UserRole)
|
||||||
for i in range(self._merge_list.count())]
|
for i in range(self._merge_list.count())]
|
||||||
|
|
||||||
def _merge_guard_ok(self, crossfade: float) -> bool:
|
def _merge_guard_ok(self, crossfade: float) -> bool:
|
||||||
"""False (+ status) if a clip with a KNOWN duration is <= the crossfade
|
"""False (+ status) if a clip with a KNOWN duration is <= the crossfade
|
||||||
(acrossfade needs each clip longer than the crossfade)."""
|
(acrossfade needs each clip longer than the crossfade)."""
|
||||||
from PyQt6.QtCore import Qt
|
|
||||||
if crossfade <= 0:
|
if crossfade <= 0:
|
||||||
return True
|
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()):
|
for i in range(self._merge_list.count()):
|
||||||
it = self._merge_list.item(i)
|
it = self._merge_list.item(i)
|
||||||
d = it.data(Qt.ItemDataRole.UserRole + 1)
|
d = it.data(Qt.ItemDataRole.UserRole + 1)
|
||||||
@@ -6752,7 +6752,9 @@ class MainWindow(QMainWindow):
|
|||||||
if ok:
|
if ok:
|
||||||
self._play_file(tmp)
|
self._play_file(tmp)
|
||||||
else:
|
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:
|
def _on_wave_refresh(self) -> None:
|
||||||
"""Decode the current audio area and repaint the waveform strip."""
|
"""Decode the current audio area and repaint the waveform strip."""
|
||||||
@@ -6797,6 +6799,7 @@ class MainWindow(QMainWindow):
|
|||||||
dur = self._spn_audio_len.value()
|
dur = self._spn_audio_len.value()
|
||||||
edit_filters = self._current_edit_filters()
|
edit_filters = self._current_edit_filters()
|
||||||
tmp = os.path.join(tempfile.gettempdir(), "8cut_audition.wav")
|
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,
|
cmd = build_audio_clip_command(self._file_path, start, dur, tmp,
|
||||||
filters=edit_filters or None)
|
filters=edit_filters or None)
|
||||||
QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)
|
QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)
|
||||||
|
|||||||
Reference in New Issue
Block a user