From ee46e25c175d364e08b1695bf8e4463c902a14ef Mon Sep 17 00:00:00 2001 From: aatle <168398276+aatle@users.noreply.github.com> Date: Sat, 14 Dec 2024 19:40:47 -0800 Subject: [PATCH 1/5] Correctly type display.get_surface() return type --- buildconfig/stubs/pygame/display.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildconfig/stubs/pygame/display.pyi b/buildconfig/stubs/pygame/display.pyi index 5124e92b47..5f630a57e1 100644 --- a/buildconfig/stubs/pygame/display.pyi +++ b/buildconfig/stubs/pygame/display.pyi @@ -44,7 +44,7 @@ def set_mode( display: int = 0, vsync: int = 0, ) -> Surface: ... -def get_surface() -> Surface: ... +def get_surface() -> Optional[Surface]: ... def flip() -> None: ... @overload def update( From bfcec34636b3ffc965aff4d2205c44f98226dfd7 Mon Sep 17 00:00:00 2001 From: aatle <168398276+aatle@users.noreply.github.com> Date: Sat, 14 Dec 2024 19:43:32 -0800 Subject: [PATCH 2/5] Type display.update() as taking floats --- buildconfig/stubs/pygame/display.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildconfig/stubs/pygame/display.pyi b/buildconfig/stubs/pygame/display.pyi index 5f630a57e1..c12630ca09 100644 --- a/buildconfig/stubs/pygame/display.pyi +++ b/buildconfig/stubs/pygame/display.pyi @@ -51,7 +51,7 @@ def update( rectangle: Optional[Union[RectLike, Iterable[Optional[RectLike]]]] = None, / ) -> None: ... @overload -def update(x: int, y: int, w: int, h: int, /) -> None: ... +def update(x: float, y: float, w: float, h: float, /) -> None: ... @overload def update(xy: Point, wh: Point, /) -> None: ... def get_driver() -> str: ... From 803a9da140d363380b50e5921c50b3f900dd0567 Mon Sep 17 00:00:00 2001 From: aatle <168398276+aatle@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:24:31 -0800 Subject: [PATCH 3/5] Fix get_surface() docs --- docs/reST/ref/display.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/reST/ref/display.rst b/docs/reST/ref/display.rst index 310ebb38fa..c739bfbf57 100644 --- a/docs/reST/ref/display.rst +++ b/docs/reST/ref/display.rst @@ -251,6 +251,7 @@ required). | :sl:`Get a reference to the currently set display surface` | :sg:`get_surface() -> Surface` + | :sg:`get_surface() -> None` Return a reference to the currently set display Surface. If no display mode has been set this will return None. From 629cc2fb0ddb059e0139923524c66049a1e13eb0 Mon Sep 17 00:00:00 2001 From: aatle <168398276+aatle@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:36:31 -0800 Subject: [PATCH 4/5] Document overloads of `display.update()` --- buildconfig/stubs/pygame/display.pyi | 4 +++- docs/reST/ref/display.rst | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/buildconfig/stubs/pygame/display.pyi b/buildconfig/stubs/pygame/display.pyi index c12630ca09..43e1ec8c05 100644 --- a/buildconfig/stubs/pygame/display.pyi +++ b/buildconfig/stubs/pygame/display.pyi @@ -47,8 +47,10 @@ def set_mode( def get_surface() -> Optional[Surface]: ... def flip() -> None: ... @overload +def update() -> None: ... +@overload def update( - rectangle: Optional[Union[RectLike, Iterable[Optional[RectLike]]]] = None, / + rectangle: Optional[Union[RectLike, Iterable[Optional[RectLike]]]], / ) -> None: ... @overload def update(x: float, y: float, w: float, h: float, /) -> None: ... diff --git a/docs/reST/ref/display.rst b/docs/reST/ref/display.rst index c739bfbf57..223a3744de 100644 --- a/docs/reST/ref/display.rst +++ b/docs/reST/ref/display.rst @@ -273,7 +273,10 @@ required). .. function:: update | :sl:`Update all, or a portion, of the display. For non-OpenGL displays.` - | :sg:`update(rectangle=None, /) -> None` + | :sg:`update() -> None` + | :sg:`update(rectangle, /) -> None` + | :sg:`update(x, y, w, h, /) -> None` + | :sg:`update((x, y), (w, h), /) -> None` | :sg:`update(rectangle_iterable, /) -> None` For non OpenGL display Surfaces, this function is very similar to From 998738ea382bab0a3627aa7a18da7960c590adb1 Mon Sep 17 00:00:00 2001 From: aatle <168398276+aatle@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:40:46 -0800 Subject: [PATCH 5/5] Update display_doc.h --- src_c/doc/display_doc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src_c/doc/display_doc.h b/src_c/doc/display_doc.h index 17b881bd49..8e03e368fe 100644 --- a/src_c/doc/display_doc.h +++ b/src_c/doc/display_doc.h @@ -4,9 +4,9 @@ #define DOC_DISPLAY_QUIT "quit() -> None\nUninitialize the display module" #define DOC_DISPLAY_GETINIT "get_init() -> bool\nReturns True if the display module has been initialized" #define DOC_DISPLAY_SETMODE "set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0) -> Surface\nInitialize a window or screen for display" -#define DOC_DISPLAY_GETSURFACE "get_surface() -> Surface\nGet a reference to the currently set display surface" +#define DOC_DISPLAY_GETSURFACE "get_surface() -> Surface\nget_surface() -> None\nGet a reference to the currently set display surface" #define DOC_DISPLAY_FLIP "flip() -> None\nUpdate the full display Surface to the screen" -#define DOC_DISPLAY_UPDATE "update(rectangle=None, /) -> None\nupdate(rectangle_iterable, /) -> None\nUpdate all, or a portion, of the display. For non-OpenGL displays." +#define DOC_DISPLAY_UPDATE "update() -> None\nupdate(rectangle, /) -> None\nupdate(x, y, w, h, /) -> None\nupdate((x, y), (w, h), /) -> None\nupdate(rectangle_iterable, /) -> None\nUpdate all, or a portion, of the display. For non-OpenGL displays." #define DOC_DISPLAY_GETDRIVER "get_driver() -> name\nGet the name of the pygame display backend" #define DOC_DISPLAY_INFO "Info() -> VideoInfo\nCreate a video display information object" #define DOC_DISPLAY_GETWMINFO "get_wm_info() -> dict\nGet information about the current windowing system"