diff --git a/scripts/requirements.txt b/scripts/requirements.txt index c52dfdf9..0e7be656 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -16,13 +16,16 @@ PySide6-Essentials>=6.8.0.1 ; python_version <= '3.12' # Python 3.13 support scipy>=1.14.1 # Python 3.13 support tomli-w>=1.1.0 # Typing fixes typing-extensions>=4.4.0 # @override decorator support + # # Build and compile resources pyinstaller>=6.10.0 # Python 3.13 support + # # https://peps.python.org/pep-0508/#environment-markers # # Windows-only dependencies: +git+https://github.com/enthought/comtypes#egg=comtypes # Python 3.13 support # We don't use directly, just remove once 1.4.8 releases typed-D3DShot[numpy] >= 1.0.1; sys_platform == 'win32' pygrabber>=0.2 ; sys_platform == 'win32' # Completed types pywin32>=307 ; sys_platform == 'win32' # Python 3.13 support @@ -35,7 +38,7 @@ winrt-Windows.Graphics.DirectX.Direct3D11>=2.2.0 ; sys_platform == 'win32' # Py winrt-Windows.Graphics.Imaging>=2.2.0 ; sys_platform == 'win32' # Python 3.13 support winrt-Windows.Graphics>=2.2.0 ; sys_platform == 'win32' # Python 3.13 support winrt-Windows.Media.Capture>=2.2.0 ; sys_platform == 'win32' # Python 3.13 support -typed-D3DShot[numpy]>=1.0.1 ; sys_platform == 'win32' + # # Linux-only dependencies PyScreeze ; sys_platform == 'linux' diff --git a/src/capture_method/__init__.py b/src/capture_method/__init__.py index 007e8ee4..f1593daa 100644 --- a/src/capture_method/__init__.py +++ b/src/capture_method/__init__.py @@ -21,16 +21,15 @@ if sys.platform == "win32": from _ctypes import COMError # noqa: PLC2701 # comtypes is untyped + from pygrabber.dshow_graph import FilterGraph + from capture_method.BitBltCaptureMethod import BitBltCaptureMethod + from capture_method.DesktopDuplicationCaptureMethod import DesktopDuplicationCaptureMethod from capture_method.ForceFullContentRenderingCaptureMethod import ( ForceFullContentRenderingCaptureMethod, ) from capture_method.WindowsGraphicsCaptureMethod import WindowsGraphicsCaptureMethod - if sys.version_info < (3, 13): - # https://github.com/enthought/comtypes/issues/618 - from capture_method.DesktopDuplicationCaptureMethod import DesktopDuplicationCaptureMethod - if sys.platform == "linux": import pyscreeze from PIL import UnidentifiedImageError, features @@ -184,10 +183,7 @@ class CameraInfo: def get_input_devices(): - if sys.platform == "win32" and sys.version_info < (3, 13): - # https://github.com/enthought/comtypes/issues/618 - from pygrabber.dshow_graph import FilterGraph # noqa: PLC0415 - + if sys.platform == "win32": return FilterGraph().get_input_devices() cameras: list[str] = [] diff --git a/src/utils.py b/src/utils.py index 9e11f03a..61824894 100644 --- a/src/utils.py +++ b/src/utils.py @@ -158,7 +158,7 @@ def get_window_bounds(hwnd: int) -> tuple[int, int, int, int]: # Note: maybe reorganize capture_method module to have # different helper modules and a methods submodule def get_input_device_resolution(index: int) -> tuple[int, int] | None: - if sys.platform != "win32" or sys.version_info >= (3, 13): + if sys.platform != "win32": return (0, 0) # https://github.com/enthought/comtypes/issues/618