mirror of
https://github.com/denizsafak/abogen.git
synced 2026-09-20 11:40:57 +02:00
refactor: extract ConversionCancelled to conversion_ports
- Single definition in application layer - Both adapters import from ports instead of defining locally
This commit is contained in:
@@ -13,6 +13,11 @@ from dataclasses import dataclass
|
|||||||
from typing import Any, List, Optional, Protocol, runtime_checkable
|
from typing import Any, List, Optional, Protocol, runtime_checkable
|
||||||
|
|
||||||
|
|
||||||
|
class ConversionCancelled(Exception):
|
||||||
|
"""Raised when conversion is cancelled by user."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConversionEvents(Protocol):
|
class ConversionEvents(Protocol):
|
||||||
"""UI-specific actions the conversion service delegates back to the caller.
|
"""UI-specific actions the conversion service delegates back to the caller.
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from pathlib import Path
|
|||||||
from typing import Any, Callable, Dict, List, Optional
|
from typing import Any, Callable, Dict, List, Optional
|
||||||
|
|
||||||
from abogen.application.conversion_request import ConversionRequest
|
from abogen.application.conversion_request import ConversionRequest
|
||||||
from abogen.application.conversion_ports import ResolvedVoice
|
from abogen.application.conversion_ports import ConversionCancelled, ResolvedVoice
|
||||||
|
|
||||||
|
|
||||||
def build_conversion_request_from_thread(thread: Any) -> ConversionRequest:
|
def build_conversion_request_from_thread(thread: Any) -> ConversionRequest:
|
||||||
@@ -135,11 +135,6 @@ class PyQtEvents:
|
|||||||
raise ConversionCancelled("Conversion cancelled by user")
|
raise ConversionCancelled("Conversion cancelled by user")
|
||||||
|
|
||||||
|
|
||||||
class ConversionCancelled(Exception):
|
|
||||||
"""Raised when conversion is cancelled."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class PyQtPipelineProvider:
|
class PyQtPipelineProvider:
|
||||||
"""PyQt implementation of PipelineProvider protocol.
|
"""PyQt implementation of PipelineProvider protocol.
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from pathlib import Path
|
|||||||
from typing import Any, Callable, Dict, List, Optional
|
from typing import Any, Callable, Dict, List, Optional
|
||||||
|
|
||||||
from abogen.application.conversion_request import ConversionRequest
|
from abogen.application.conversion_request import ConversionRequest
|
||||||
from abogen.application.conversion_ports import ResolvedVoice
|
from abogen.application.conversion_ports import ConversionCancelled, ResolvedVoice
|
||||||
|
|
||||||
|
|
||||||
def build_conversion_request_from_job(job: Any) -> ConversionRequest:
|
def build_conversion_request_from_job(job: Any) -> ConversionRequest:
|
||||||
@@ -114,11 +114,6 @@ class WebJobEvents:
|
|||||||
raise ConversionCancelled("Job cancelled by user")
|
raise ConversionCancelled("Job cancelled by user")
|
||||||
|
|
||||||
|
|
||||||
class ConversionCancelled(Exception):
|
|
||||||
"""Raised when conversion is cancelled."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class WebPipelineProvider:
|
class WebPipelineProvider:
|
||||||
"""WebUI implementation of PipelineProvider protocol.
|
"""WebUI implementation of PipelineProvider protocol.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user