From 11b0691078ac81584799a2bc7ff040c495668506 Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:12:12 -0400 Subject: [PATCH 01/13] Temp add 2.1 + comment out 2.0.14 --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0b6abf181d..ef22d9987a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,8 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules" ] dependencies = [ - "pyglet>=2.0.14,<2.1", + "pyglet == 2.1dev1", + # "pyglet>=2.0.14,<2.1", "pillow~=10.2.0", "pymunk~=6.6.0", "pytiled-parser~=2.2.3" From 26053e223d30aa9849399b151520e081a1e65737 Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:29:26 -0400 Subject: [PATCH 02/13] Import from pyglet.display instead of pyglet.canvas --- arcade/application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcade/application.py b/arcade/application.py index 10abb5c880..228461d44a 100644 --- a/arcade/application.py +++ b/arcade/application.py @@ -13,7 +13,7 @@ import pyglet.gl as gl import pyglet.window.mouse -from pyglet.canvas.base import ScreenMode +from pyglet.display.base import ScreenMode import arcade from arcade import get_display_size From dea54418003240dfca002c38e8eb533e42683a65 Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:30:43 -0400 Subject: [PATCH 03/13] change pyglet.display to canvas in a second place --- arcade/application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcade/application.py b/arcade/application.py index 228461d44a..8c9f2da2f6 100644 --- a/arcade/application.py +++ b/arcade/application.py @@ -152,7 +152,7 @@ def __init__( blue_size=8, alpha_size=8, ) - display = pyglet.canvas.get_display() + display = pyglet.display.get_display() screen = display.get_default_screen() if screen: config = screen.get_best_config(config) From 9f6bbabf3d1daaccefdd9db74e5bfb4ae65ef4bb Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Thu, 4 Apr 2024 03:27:18 -0400 Subject: [PATCH 04/13] Remove commented out old versions of pyglet --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ef22d9987a..98ca82f7cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,6 @@ classifiers = [ ] dependencies = [ "pyglet == 2.1dev1", - # "pyglet>=2.0.14,<2.1", "pillow~=10.2.0", "pymunk~=6.6.0", "pytiled-parser~=2.2.3" From 4ba9f84ece378d2b6f582a9c00762a60cc1d7f85 Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Thu, 4 Apr 2024 05:41:48 -0400 Subject: [PATCH 05/13] Replace pyglet.canvas in clock_window --- arcade/experimental/clock/clock_window.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arcade/experimental/clock/clock_window.py b/arcade/experimental/clock/clock_window.py index 3b2dd061c5..f51138307f 100644 --- a/arcade/experimental/clock/clock_window.py +++ b/arcade/experimental/clock/clock_window.py @@ -19,7 +19,7 @@ import pyglet.gl as gl import pyglet.window.mouse -from pyglet.canvas.base import ScreenMode +from pyglet.display.base import ScreenMode import arcade from arcade import get_display_size @@ -70,7 +70,7 @@ class for more info. :param antialiasing: Should OpenGL's anti-aliasing be enabled? :param gl_version: What OpenGL version to request. This is ``(3, 3)`` by default \ and can be overridden when using more advanced OpenGL features. - :param screen: Pass a pyglet :py:class:`~pyglet.canvas.Screen` to + :param screen: Pass a pyglet :py:class:`~pyglet.display.Screen` to request the window be placed on it. See `pyglet's window size & position guide `_ to learn more. :param style: Request a non-default window style, such as borderless. @@ -141,7 +141,7 @@ def __init__( blue_size=8, alpha_size=8, ) - display = pyglet.canvas.get_display() + display = pyglet.display.get_display() screen = display.get_default_screen() if screen: config = screen.get_best_config(config) From ba7a984dc9ccb9793489b5a1ce99d978e4fe2f98 Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Thu, 4 Apr 2024 05:45:22 -0400 Subject: [PATCH 06/13] Replace display.canvas in get_dispaly_size --- arcade/window_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcade/window_commands.py b/arcade/window_commands.py index a233c2d25d..6b64cb4202 100644 --- a/arcade/window_commands.py +++ b/arcade/window_commands.py @@ -49,7 +49,7 @@ def get_display_size(screen_id: int = 0) -> Tuple[int, int]: :param screen_id: The screen number :return: Tuple containing the width and height of the screen """ - display = pyglet.canvas.Display() + display = pyglet.display.Display() screen = display.get_screens()[screen_id] return screen.width, screen.height From c9f37ccc6a2ab8a1fc716597bab93995a0d51208 Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Thu, 4 Apr 2024 05:47:10 -0400 Subject: [PATCH 07/13] Remove canvas from type annotation in clock_window --- arcade/experimental/clock/clock_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcade/experimental/clock/clock_window.py b/arcade/experimental/clock/clock_window.py index f51138307f..edad115b4a 100644 --- a/arcade/experimental/clock/clock_window.py +++ b/arcade/experimental/clock/clock_window.py @@ -97,7 +97,7 @@ def __init__( update_rate: float = 1 / 60, antialiasing: bool = True, gl_version: Tuple[int, int] = (3, 3), - screen: Optional[pyglet.canvas.Screen] = None, + screen: Optional[pyglet.display.Screen] = None, style: Optional[str] = pyglet.window.Window.WINDOW_STYLE_DEFAULT, visible: bool = True, vsync: bool = False, From 35b11fe80976072fec520b4565cf2837d3b465cd Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Thu, 4 Apr 2024 05:48:00 -0400 Subject: [PATCH 08/13] Replace pyglet.canvas usage in application.py --- arcade/application.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arcade/application.py b/arcade/application.py index 8c9f2da2f6..8276a76dc6 100644 --- a/arcade/application.py +++ b/arcade/application.py @@ -54,7 +54,7 @@ def get_screens() -> List: :returns: List of screens, one for each monitor. """ - display = pyglet.canvas.get_display() + display = pyglet.display.get_display() return display.get_screens() @@ -83,7 +83,7 @@ class Window(pyglet.window.Window): :param antialiasing: Should OpenGL's anti-aliasing be enabled? :param gl_version: What OpenGL version to request. This is ``(3, 3)`` by default \ and can be overridden when using more advanced OpenGL features. - :param screen: Pass a pyglet :py:class:`~pyglet.canvas.Screen` to + :param screen: Pass a pyglet :py:class:`~pyglet.display.Screen` to request the window be placed on it. See `pyglet's window size & position guide `_ to learn more. :param style: Request a non-default window style, such as borderless. @@ -110,7 +110,7 @@ def __init__( update_rate: float = 1 / 60, antialiasing: bool = True, gl_version: Tuple[int, int] = (3, 3), - screen: Optional[pyglet.canvas.Screen] = None, + screen: Optional[pyglet.display.Screen] = None, style: Optional[str] = pyglet.window.Window.WINDOW_STYLE_DEFAULT, visible: bool = True, vsync: bool = False, From a8f19b6c35dfa6fde4aeb3be9b88c00806d48080 Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Thu, 4 Apr 2024 05:55:43 -0400 Subject: [PATCH 09/13] Attempt to fix text layout --- arcade/gui/widgets/text.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arcade/gui/widgets/text.py b/arcade/gui/widgets/text.py index 254d4bfc53..2d783c7f97 100644 --- a/arcade/gui/widgets/text.py +++ b/arcade/gui/widgets/text.py @@ -352,7 +352,10 @@ def __init__( ) self.layout = pyglet.text.layout.IncrementalTextLayout( - self.doc, int(width - self.LAYOUT_OFFSET), int(height), multiline=multiline + self.doc, + x=x + self.LAYOUT_OFFSET, y=y, z=0.0, # Position + width=width - self.LAYOUT_OFFSET, height=height, # Size + multiline=multiline ) self.layout.x += self.LAYOUT_OFFSET self.caret = Caret(self.layout, color=Color.from_iterable(caret_color)) From 77d684aede61b05c77cf143053f84caad4ff3f4f Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Thu, 4 Apr 2024 06:00:00 -0400 Subject: [PATCH 10/13] Fix whitespace in gui's text.py --- arcade/gui/widgets/text.py | 1 - 1 file changed, 1 deletion(-) diff --git a/arcade/gui/widgets/text.py b/arcade/gui/widgets/text.py index 2d783c7f97..1b6c613ecf 100644 --- a/arcade/gui/widgets/text.py +++ b/arcade/gui/widgets/text.py @@ -357,7 +357,6 @@ def __init__( width=width - self.LAYOUT_OFFSET, height=height, # Size multiline=multiline ) - self.layout.x += self.LAYOUT_OFFSET self.caret = Caret(self.layout, color=Color.from_iterable(caret_color)) self.caret.visible = False From aa49c3ac6a3f7428ce1caf5bca24a18407827995 Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Thu, 4 Apr 2024 06:16:21 -0400 Subject: [PATCH 11/13] Fix type issue from Literal usage in pyglet via type: ignore --- arcade/text.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arcade/text.py b/arcade/text.py index e929296ac2..900ee45a71 100644 --- a/arcade/text.py +++ b/arcade/text.py @@ -213,8 +213,9 @@ def __init__( z=z, font_name=adjusted_font, font_size=font_size, - anchor_x=anchor_x, - anchor_y=anchor_y, + # use type: ignore since cast is slow & pyglet used Literal + anchor_x=anchor_x, # type: ignore + anchor_y=anchor_y, # type: ignore color=Color.from_iterable(color), width=width, align=align, From 231a3c2745a14c99a06f5ff6edcfb27c16a137d4 Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Sat, 13 Apr 2024 21:21:52 -0400 Subject: [PATCH 12/13] Use pyglet==2.1dev2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 98ca82f7cb..d7799366bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules" ] dependencies = [ - "pyglet == 2.1dev1", + "pyglet == 2.1dev2", "pillow~=10.2.0", "pymunk~=6.6.0", "pytiled-parser~=2.2.3" From be441183891fe6944076568b2b8fed2a985f9ceb Mon Sep 17 00:00:00 2001 From: pushfoo <36696816+pushfoo@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:59:58 -0400 Subject: [PATCH 13/13] Temp pre-float width/height pyright fix --- arcade/gui/widgets/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcade/gui/widgets/text.py b/arcade/gui/widgets/text.py index 1b6c613ecf..8b90cb3f11 100644 --- a/arcade/gui/widgets/text.py +++ b/arcade/gui/widgets/text.py @@ -354,7 +354,7 @@ def __init__( self.layout = pyglet.text.layout.IncrementalTextLayout( self.doc, x=x + self.LAYOUT_OFFSET, y=y, z=0.0, # Position - width=width - self.LAYOUT_OFFSET, height=height, # Size + width=int(width - self.LAYOUT_OFFSET), height=int(height), # Size multiline=multiline ) self.caret = Caret(self.layout, color=Color.from_iterable(caret_color))