naming convention

This commit is contained in:
aceisace
2022-10-02 00:49:27 +02:00
parent 8b0f21a649
commit 4d1ed107b7
29 changed files with 30 additions and 35 deletions

16
inkycal/modules/inky_image.py Normal file → Executable file
View File

@@ -8,14 +8,12 @@ images.
Copyright by aceisace
"""
import logging
import os
import numpy
import requests
from PIL import Image
import requests
import numpy
import os
import logging
from PIL.Image import Resampling
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
@@ -170,7 +168,7 @@ class Inkyimage:
"""Resize an image to desired width or height"""
if self._image_loaded():
if width == None and height == None:
if not width and not height:
logger.error('no height of width specified')
return
@@ -180,7 +178,7 @@ class Inkyimage:
initial_width = image.width
wpercent = (width / float(image.width))
hsize = int((float(image.height) * float(wpercent)))
image = image.resize((width, hsize), Resampling.LANCZOS)
image = image.resize((width, hsize), Image.LANCZOS)
logger.info(f"resized image from {initial_width} to {image.width}")
self.image = image
@@ -188,7 +186,7 @@ class Inkyimage:
initial_height = image.height
hpercent = (height / float(image.height))
wsize = int(float(image.width) * float(hpercent))
image = image.resize((wsize, height), Resampling.LANCZOS)
image = image.resize((wsize, height), Image.LANCZOS)
logger.info(f"resized image from {initial_height} to {image.height}")
self.image = image