From 8467a554c2a9a309f817bbe9ee9c52710365a3aa Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Fri, 7 Feb 2025 17:31:53 +0100 Subject: [PATCH 1/4] Clarify error message when the atlas is full --- arcade/texture_atlas/uv_data.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arcade/texture_atlas/uv_data.py b/arcade/texture_atlas/uv_data.py index e8b9fee2ec..a83c786274 100644 --- a/arcade/texture_atlas/uv_data.py +++ b/arcade/texture_atlas/uv_data.py @@ -124,7 +124,11 @@ def get_existing_or_free_slot(self, name: str) -> int: return slot except IndexError: raise Exception( - ("No more free slots in the UV texture. " f"Max number of slots: {self._num_slots}") + ( + f"No more free slots in the UV texture." + f"Max number of textures: {self._num_slots}." + "Consider creating a texture atlas with a larger capacity." + ) ) def free_slot_by_name(self, name: str) -> None: From 86ffff9389192a1a5c31ab1de1444ea303c60fe6 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Fri, 7 Feb 2025 17:33:37 +0100 Subject: [PATCH 2/4] Unnecessary f-string --- arcade/texture_atlas/uv_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcade/texture_atlas/uv_data.py b/arcade/texture_atlas/uv_data.py index a83c786274..1cd439c566 100644 --- a/arcade/texture_atlas/uv_data.py +++ b/arcade/texture_atlas/uv_data.py @@ -125,7 +125,7 @@ def get_existing_or_free_slot(self, name: str) -> int: except IndexError: raise Exception( ( - f"No more free slots in the UV texture." + "No more free slots in the UV texture." f"Max number of textures: {self._num_slots}." "Consider creating a texture atlas with a larger capacity." ) From 618a34f03adabacffb1c425d6558bbd74b340353 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Fri, 7 Feb 2025 17:42:20 +0100 Subject: [PATCH 3/4] Fix annotation issues in the draw module --- arcade/draw/line.py | 6 +++--- arcade/draw/polygon.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arcade/draw/line.py b/arcade/draw/line.py index 7473a02b7c..9a34dc0b99 100644 --- a/arcade/draw/line.py +++ b/arcade/draw/line.py @@ -1,7 +1,7 @@ import array from arcade import gl -from arcade.types import Color, Point2List, RGBOrA255 +from arcade.types import Color, Point2List, RGBOrA255, Point2 from arcade.window_commands import get_window from .helpers import _generic_draw_line_strip, get_points_for_thick_line @@ -23,8 +23,8 @@ def draw_line_strip(point_list: Point2List, color: RGBOrA255, line_width: float if line_width == 1: _generic_draw_line_strip(point_list, color, gl.LINE_STRIP) else: - triangle_point_list: Point2List = [] - # This needs a lot of improvement + triangle_point_list: list[Point2] = [] + # FIXME: This needs a lot of improvement last_point = None for point in point_list: if last_point is not None: diff --git a/arcade/draw/polygon.py b/arcade/draw/polygon.py index 25921d3604..92aecf1de1 100644 --- a/arcade/draw/polygon.py +++ b/arcade/draw/polygon.py @@ -1,6 +1,6 @@ from arcade import gl from arcade.earclip import earclip -from arcade.types import Point2List, RGBOrA255 +from arcade.types import Point2List, RGBOrA255, Point2 from .helpers import _generic_draw_line_strip, get_points_for_thick_line @@ -40,7 +40,7 @@ def draw_polygon_outline(point_list: Point2List, color: RGBOrA255, line_width: f new_point_list.append(point_list[0]) # Create a place to store the triangles we'll use to thicken the line - triangle_point_list = [] + triangle_point_list: list[Point2] = [] # This needs a lot of improvement last_point = None From 6efba59cffb6be26eade1fed780b538f781bbb1c Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Fri, 7 Feb 2025 17:44:17 +0100 Subject: [PATCH 4/4] Import sorting --- arcade/draw/line.py | 2 +- arcade/draw/polygon.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arcade/draw/line.py b/arcade/draw/line.py index 9a34dc0b99..a2e232f6ea 100644 --- a/arcade/draw/line.py +++ b/arcade/draw/line.py @@ -1,7 +1,7 @@ import array from arcade import gl -from arcade.types import Color, Point2List, RGBOrA255, Point2 +from arcade.types import Color, Point2, Point2List, RGBOrA255 from arcade.window_commands import get_window from .helpers import _generic_draw_line_strip, get_points_for_thick_line diff --git a/arcade/draw/polygon.py b/arcade/draw/polygon.py index 92aecf1de1..7ea68aa6fd 100644 --- a/arcade/draw/polygon.py +++ b/arcade/draw/polygon.py @@ -1,6 +1,6 @@ from arcade import gl from arcade.earclip import earclip -from arcade.types import Point2List, RGBOrA255, Point2 +from arcade.types import Point2, Point2List, RGBOrA255 from .helpers import _generic_draw_line_strip, get_points_for_thick_line