booru-viewer/booru_viewer/gui/async_signals.py
pax 9d99ecfcb5 Move AsyncSignals from app.py to async_signals.py (no behavior change)
Step 10 of the gui/app.py + gui/preview.py structural refactor. Pure
copy: the QObject signal hub that BooruApp uses to marshal async
worker results back to the GUI thread moves to its own module. All
14 signals are preserved verbatim. app.py grows another shim line
so internal `AsyncSignals()` references in BooruApp keep working.
Shim removed in commit 14.
2026-04-08 14:36:57 -05:00

30 lines
1.2 KiB
Python

"""Qt signal hub for async worker results."""
from __future__ import annotations
from PySide6.QtCore import QObject, Signal
class AsyncSignals(QObject):
"""Signals for async worker results."""
search_done = Signal(list)
search_append = Signal(list)
search_error = Signal(str)
thumb_done = Signal(int, str)
image_done = Signal(str, str)
image_error = Signal(str)
# Fast-path for uncached video posts: emit the remote URL directly
# so mpv can start streaming + decoding immediately instead of
# waiting for download_image to write the whole file to disk first.
# download_image still runs in parallel to populate the cache for
# next time. Args: (url, info, width, height) — width/height come
# from post.width/post.height for the popout pre-fit optimization.
video_stream = Signal(str, str, int, int)
bookmark_done = Signal(int, str)
bookmark_error = Signal(str)
autocomplete_done = Signal(list)
batch_progress = Signal(int, int) # current, total
batch_done = Signal(str)
download_progress = Signal(int, int) # bytes_downloaded, total_bytes
prefetch_progress = Signal(int, float) # index, progress (0-1 or -1 to hide)