@@ -418,39 +418,38 @@ def __init__(
418
418
self .state = state
419
419
420
420
@property
421
+ @deprecated ("The mouse.pixel attribute is deprecated. Use mouse.position instead." )
421
422
def pixel (self ) -> Point :
422
- warnings .warn (
423
- "The mouse.pixel attribute is deprecated. Use mouse.position instead." ,
424
- DeprecationWarning ,
425
- stacklevel = 2 ,
426
- )
427
423
return self .position
428
424
429
425
@pixel .setter
430
426
def pixel (self , value : Point ) -> None :
431
427
self .position = value
432
428
433
429
@property
430
+ @deprecated (
431
+ "The mouse.tile attribute is deprecated."
432
+ " Use mouse.position of the event returned by context.convert_event instead."
433
+ )
434
434
def tile (self ) -> Point :
435
- warnings .warn (
436
- "The mouse.tile attribute is deprecated. Use mouse.position of the event returned by context.convert_event instead." ,
437
- DeprecationWarning ,
438
- stacklevel = 2 ,
439
- )
440
435
return _verify_tile_coordinates (self ._tile )
441
436
442
437
@tile .setter
438
+ @deprecated (
439
+ "The mouse.tile attribute is deprecated."
440
+ " Use mouse.position of the event returned by context.convert_event instead."
441
+ )
443
442
def tile (self , xy : tuple [float , float ]) -> None :
444
443
self ._tile = Point (* xy )
445
444
446
445
def __repr__ (self ) -> str :
447
- return f"tcod.event.{ self .__class__ .__name__ } (position={ tuple (self .position )!r} , tile={ tuple (self .tile )!r} , state={ MouseButtonMask (self .state )} )"
446
+ return f"tcod.event.{ self .__class__ .__name__ } (position={ tuple (self .position )!r} , tile={ tuple (self ._tile or ( 0 , 0 ) )!r} , state={ MouseButtonMask (self .state )} )"
448
447
449
448
def __str__ (self ) -> str :
450
449
return ("<%s, position=(x=%i, y=%i), tile=(x=%i, y=%i), state=%s>" ) % (
451
450
super ().__str__ ().strip ("<>" ),
452
451
* self .position ,
453
- * self .tile ,
452
+ * ( self ._tile or ( 0 , 0 )) ,
454
453
MouseButtonMask (self .state ),
455
454
)
456
455
@@ -492,41 +491,29 @@ def __init__(
492
491
self ._tile_motion = Point (* tile_motion ) if tile_motion is not None else None
493
492
494
493
@property
494
+ @deprecated ("The mouse.pixel_motion attribute is deprecated. Use mouse.motion instead." )
495
495
def pixel_motion (self ) -> Point :
496
- warnings .warn (
497
- "The mouse.pixel_motion attribute is deprecated. Use mouse.motion instead." ,
498
- DeprecationWarning ,
499
- stacklevel = 2 ,
500
- )
501
496
return self .motion
502
497
503
498
@pixel_motion .setter
499
+ @deprecated ("The mouse.pixel_motion attribute is deprecated. Use mouse.motion instead." )
504
500
def pixel_motion (self , value : Point ) -> None :
505
- warnings .warn (
506
- "The mouse.pixel_motion attribute is deprecated. Use mouse.motion instead." ,
507
- DeprecationWarning ,
508
- stacklevel = 2 ,
509
- )
510
501
self .motion = value
511
502
512
503
@property
504
+ @deprecated (
505
+ "The mouse.tile_motion attribute is deprecated."
506
+ " Use mouse.motion of the event returned by context.convert_event instead."
507
+ )
513
508
def tile_motion (self ) -> Point :
514
- warnings .warn (
515
- "The mouse.tile_motion attribute is deprecated."
516
- " Use mouse.motion of the event returned by context.convert_event instead." ,
517
- DeprecationWarning ,
518
- stacklevel = 2 ,
519
- )
520
509
return _verify_tile_coordinates (self ._tile_motion )
521
510
522
511
@tile_motion .setter
512
+ @deprecated (
513
+ "The mouse.tile_motion attribute is deprecated."
514
+ " Use mouse.motion of the event returned by context.convert_event instead."
515
+ )
523
516
def tile_motion (self , xy : tuple [float , float ]) -> None :
524
- warnings .warn (
525
- "The mouse.tile_motion attribute is deprecated."
526
- " Use mouse.motion of the event returned by context.convert_event instead." ,
527
- DeprecationWarning ,
528
- stacklevel = 2 ,
529
- )
530
517
self ._tile_motion = Point (* xy )
531
518
532
519
@classmethod
0 commit comments