fix tests

This commit is contained in:
Ace
2024-02-10 22:43:57 +01:00
parent d927b8ebf6
commit a7f3622e52
7 changed files with 11 additions and 13 deletions

View File

@@ -255,7 +255,7 @@ def image_to_palette(
else:
logger.error("The given palette is unsupported.")
raise ValueError("The given palette is not supported.")
raise ValueError(f"The given palette ({palette}) is not supported.")
if pal:
# The palette needs to have 256 colors, for this, the black-colour

View File

@@ -79,7 +79,7 @@ class Inkyimage(inkycal_module):
im.resize(width=im_width, height=im_height)
# convert images according to specified palette
im_black, im_colour = image_to_palette(image=im, palette=self.palette, dither=self.dither)
im_black, im_colour = image_to_palette(image=im.image.convert("RGB"), palette=self.palette, dither=self.dither)
# with the images now send, clear the current image
im.clear()

View File

@@ -6,7 +6,7 @@ import glob
from inkycal.custom import *
# PIL has a class named Image, use alias for Inkyimage -> Images
from inkycal.modules.inky_image import Inkyimage as Images
from inkycal.modules.inky_image import Inkyimage as Images, image_to_palette
from inkycal.modules.template import inkycal_module
logger = logging.getLogger(__name__)
@@ -118,7 +118,7 @@ class Slideshow(inkycal_module):
im.resize(width=im_width, height=im_height)
# convert images according to specified palette
im_black, im_colour = im.to_palette(self.palette)
im_black, im_colour = image_to_palette(im.image.convert("RGB"), self.palette)
# with the images now send, clear the current image
im.clear()

View File

@@ -6,7 +6,7 @@ by https://github.com/worstface
from htmlwebshot import WebShot
from inkycal.custom import *
from inkycal.modules.inky_image import Inkyimage as Images
from inkycal.modules.inky_image import Inkyimage as Images, image_to_palette
from inkycal.modules.template import inkycal_module
from tests import Config
@@ -145,7 +145,7 @@ class Webshot(inkycal_module):
im.resize(width=int(im.image.width * imageScale), height=webshotHeight)
im_webshot_black, im_webshot_colour = im.to_palette(self.palette)
im_webshot_black, im_webshot_colour = image_to_palette(im.image.convert("RGB"), self.palette)
webshotCenterPosY = int((im_height / 2) - (im.image.height / 2))

View File

@@ -6,7 +6,7 @@ by https://github.com/worstface
import xkcd
from inkycal.custom import *
from inkycal.modules.inky_image import Inkyimage as Images
from inkycal.modules.inky_image import Inkyimage as Image2, image_to_palette
from inkycal.modules.template import inkycal_module
logger = logging.getLogger(__name__)
@@ -24,7 +24,7 @@ class Xkcd(inkycal_module):
"default": "latest"
},
"palette": {
"label": "Which color palette should be used for the comic images?",
"label": "Which color palette should be used for the comic Image2?",
"options": ["bw", "bwr", "bwy"]
},
"alt": {
@@ -149,7 +149,7 @@ class Xkcd(inkycal_module):
comicSpaceBlack = Image.new('RGBA', (im_width, im_height), (255, 255, 255, 255))
comicSpaceColour = Image.new('RGBA', (im_width, im_height), (255, 255, 255, 255))
im = Images()
im = Image2()
im.load(f"{tmpPath}/xkcdComic.png")
im.remove_alpha()
@@ -170,7 +170,7 @@ class Xkcd(inkycal_module):
im.resize(width=int(im.image.width * imageScale), height=comicHeight)
im_comic_black, im_comic_colour = im.to_palette(self.palette)
im_comic_black, im_comic_colour = image_to_palette(im.image.convert("RGB"), self.palette)
headerCenterPosY = int((im_height / 2) - ((im.image.height + headerHeight + altHeight) / 2))
comicCenterPosY = int((im_height / 2) - ((im.image.height + headerHeight + altHeight) / 2) + headerHeight)