From a8f66fcaba57f15901897496a4ccdcb10c4363fb Mon Sep 17 00:00:00 2001 From: Kyle Benesch <4b796c65+github@gmail.com> Date: Wed, 14 Aug 2024 14:34:43 -0700 Subject: [PATCH] Suppress internal mouse.tile_motion deprecation warning --- CHANGELOG.md | 4 ++++ tcod/context.py | 2 +- tcod/event.py | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efa8f927..2b87ebb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ This project adheres to [Semantic Versioning](https://semver.org/) since version - Keyboard bitmask modifiers `tcod.event.KMOD_*` have been replaced by `tcod.event.Modifier`. +### Fixed + +- Suppressed internal `mouse.tile_motion` deprecation warning. + ## [16.2.3] - 2024-07-16 ### Fixed diff --git a/tcod/context.py b/tcod/context.py index 2132200f..1a2ea21c 100644 --- a/tcod/context.py +++ b/tcod/context.py @@ -265,7 +265,7 @@ def convert_event(self, event: _Event) -> _Event: event.position[0] - event.motion[0], event.position[1] - event.motion[1], ) - event_copy.motion = event.tile_motion = tcod.event.Point( + event_copy.motion = event._tile_motion = tcod.event.Point( event._tile[0] - prev_tile[0], event._tile[1] - prev_tile[1] ) return event_copy diff --git a/tcod/event.py b/tcod/event.py index 29594d7b..48cf9c37 100644 --- a/tcod/event.py +++ b/tcod/event.py @@ -486,7 +486,7 @@ def __init__( ) -> None: super().__init__(position, tile, state) self.motion = Point(*motion) - self.__tile_motion = Point(*tile_motion) if tile_motion is not None else None + self._tile_motion = Point(*tile_motion) if tile_motion is not None else None @property def pixel_motion(self) -> Point: @@ -514,7 +514,7 @@ def tile_motion(self) -> Point: DeprecationWarning, stacklevel=2, ) - return _verify_tile_coordinates(self.__tile_motion) + return _verify_tile_coordinates(self._tile_motion) @tile_motion.setter def tile_motion(self, xy: tuple[int, int]) -> None: @@ -524,7 +524,7 @@ def tile_motion(self, xy: tuple[int, int]) -> None: DeprecationWarning, stacklevel=2, ) - self.__tile_motion = Point(*xy) + self._tile_motion = Point(*xy) @classmethod def from_sdl_event(cls, sdl_event: Any) -> MouseMotion: