fix getting width and height
This commit is contained in:
parent
125110ee51
commit
941f5f0a60
@ -6,6 +6,7 @@ class Chip(metaclass=abc.ABCMeta):
|
|||||||
"""Chip class"""
|
"""Chip class"""
|
||||||
def __init__(self, width, height, driver, auto_flush):
|
def __init__(self, width, height, driver, auto_flush):
|
||||||
self.options = {}
|
self.options = {}
|
||||||
|
self.rotation = 0
|
||||||
self._width = width
|
self._width = width
|
||||||
self._height = height
|
self._height = height
|
||||||
self.driver = driver
|
self.driver = driver
|
||||||
@ -14,12 +15,18 @@ class Chip(metaclass=abc.ABCMeta):
|
|||||||
@property
|
@property
|
||||||
def width(self):
|
def width(self):
|
||||||
"""get width"""
|
"""get width"""
|
||||||
return self._width
|
if self.rotation == 0 or self.rotation == 180:
|
||||||
|
return self._width
|
||||||
|
else:
|
||||||
|
return self._height
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def height(self):
|
def height(self):
|
||||||
"""get height"""
|
"""get height"""
|
||||||
return self._height
|
if self.rotation == 0 or self.rotation == 180:
|
||||||
|
return self._height
|
||||||
|
else:
|
||||||
|
return self._width
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def _converted_background_color(self):
|
def _converted_background_color(self):
|
||||||
|
@ -11,7 +11,6 @@ class ILI9486(Area, Chip):
|
|||||||
def __init__(self, width, height, driver):
|
def __init__(self, width, height, driver):
|
||||||
Chip.__init__(self, width, height, driver, True)
|
Chip.__init__(self, width, height, driver, True)
|
||||||
Area.__init__(self, driver)
|
Area.__init__(self, driver)
|
||||||
self.rotation = 0
|
|
||||||
|
|
||||||
def _converted_background_color(self):
|
def _converted_background_color(self):
|
||||||
"""color from 8-8-8 to 5-6-5"""
|
"""color from 8-8-8 to 5-6-5"""
|
||||||
|
Loading…
Reference in New Issue
Block a user