diff --git a/docsource/conf.py b/docsource/conf.py index ae11dda..d007f51 100644 --- a/docsource/conf.py +++ b/docsource/conf.py @@ -12,7 +12,7 @@ # import os import sys -sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('../../inkycal')) master_doc = 'index' # -- Project information ----------------------------------------------------- diff --git a/inkycal/display/display.py b/inkycal/display/display.py index 51652a2..70a7a29 100644 --- a/inkycal/display/display.py +++ b/inkycal/display/display.py @@ -44,7 +44,7 @@ class Display: except FileNotFoundError: raise Exception('SPI could not be found. Please check if SPI is enabled') - def render(self, im_black: Image, im_colour=Image or None) -> None: + def render(self, im_black: Image, im_colour:Image or None) -> None: """Renders an image on the selected E-Paper display. Initlializes the E-Paper display, sends image data and executes command @@ -153,7 +153,7 @@ class Display: epaper.sleep() @classmethod - def get_display_size(cls, model_name): + def get_display_size(cls, model_name) -> (int, int): """Returns the size of the display as a tuple -> (width, height) Looks inside "drivers" folder for the given model name, then returns it's diff --git a/inkycal/modules/inky_image.py b/inkycal/modules/inky_image.py index fb6df4e..70ca8fc 100755 --- a/inkycal/modules/inky_image.py +++ b/inkycal/modules/inky_image.py @@ -19,11 +19,11 @@ logger = logging.getLogger(__name__) class Inkyimage: - """Custom Imge class written for commonly used image operations. + """Custom Imgae class written for commonly used image operations. """ def __init__(self, image=None): - """Initialize Inkyimage module""" + """Initialize InkyImage module""" # no image initially self.image = image @@ -114,7 +114,7 @@ class Inkyimage: self.image = image logger.info(f'flipped image by {angle} degrees') - def autoflip(self, layout): + def autoflip(self, layout:str) -> None: """flips the image automatically to the given layout. Args: @@ -215,7 +215,7 @@ class Inkyimage: return image1 - def to_palette(self, palette, dither=True): + def to_palette(self, palette, dither=True) -> (Image, Image): """Maps an image to a given colour palette. Maps each pixel from the image to a colour from the palette. @@ -320,7 +320,7 @@ class Inkyimage: else: im_black = image.convert('1', dither=dither) - im_colour = Image.new(mode='RGB', size=im_black.size, color='white') + im_colour = Image.new(mode='1', size=im_black.size, color='white') logger.info('mapped image to specified palette') @@ -329,3 +329,4 @@ class Inkyimage: if __name__ == '__main__': print(f'running {__name__} in standalone/debug mode') +