From c224cdbb5659b13b0a1a2a7e24d7ec3a98017361 Mon Sep 17 00:00:00 2001 From: Andrei Benea Date: Sun, 8 Feb 2026 03:43:32 +0100 Subject: [PATCH] Fix importing chapters in the PyQt UI. The app was crashing after importing a .txt and clicking convert because of a missing import. Fixed the imports and removed the legacy abogen.conversion module which doesn't seem necessary anymore. --- abogen/conversion.py | 16 ---------------- abogen/pyqt/gui.py | 6 +----- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 abogen/conversion.py diff --git a/abogen/conversion.py b/abogen/conversion.py deleted file mode 100644 index f615349..0000000 --- a/abogen/conversion.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Backwards-compatible re-export of conversion module. - -The PyQt-based implementation lives in abogen.pyqt.conversion. -The web-based implementation is in abogen.webui.conversion_runner. -""" - -from __future__ import annotations - -# Re-export PyQt conversion classes for backwards compatibility -from abogen.pyqt.conversion import ( # noqa: F401 - ConversionThread, - VoicePreviewThread, - PlayAudioThread, -) - -__all__ = ["ConversionThread", "VoicePreviewThread", "PlayAudioThread"] diff --git a/abogen/pyqt/gui.py b/abogen/pyqt/gui.py index 2916645..e0aa2e5 100644 --- a/abogen/pyqt/gui.py +++ b/abogen/pyqt/gui.py @@ -74,7 +74,7 @@ from abogen.subtitle_utils import ( calculate_text_length, ) -from abogen.conversion import ConversionThread, VoicePreviewThread, PlayAudioThread +from abogen.pyqt.conversion import ConversionThread, VoicePreviewThread, PlayAudioThread, ChapterOptionsDialog, TimestampDetectionDialog from abogen.pyqt.book_handler import HandlerDialog from abogen.constants import ( PROGRAM_NAME, @@ -2991,8 +2991,6 @@ class abogen(QWidget): """Show dialog to ask user about chapter processing options when chapters are detected in a .txt file""" # Check if this is a timestamp detection (-1) or chapter detection if chapter_count == -1: - from abogen.conversion import TimestampDetectionDialog - dialog = TimestampDetectionDialog(parent=self) dialog.setWindowModality(Qt.WindowModality.ApplicationModal) @@ -3007,8 +3005,6 @@ class abogen(QWidget): return # Normal chapter detection - from abogen.conversion import ChapterOptionsDialog - dialog = ChapterOptionsDialog(chapter_count, parent=self) dialog.setWindowModality(Qt.WindowModality.ApplicationModal)