diff --git a/stubs/PyScreeze/@tests/stubtest_allowlist.txt b/stubs/PyScreeze/@tests/stubtest_allowlist.txt new file mode 100644 index 000000000..2fa942fc9 --- /dev/null +++ b/stubs/PyScreeze/@tests/stubtest_allowlist.txt @@ -0,0 +1,2 @@ +# present but unimplemented +pyscreeze.screenshotWindow diff --git a/stubs/PyScreeze/@tests/stubtest_allowlist_linux.txt b/stubs/PyScreeze/@tests/stubtest_allowlist_linux.txt index fb9d32191..fa9bd6fa0 100644 --- a/stubs/PyScreeze/@tests/stubtest_allowlist_linux.txt +++ b/stubs/PyScreeze/@tests/stubtest_allowlist_linux.txt @@ -1,4 +1,2 @@ # temp variable used to define scrotExists by checking if the command "scrot" exists pyscreeze.whichProc -# present but unimplemented -pyscreeze.screenshotWindow diff --git a/stubs/PyScreeze/METADATA.toml b/stubs/PyScreeze/METADATA.toml index 120f4da5c..aaf892106 100644 --- a/stubs/PyScreeze/METADATA.toml +++ b/stubs/PyScreeze/METADATA.toml @@ -1,3 +1,7 @@ -version = "0.1.29" +version = "0.1.30" upstream_repository = "https://github.com/asweigart/pyscreeze" requires = ["types-Pillow"] + +[tool.stubtest] +# Linux has extra constants, win32 has different definitions +platforms = ["linux", "win32"] diff --git a/stubs/PyScreeze/pyscreeze/__init__.pyi b/stubs/PyScreeze/pyscreeze/__init__.pyi index 97b730bf5..66bf283b8 100644 --- a/stubs/PyScreeze/pyscreeze/__init__.pyi +++ b/stubs/PyScreeze/pyscreeze/__init__.pyi @@ -1,3 +1,4 @@ +import sys from _typeshed import Incomplete, ReadableBuffer, StrOrBytesPath, Unused from collections.abc import Callable, Generator from typing import NamedTuple, SupportsFloat, TypeVar, overload @@ -11,10 +12,17 @@ _R = TypeVar("_R") # But can't import either, because pyscreeze does not declare them as dependencies, stub_uploader won't let it. _MatLike: TypeAlias = Incomplete -useOpenCV: Final[bool] +PILLOW_VERSION: Final[tuple[int, int, int]] RUNNING_PYTHON_2: Final = False -GRAYSCALE_DEFAULT: Final = False -scrotExists: Final[bool] +SCROT_EXISTS: Final[bool] +GNOMESCREENSHOT_EXISTS: Final[bool] + +if sys.platform == "linux": + RUNNING_X11: Final[bool] + RUNNING_WAYLAND: Final[bool] + +# Meant to be overridable as a setting +GRAYSCALE_DEFAULT: bool # Meant to be overridable for backward-compatibility USE_IMAGE_NOT_FOUND_EXCEPTION: bool @@ -173,7 +181,16 @@ def pixelMatchesColor( x: int, y: int, expectedRGBColor: tuple[int, int, int] | tuple[int, int, int, int], tolerance: int = 0 ) -> bool: ... def pixel(x: int, y: int) -> tuple[int, int, int]: ... -def screenshot(imageFilename: StrOrBytesPath | None = None, region: tuple[int, int, int, int] | None = None) -> Image.Image: ... + +if sys.platform == "win32": + def screenshot( + imageFilename: StrOrBytesPath | None = None, region: tuple[int, int, int, int] | None = None, allScreens: bool = False + ) -> Image.Image: ... + +else: + def screenshot( + imageFilename: StrOrBytesPath | None = None, region: tuple[int, int, int, int] | None = None + ) -> Image.Image: ... # _locateAll_opencv @overload