| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- """
- UI module for BMAD Novel Translator.
- Provides the user interface components for the translation application.
- The module can be imported without PyQt6 for testing models only.
- """
- # Data models (no PyQt6 required)
- from .models import (
- FileItem,
- TranslationTask,
- FileStatus,
- TaskStatus,
- ProgressUpdate,
- Statistics,
- )
- # PyQt6-dependent imports (may fail if PyQt6 not installed)
- try:
- from .main_window import MainWindow
- from .file_list_model import FileListModel
- _pyqt6_available = True
- except ImportError:
- _pyqt6_available = False
- # Create placeholder for type checking
- MainWindow = None # type: ignore
- FileListModel = None # type: ignore
- # Core UI components (Epic 7b Phase 1)
- try:
- from .file_selector import FileSelector, FileListDialog
- except ImportError:
- FileSelector = None # type: ignore
- FileListDialog = None # type: ignore
- try:
- from .progress_widget import ProgressWidget, ChapterProgressItem
- except ImportError:
- ProgressWidget = None # type: ignore
- ChapterProgressItem = None # type: ignore
- # Phase 2 components (Epic 7b Phase 2 - Stories 7.10, 7.14, 7.16, 7.18, 7.20, 7.21, 7.24)
- try:
- from .translation_controller import (
- TranslationController,
- UIProgressObserver,
- TranslationWorker,
- )
- except ImportError:
- TranslationController = None # type: ignore
- UIProgressObserver = None # type: ignore
- TranslationWorker = None # type: ignore
- try:
- from .settings_dialog import SettingsDialog
- except ImportError:
- SettingsDialog = None # type: ignore
- try:
- from .error_dialog import ErrorDialog, ErrorReporter
- except ImportError:
- ErrorDialog = None # type: ignore
- ErrorReporter = None # type: ignore
- try:
- from .preview_dialog import (
- ImportPreviewDialog,
- ImportProgressDialog,
- BatchImportDialog,
- )
- except ImportError:
- ImportPreviewDialog = None # type: ignore
- ImportProgressDialog = None # type: ignore
- BatchImportDialog = None # type: ignore
- try:
- from .content_preview import (
- ContentPreviewWidget,
- ContentPreviewDialog,
- SynchronizedTextEdit,
- )
- except ImportError:
- ContentPreviewWidget = None # type: ignore
- ContentPreviewDialog = None # type: ignore
- SynchronizedTextEdit = None # type: ignore
- try:
- from .batch_operations import (
- BatchFileSelector,
- BatchOperationWorker,
- BatchOperationDialog,
- BatchOperationsManager,
- )
- except ImportError:
- BatchFileSelector = None # type: ignore
- BatchOperationWorker = None # type: ignore
- BatchOperationDialog = None # type: ignore
- BatchOperationsManager = None # type: ignore
- __all__ = [
- # Main window (PyQt6 required)
- "MainWindow",
- # Data models (no dependencies)
- "FileItem",
- "TranslationTask",
- "FileStatus",
- "TaskStatus",
- "ProgressUpdate",
- "Statistics",
- # Qt model (PyQt6 required)
- "FileListModel",
- # Core UI components (Phase 1)
- "FileSelector",
- "FileListDialog",
- "ProgressWidget",
- "ChapterProgressItem",
- # Translation control (Story 7.20)
- "TranslationController",
- "UIProgressObserver",
- "TranslationWorker",
- # Settings (Story 7.10)
- "SettingsDialog",
- # Error handling (Story 7.16)
- "ErrorDialog",
- "ErrorReporter",
- # Import preview (Story 7.24)
- "ImportPreviewDialog",
- "ImportProgressDialog",
- "BatchImportDialog",
- # Content preview (Story 7.18)
- "ContentPreviewWidget",
- "ContentPreviewDialog",
- "SynchronizedTextEdit",
- # Batch operations (Story 7.21)
- "BatchFileSelector",
- "BatchOperationWorker",
- "BatchOperationDialog",
- "BatchOperationsManager",
- ]
- def is_pyqt6_available() -> bool:
- """Check if PyQt6 is available."""
- return _pyqt6_available
|