fix tests
This commit is contained in:
parent
d927b8ebf6
commit
a7f3622e52
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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))
|
||||
|
||||
|
@ -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)
|
||||
|
@ -40,11 +40,9 @@ pytz==2023.3.post1
|
||||
PyYAML==6.0.1
|
||||
recurring-ical-events==2.1.1
|
||||
requests==2.31.0
|
||||
RPi.GPIO==0.7.1
|
||||
sgmllib3k==1.0.0
|
||||
six==1.16.0
|
||||
soupsieve==2.5
|
||||
spidev==3.5
|
||||
todoist-api-python==2.1.3
|
||||
types-python-dateutil==2.8.19.20240106
|
||||
typing_extensions==4.8.0
|
||||
|
@ -14,7 +14,7 @@ from tests import Config
|
||||
preview = Inkyimage.preview
|
||||
merge = Inkyimage.merge
|
||||
|
||||
url ="https://github.com/aceinnolab/Inkycal/blob/assets/tests/Inkycal_cover.png"
|
||||
url ="https://raw.githubusercontent.com/aceinnolab/Inkycal/assets/tests/Inkycal_cover.png"
|
||||
|
||||
im = Image.open(requests.get(url, stream=True).raw)
|
||||
im.save("test.png", "PNG")
|
||||
|
Loading…
Reference in New Issue
Block a user