Move SearchState from app.py to search_state.py (no behavior change)
Step 8 of the gui/app.py + gui/preview.py structural refactor — first move out of app.py. Pure copy: the SearchState dataclass moves to its own module. app.py grows its first re-export shim block at the bottom so any internal `SearchState(...)` reference in BooruApp keeps working through the module-namespace lookup. Shim removed in commit 14.
This commit is contained in:
parent
4c166ac725
commit
591c7c3118
@ -51,18 +51,6 @@ from .settings import SettingsDialog
|
|||||||
log = logging.getLogger("booru")
|
log = logging.getLogger("booru")
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class SearchState:
|
|
||||||
"""Mutable state that resets on every new search."""
|
|
||||||
shown_post_ids: set[int] = field(default_factory=set)
|
|
||||||
page_cache: dict[int, list] = field(default_factory=dict)
|
|
||||||
infinite_exhausted: bool = False
|
|
||||||
infinite_last_page: int = 0
|
|
||||||
infinite_api_exhausted: bool = False
|
|
||||||
nav_page_turn: str | None = None
|
|
||||||
append_queue: list = field(default_factory=list)
|
|
||||||
|
|
||||||
|
|
||||||
class LogHandler(logging.Handler, QObject):
|
class LogHandler(logging.Handler, QObject):
|
||||||
"""Logging handler that emits to a QTextEdit."""
|
"""Logging handler that emits to a QTextEdit."""
|
||||||
|
|
||||||
@ -3606,3 +3594,7 @@ def run() -> None:
|
|||||||
window = BooruApp()
|
window = BooruApp()
|
||||||
window.show()
|
window.show()
|
||||||
sys.exit(app.exec())
|
sys.exit(app.exec())
|
||||||
|
|
||||||
|
|
||||||
|
# -- Refactor compatibility shims (deleted in commit 14) --
|
||||||
|
from .search_state import SearchState # re-export for refactor compat
|
||||||
|
|||||||
17
booru_viewer/gui/search_state.py
Normal file
17
booru_viewer/gui/search_state.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
"""Mutable per-search state container."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class SearchState:
|
||||||
|
"""Mutable state that resets on every new search."""
|
||||||
|
shown_post_ids: set[int] = field(default_factory=set)
|
||||||
|
page_cache: dict[int, list] = field(default_factory=dict)
|
||||||
|
infinite_exhausted: bool = False
|
||||||
|
infinite_last_page: int = 0
|
||||||
|
infinite_api_exhausted: bool = False
|
||||||
|
nav_page_turn: str | None = None
|
||||||
|
append_queue: list = field(default_factory=list)
|
||||||
Loading…
x
Reference in New Issue
Block a user