Skip to content

Commit 8edbcaf

Browse files
committed
Fix formatting
1 parent 74c9fa2 commit 8edbcaf

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

buildconfig/stubs/pygame/window.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,11 @@ class Window:
292292
def maximum_size(self, value: Point) -> None: ...
293293
@property
294294
def position(self) -> tuple[int, int]:
295-
"""Get or set the window position in screen coordinates."""
295+
"""Get or set the window position in screen coordinates.
296+
297+
The position may be a tuple of (x, y) coordiantes or ``WINDOWPOS_CENTERED`` or
298+
``WINDOWPOS_UNDEFINED``. The origin is the topleft of the main display.
299+
"""
296300

297301
@position.setter
298302
def position(self, value: Union[int, Point]) -> None: ...

docs/reST/ext/documenters.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ def build_signatures(object):
4141
if arg_string:
4242
arg_string = arg_string[2:]
4343

44+
if object.obj["type"] == "property":
45+
arg_string = ""
46+
else:
47+
arg_string = f"({arg_string})"
48+
4449
if ret.count("[") > 2 or ret.count(",") > 3:
4550
ret = ret.split("[")[0]
4651
if ret in ("Optional", "Union"):
@@ -49,7 +54,7 @@ def build_signatures(object):
4954
# Shorten "pygame.module.X" types to "X"
5055
ret = re.sub(r"pygame(.[a-zA-Z0-9_]+)+", lambda x: x.group(1)[1:], ret)
5156

52-
yield f"| :sg:`{name}({arg_string}) -> {ret}`"
57+
yield f"| :sg:`{name}{arg_string} -> {ret}`"
5358

5459

5560
def get_doc(env, obj):

src_c/doc/window_doc.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/* Auto generated file: with make_docs.py . Docs go in docs/reST/ref/ . */
2-
#define DOC_WINDOW "Window(title='pygame window', size=(640, 480), position=WINDOWPOS_UNDEFINED, **flags) -> Window\nPygame object that represents a window."
2+
#define DOC_WINDOW "Window(title='pygame window', size=(640, 480), position=WINDOWPOS_UNDEFINED, *, fullscreen=..., fullscreen_desktop=..., opengl=..., vulkan=..., hidden=..., borderless=..., resizable=..., minimized=..., maximized=..., mouse_grabbed=..., keyboard_grabbed=..., input_focus=..., mouse_focus=..., allow_high_dpi=..., mouse_capture=..., always_on_top=..., utility=...) -> Window\nPygame object that represents a window."
33
#define DOC_WINDOW_GRABMOUSE "grab_mouse -> bool\nGet or set the window's mouse grab mode."
44
#define DOC_WINDOW_GRABKEYBOARD "grab_keyboard -> bool\nGet or set the window's keyboard grab mode."
5-
#define DOC_WINDOW_MOUSEGRABBED "mouse_grabbed() -> bool\nGet if the mouse cursor is confined to the window (**read-only**)."
6-
#define DOC_WINDOW_KEYBOARDGRABBED "keyboard_grabbed() -> bool\nGet if the keyboard shortcuts are captured by the window (**read-only**)."
7-
#define DOC_WINDOW_FOCUSED "focused() -> bool\nGet if the window is focused (**read-only**)."
5+
#define DOC_WINDOW_MOUSEGRABBED "mouse_grabbed -> bool\nGet if the mouse cursor is confined to the window (**read-only**)."
6+
#define DOC_WINDOW_KEYBOARDGRABBED "keyboard_grabbed -> bool\nGet if the keyboard shortcuts are captured by the window (**read-only**)."
7+
#define DOC_WINDOW_FOCUSED "focused -> bool\nGet if the window is focused (**read-only**)."
88
#define DOC_WINDOW_TITLE "title -> str\nGet or set the window title."
99
#define DOC_WINDOW_RESIZABLE "resizable -> bool\nGet or set whether the window is resizable."
1010
#define DOC_WINDOW_BORDERLESS "borderless -> bool\nGets or sets whether the window is borderless."
1111
#define DOC_WINDOW_ALWAYSONTOP "always_on_top -> bool\nGet or set whether the window is always on top."
12-
#define DOC_WINDOW_ID "id() -> int\nGet the unique window ID (**read-only**)."
13-
#define DOC_WINDOW_MOUSERECT "mouse_rect() -> Optional[Rect]\nGet or set the mouse confinement rectangle of the window."
14-
#define DOC_WINDOW_SIZE "size() -> tuple[int, int]\nGet or set the window size in pixels."
15-
#define DOC_WINDOW_MINIMUMSIZE "minimum_size() -> tuple[int, int]\nGet or set the minimum size of the window's client area."
16-
#define DOC_WINDOW_MAXIMUMSIZE "maximum_size() -> tuple[int, int]\nGet or set the maximum size of the window's client area."
17-
#define DOC_WINDOW_POSITION "position() -> tuple[int, int]\nGet or set the window position in screen coordinates."
12+
#define DOC_WINDOW_ID "id -> int\nGet the unique window ID (**read-only**)."
13+
#define DOC_WINDOW_MOUSERECT "mouse_rect -> Optional[Rect]\nGet or set the mouse confinement rectangle of the window."
14+
#define DOC_WINDOW_SIZE "size -> tuple[int, int]\nGet or set the window size in pixels."
15+
#define DOC_WINDOW_MINIMUMSIZE "minimum_size -> tuple[int, int]\nGet or set the minimum size of the window's client area."
16+
#define DOC_WINDOW_MAXIMUMSIZE "maximum_size -> tuple[int, int]\nGet or set the maximum size of the window's client area."
17+
#define DOC_WINDOW_POSITION "position -> tuple[int, int]\nGet or set the window position in screen coordinates."
1818
#define DOC_WINDOW_OPACITY "opacity -> float\nGet or set the window opacity, between 0.0 (fully transparent) and 1.0 (fully opaque)."
19-
#define DOC_WINDOW_OPENGL "opengl() -> bool\nGet if the window supports OpenGL."
20-
#define DOC_WINDOW_UTILITY "utility() -> bool\nGet if the window is an utility window (**read-only**)."
19+
#define DOC_WINDOW_OPENGL "opengl -> bool\nGet if the window supports OpenGL."
20+
#define DOC_WINDOW_UTILITY "utility -> bool\nGet if the window is an utility window (**read-only**)."
2121
#define DOC_WINDOW_FROMDISPLAYMODULE "from_display_module() -> Window\nCreate a Window object using window data from display module."
2222
#define DOC_WINDOW_GETSURFACE "get_surface() -> Surface\nGet the window surface."
2323
#define DOC_WINDOW_FLIP "flip() -> None\nUpdate the display surface to the window."

0 commit comments

Comments
 (0)