fix getting width and height

This commit is contained in:
Bartosz Kościów 2017-05-22 16:11:08 +02:00
parent 125110ee51
commit 941f5f0a60
2 changed files with 9 additions and 3 deletions

View File

@ -6,6 +6,7 @@ class Chip(metaclass=abc.ABCMeta):
"""Chip class"""
def __init__(self, width, height, driver, auto_flush):
self.options = {}
self.rotation = 0
self._width = width
self._height = height
self.driver = driver
@ -14,12 +15,18 @@ class Chip(metaclass=abc.ABCMeta):
@property
def width(self):
"""get width"""
if self.rotation == 0 or self.rotation == 180:
return self._width
else:
return self._height
@property
def height(self):
"""get height"""
if self.rotation == 0 or self.rotation == 180:
return self._height
else:
return self._width
@abc.abstractmethod
def _converted_background_color(self):

View File

@ -11,7 +11,6 @@ class ILI9486(Area, Chip):
def __init__(self, width, height, driver):
Chip.__init__(self, width, height, driver, True)
Area.__init__(self, driver)
self.rotation = 0
def _converted_background_color(self):
"""color from 8-8-8 to 5-6-5"""