Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to pyglet==2.1.0 #2487

Merged
merged 13 commits into from
Jan 12, 2025
9 changes: 5 additions & 4 deletions arcade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ def configure_logging(level: int | None = None):
import pyglet

# Enable HiDPI support
if os.environ.get("ARCADE_TEST"):
pyglet.options.dpi_scaling = "real"
else:
pyglet.options.dpi_scaling = "stretch"
# Note: This seems to have changed to 'scale_with_dpi' in pyglet
# if os.environ.get("ARCADE_TEST"):
# pyglet.options['dpi_scaling'] = "real"
# else:
# pyglet.options.dpi_scaling = "stretch"
einarf marked this conversation as resolved.
Show resolved Hide resolved

# Env variable shortcut for headless mode
headless: Final[bool] = bool(os.environ.get("ARCADE_HEADLESS"))
Expand Down
2 changes: 1 addition & 1 deletion arcade/physics_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def walls(self, walls: SpriteList | Iterable[SpriteList] | None = None) -> None:
def walls(self) -> None:
self._walls.clear()

def update(self) -> list[SpriteType]:
def update(self) -> list[BasicSprite]:
"""Move :py:attr:`player_sprite` and return any colliding sprites.
Returns:
Expand Down
4 changes: 2 additions & 2 deletions arcade/sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
from arcade.resources import resolve

if os.environ.get("ARCADE_SOUND_BACKENDS"):
pyglet.options.audio = tuple( # type: ignore
pyglet.options["audio"] = tuple( # type: ignore
v.strip() for v in os.environ["ARCADE_SOUND_BACKENDS"].split(",")
)
else:
pyglet.options.audio = ("openal", "xaudio2", "directsound", "pulse", "silent") # type: ignore
pyglet.options["audio"] = ("openal", "xaudio2", "directsound", "pulse", "silent") # type: ignore

import pyglet.media as media

Expand Down
6 changes: 3 additions & 3 deletions arcade/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def __init__(
color=Color.from_iterable(color),
width=width,
align=align, # type: ignore
bold=bold,
weight=pyglet.text.Weight.BOLD if bold else pyglet.text.Weight.NORMAL,
italic=italic,
multiline=multiline,
rotation=rotation,
Expand Down Expand Up @@ -585,11 +585,11 @@ def bold(self) -> bool | str:
* ``"light"``
"""
return self._label.bold
return self._label.weight == pyglet.text.Weight.BOLD

@bold.setter
def bold(self, bold: bool | str):
self._label.bold = bold
self._label.weight = pyglet.text.Weight.BOLD if bold else pyglet.text.Weight.NORMAL

@property
def italic(self) -> bool | str:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
# at the cost of slow download and constant pip install -I -e .[dev]
# "pyglet@git+https://github.com/pyglet/pyglet.git@development#egg=pyglet",
# Expected future dev preview release on PyPI (not yet released)
"pyglet == 2.1rc1",
"pyglet~=2.1.0",
"pillow~=11.0.0",
"pymunk~=6.9.0",
"pytiled-parser~=2.2.7",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_example_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def check_submodules(parent_module_absolute_name: str) -> None:
It is important to understand that module names and file paths are different things:
* A module name is what Python sees the module's name as (``"arcade.color"``)
* A file path is the location on disk (``C:\\Users\\Reader\\python_project\game.py``)
* A file path is the location on disk (``C:\\Users\\Reader\\python_project\\game.py``)
Args:
parent_module_absolute_name: The absolute import name of the module to check.
Expand Down
Loading