Skip to content

Commit 353c0f5

Browse files
authored
Move Window to pygame.window.Window namespace (#2604)
* Move Window to pygame.window.Window namespace * Window type hint fixes * Edit gen_stubs for Window
1 parent 24a3674 commit 353c0f5

File tree

16 files changed

+34
-27
lines changed

16 files changed

+34
-27
lines changed

buildconfig/Setup.Android.SDL2.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ pixelarray src_c/pixelarray.c $(SDL) $(DEBUG)
6161
math src_c/math.c $(SDL) $(DEBUG)
6262
pixelcopy src_c/pixelcopy.c $(SDL) $(DEBUG)
6363
newbuffer src_c/newbuffer.c $(SDL) $(DEBUG)
64-
_window src_c/window.c $(SDL) $(DEBUG)
64+
window src_c/window.c $(SDL) $(DEBUG)
6565
geometry src_c/geometry.c $(SDL) $(DEBUG)

buildconfig/Setup.Emscripten.SDL2.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ surflock src_c/void.c
5858
rect src_c/void.c
5959
rwobject src_c/void.c
6060
system src_c/void.c
61-
_window src_c/void.c
61+
window src_c/void.c
6262
geometry src_c/void.c
6363

6464
#_sdl2.controller src_c/_sdl2/controller.c $(SDL) $(DEBUG) -Isrc_c

buildconfig/Setup.SDL2.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ pixelcopy src_c/pixelcopy.c $(SDL) $(DEBUG)
7373
newbuffer src_c/newbuffer.c $(SDL) $(DEBUG)
7474
system src_c/system.c $(SDL) $(DEBUG)
7575
geometry src_c/geometry.c $(SDL) $(DEBUG)
76-
_window src_c/window.c $(SDL) $(DEBUG)
76+
window src_c/window.c $(SDL) $(DEBUG)

buildconfig/stubs/gen_stubs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"_debug",
5252
"system",
5353
"geometry",
54+
"window",
5455
]
5556

5657
# pygame classes that are autoimported into main namespace are kept in this dict
@@ -69,6 +70,7 @@
6970
"mixer": ["Channel"],
7071
"time": ["Clock"],
7172
"joystick": ["Joystick"],
73+
"window": ["Window"],
7274
"base": ["__version__"], # need an explicit import
7375
# uncomment below line if Circle is added to the base namespace later
7476
# "geometry": ["Circle"],

buildconfig/stubs/pygame/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ from pygame import (
3838
_debug as _debug,
3939
system as system,
4040
geometry as geometry,
41+
window as window,
4142
)
4243

4344
from .rect import Rect as Rect, FRect as FRect
@@ -54,6 +55,7 @@ from .font import Font as Font
5455
from .mixer import Channel as Channel
5556
from .time import Clock as Clock
5657
from .joystick import Joystick as Joystick
58+
from .window import Window as Window
5759
from .base import (
5860
__version__ as __version__,
5961
BufferError as BufferError,

buildconfig/stubs/pygame/_sdl2/video.pyi

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from typing import Any, Generator, Iterable, Optional, Tuple, Union
33
from pygame.color import Color
44
from pygame.rect import Rect
55
from pygame.surface import Surface
6+
from pygame.window import Window as Window
67

78
from .._common import ColorValue, RectValue, Coordinate
89

@@ -38,10 +39,6 @@ def messagebox(
3839
escape_button: int = 0,
3940
) -> int: ...
4041

41-
from pygame._window import Window as Window
42-
43-
_Window = Window
44-
4542
class Texture:
4643
def __init__(
4744
self,
File renamed without changes.

src_c/_sdl2/video.c

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src_c/cython/pygame/_sdl2/video.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ cdef extern from "pygame.h" nogil:
426426
cdef SDL_Rect r
427427
cdef object weakreflist
428428

429-
ctypedef class pygame._window.Window [object pgWindowObject]:
429+
ctypedef class pygame.window.Window [object pgWindowObject]:
430430
cdef SDL_Window *_win
431431
cdef SDL_bool _is_borrowed
432432

src_c/display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ pg_display_init(PyObject *self, PyObject *_null)
252252
return NULL;
253253
if (!pg_mod_autoinit(IMPPREFIX "event"))
254254
return NULL;
255-
if (!pg_mod_autoinit(IMPPREFIX "_window"))
255+
if (!pg_mod_autoinit(IMPPREFIX "window"))
256256
return NULL;
257257

258258
Py_RETURN_NONE;

0 commit comments

Comments
 (0)