Move VIDEO_EXTENSIONS + _is_video from preview.py to media/constants.py (no behavior change)
Step 1 of the gui/app.py + gui/preview.py structural refactor. Pure move: the constant and predicate are now in their own module, and preview.py grows a re-export shim at the bottom so existing imports (app.py:1351 and the in-file class methods) keep working unchanged. Shim is removed in commit 14 once importers update to the canonical path. See docs/REFACTOR_PLAN.md for the full migration order.
This commit is contained in:
parent
31d02d3c7b
commit
cd7b8a3cca
0
booru_viewer/gui/media/__init__.py
Normal file
0
booru_viewer/gui/media/__init__.py
Normal file
11
booru_viewer/gui/media/constants.py
Normal file
11
booru_viewer/gui/media/constants.py
Normal file
@ -0,0 +1,11 @@
|
||||
"""Shared constants and predicates for media files."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
VIDEO_EXTENSIONS = (".mp4", ".webm", ".mkv", ".avi", ".mov")
|
||||
|
||||
|
||||
def _is_video(path: str) -> bool:
|
||||
return Path(path).suffix.lower() in VIDEO_EXTENSIONS
|
||||
@ -17,8 +17,6 @@ import mpv as mpvlib
|
||||
|
||||
_log = logging.getLogger("booru")
|
||||
|
||||
VIDEO_EXTENSIONS = (".mp4", ".webm", ".mkv", ".avi", ".mov")
|
||||
|
||||
|
||||
class Viewport(NamedTuple):
|
||||
"""Where and how large the user wants popout content to appear.
|
||||
@ -51,10 +49,6 @@ class Viewport(NamedTuple):
|
||||
_DRIFT_TOLERANCE = 2
|
||||
|
||||
|
||||
def _is_video(path: str) -> bool:
|
||||
return Path(path).suffix.lower() in VIDEO_EXTENSIONS
|
||||
|
||||
|
||||
## Overlay styling for the popout's translucent toolbar / controls bar
|
||||
## now lives in the bundled themes (themes/*.qss). The widgets get their
|
||||
## object names set in code (FullscreenPreview / VideoPlayer) so theme QSS
|
||||
@ -2271,3 +2265,7 @@ class ImagePreview(QWidget):
|
||||
|
||||
def resizeEvent(self, event) -> None:
|
||||
super().resizeEvent(event)
|
||||
|
||||
|
||||
# -- Refactor compatibility shims (deleted in commit 14) --
|
||||
from .media.constants import VIDEO_EXTENSIONS, _is_video # re-export for refactor compat
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user