From 25843440b00c8cb5857614f90f81299522e16b41 Mon Sep 17 00:00:00 2001 From: nilamo <7nilamo@gmail.com> Date: Sun, 6 Jun 2021 15:54:37 -0400 Subject: [PATCH] removing print() from core lib --- ppb/camera.py | 5 ++++- ppb/systems/renderer.py | 2 -- ppb/systems/sound.py | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ppb/camera.py b/ppb/camera.py index 4843a4c6..80719e5b 100644 --- a/ppb/camera.py +++ b/ppb/camera.py @@ -7,6 +7,7 @@ The :class:`~ppb.systems.Renderer` inserts a :class:`Camera` into the current scene in response to the :class:`~ppb.events.SceneStarted`. """ +import logging from typing import Tuple from numbers import Real @@ -16,6 +17,8 @@ from ppb.sprites import RectangleShapeMixin from ppb.sprites import Sprite +logger = logging.getLogger(__name__) + def _sprite_has_rectangular_region(sprite): """ @@ -148,7 +151,7 @@ def sprite_in_view(self, sprite: Sprite) -> bool: height = max(self.top, sprite.top) - min(self.bottom, sprite.bottom) max_width = self.width + sprite.width max_height = self.height + sprite.height - print(f"W: {width}, H: {height}, MW: {max_width}, MH: {max_height}") + logger.debug(f"W: {width}, H: {height}, MW: {max_width}, MH: {max_height}") return width < max_width and height < max_height def translate_point_to_screen(self, point: Vector) -> Vector: diff --git a/ppb/systems/renderer.py b/ppb/systems/renderer.py index 3e439224..3a73fc31 100644 --- a/ppb/systems/renderer.py +++ b/ppb/systems/renderer.py @@ -328,10 +328,8 @@ def set_cursor(self, scene): @staticmethod def target_resolution(img_width, img_height, obj_width, obj_height, pixel_ratio): if not obj_width: - print("no width") ratio = img_height / (pixel_ratio * obj_height) elif not obj_height: - print("no height") ratio = img_width / (pixel_ratio * obj_width) else: ratio_w = img_width / (pixel_ratio * obj_width) diff --git a/ppb/systems/sound.py b/ppb/systems/sound.py index 0755e2a7..200350fe 100644 --- a/ppb/systems/sound.py +++ b/ppb/systems/sound.py @@ -1,5 +1,6 @@ import ctypes import io +import logging import time from sdl2 import ( @@ -27,6 +28,8 @@ __all__ = ('SoundController', 'Sound') +logger = logging.getLogger(__name__) + def query_spec(): """ @@ -123,7 +126,8 @@ def __enter__(self): ) mix_call(Mix_Init, MIX_INIT_FLAC | MIX_INIT_MOD | MIX_INIT_MP3 | MIX_INIT_OGG) - print("SoundController", query_spec(), flush=True) + logger.debug("SoundController") + logger.debug(query_spec()) self.allocated_channels = 16