Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
zoldalma999 committed Jan 26, 2025
1 parent 74c9fa2 commit 8edbcaf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
6 changes: 5 additions & 1 deletion buildconfig/stubs/pygame/window.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ class Window:
def maximum_size(self, value: Point) -> None: ...
@property
def position(self) -> tuple[int, int]:
"""Get or set the window position in screen coordinates."""
"""Get or set the window position in screen coordinates.
The position may be a tuple of (x, y) coordiantes or ``WINDOWPOS_CENTERED`` or
``WINDOWPOS_UNDEFINED``. The origin is the topleft of the main display.
"""

@position.setter
def position(self, value: Union[int, Point]) -> None: ...
Expand Down
7 changes: 6 additions & 1 deletion docs/reST/ext/documenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ def build_signatures(object):
if arg_string:
arg_string = arg_string[2:]

if object.obj["type"] == "property":
arg_string = ""
else:
arg_string = f"({arg_string})"

if ret.count("[") > 2 or ret.count(",") > 3:
ret = ret.split("[")[0]
if ret in ("Optional", "Union"):
Expand All @@ -49,7 +54,7 @@ def build_signatures(object):
# Shorten "pygame.module.X" types to "X"
ret = re.sub(r"pygame(.[a-zA-Z0-9_]+)+", lambda x: x.group(1)[1:], ret)

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


def get_doc(env, obj):
Expand Down
24 changes: 12 additions & 12 deletions src_c/doc/window_doc.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/* Auto generated file: with make_docs.py . Docs go in docs/reST/ref/ . */
#define DOC_WINDOW "Window(title='pygame window', size=(640, 480), position=WINDOWPOS_UNDEFINED, **flags) -> Window\nPygame object that represents a window."
#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."
#define DOC_WINDOW_GRABMOUSE "grab_mouse -> bool\nGet or set the window's mouse grab mode."
#define DOC_WINDOW_GRABKEYBOARD "grab_keyboard -> bool\nGet or set the window's keyboard grab mode."
#define DOC_WINDOW_MOUSEGRABBED "mouse_grabbed() -> bool\nGet if the mouse cursor is confined to the window (**read-only**)."
#define DOC_WINDOW_KEYBOARDGRABBED "keyboard_grabbed() -> bool\nGet if the keyboard shortcuts are captured by the window (**read-only**)."
#define DOC_WINDOW_FOCUSED "focused() -> bool\nGet if the window is focused (**read-only**)."
#define DOC_WINDOW_MOUSEGRABBED "mouse_grabbed -> bool\nGet if the mouse cursor is confined to the window (**read-only**)."
#define DOC_WINDOW_KEYBOARDGRABBED "keyboard_grabbed -> bool\nGet if the keyboard shortcuts are captured by the window (**read-only**)."
#define DOC_WINDOW_FOCUSED "focused -> bool\nGet if the window is focused (**read-only**)."
#define DOC_WINDOW_TITLE "title -> str\nGet or set the window title."
#define DOC_WINDOW_RESIZABLE "resizable -> bool\nGet or set whether the window is resizable."
#define DOC_WINDOW_BORDERLESS "borderless -> bool\nGets or sets whether the window is borderless."
#define DOC_WINDOW_ALWAYSONTOP "always_on_top -> bool\nGet or set whether the window is always on top."
#define DOC_WINDOW_ID "id() -> int\nGet the unique window ID (**read-only**)."
#define DOC_WINDOW_MOUSERECT "mouse_rect() -> Optional[Rect]\nGet or set the mouse confinement rectangle of the window."
#define DOC_WINDOW_SIZE "size() -> tuple[int, int]\nGet or set the window size in pixels."
#define DOC_WINDOW_MINIMUMSIZE "minimum_size() -> tuple[int, int]\nGet or set the minimum size of the window's client area."
#define DOC_WINDOW_MAXIMUMSIZE "maximum_size() -> tuple[int, int]\nGet or set the maximum size of the window's client area."
#define DOC_WINDOW_POSITION "position() -> tuple[int, int]\nGet or set the window position in screen coordinates."
#define DOC_WINDOW_ID "id -> int\nGet the unique window ID (**read-only**)."
#define DOC_WINDOW_MOUSERECT "mouse_rect -> Optional[Rect]\nGet or set the mouse confinement rectangle of the window."
#define DOC_WINDOW_SIZE "size -> tuple[int, int]\nGet or set the window size in pixels."
#define DOC_WINDOW_MINIMUMSIZE "minimum_size -> tuple[int, int]\nGet or set the minimum size of the window's client area."
#define DOC_WINDOW_MAXIMUMSIZE "maximum_size -> tuple[int, int]\nGet or set the maximum size of the window's client area."
#define DOC_WINDOW_POSITION "position -> tuple[int, int]\nGet or set the window position in screen coordinates."
#define DOC_WINDOW_OPACITY "opacity -> float\nGet or set the window opacity, between 0.0 (fully transparent) and 1.0 (fully opaque)."
#define DOC_WINDOW_OPENGL "opengl() -> bool\nGet if the window supports OpenGL."
#define DOC_WINDOW_UTILITY "utility() -> bool\nGet if the window is an utility window (**read-only**)."
#define DOC_WINDOW_OPENGL "opengl -> bool\nGet if the window supports OpenGL."
#define DOC_WINDOW_UTILITY "utility -> bool\nGet if the window is an utility window (**read-only**)."
#define DOC_WINDOW_FROMDISPLAYMODULE "from_display_module() -> Window\nCreate a Window object using window data from display module."
#define DOC_WINDOW_GETSURFACE "get_surface() -> Surface\nGet the window surface."
#define DOC_WINDOW_FLIP "flip() -> None\nUpdate the display surface to the window."
Expand Down

0 comments on commit 8edbcaf

Please sign in to comment.