From ca36269380616617a70964798ae080d2b7bdc366 Mon Sep 17 00:00:00 2001 From: Ace Date: Fri, 12 Jun 2020 18:16:19 +0200 Subject: [PATCH] implemented display orientation option --- inkycal/main.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/inkycal/main.py b/inkycal/main.py index 5b53d59..5810436 100644 --- a/inkycal/main.py +++ b/inkycal/main.py @@ -44,7 +44,11 @@ class Inkycal: self.supports_colour = self.Settings.Layout.supports_colour # Option to flip image upside down - self.upside_down = False + if self.Settings.display_orientation == 'normal': + self.upside_down = False + + elif self.Settings.display_orientation == 'upside_down': + self.upside_down = True # Option to use epaper image optimisation self.optimize = True @@ -122,9 +126,12 @@ class Inkycal: print('You are running inkycal v{}'.format(self._release)) - print('Running inkyal test-run for {} ePaper'.format( + print('Running inkycal test-run for {} ePaper'.format( self.Settings.model)) + if self.upside_down == True: + print('upside-down mode active') + for module in self.active_modules: generate_im = 'self.{0}.generate_image()'.format(module) print('generating image for {} module...'.format(module), end = '') @@ -316,7 +323,7 @@ class Inkycal: buffer = numpy.array(image.convert('RGB')) red, green = buffer[:, :, 0], buffer[:, :, 1] - # grey->black + # grey->black buffer[numpy.logical_and(red <= threshold, green <= threshold)] = [0,0,0] image = Image.fromarray(buffer) return image @@ -326,7 +333,7 @@ class Inkycal: Currently has to be run manually""" self.Display.calibrate() - + def _check_for_updates(self): """Check if a new update is available for inkycal"""