Improve spacing on lights screens

Give additional space for header at top - shrink grid vertically
This commit is contained in:
2024-05-16 23:53:06 +01:00
parent 2d3e8d9224
commit 5976fdb1e8

View File

@@ -115,7 +115,8 @@ class LightsScreen(Screen):
# display up to four lights as defined in env.py # display up to four lights as defined in env.py
# for each defined entity (up to a max total of 4), display its data in a 2x2 grid # for each defined entity (up to a max total of 4), display its data in a 2x2 grid
for i in range(0, len(self.d)): for i in range(0, len(self.d)):
self.__displayLightEntity(lcd, i, lcd.width//2, lcd.height//2, lcd.width//2 * (i % 2), lcd.height//2 * (i//2), self.es[i]["name"], self.d[i]) h = lcd.height - 30
self.__displayLightEntity(lcd, i, lcd.width//2, h//2, lcd.width//2 * (i % 2), h//2 * (i//2) + 30, self.es[i]["name"], self.d[i])
lcd.show() lcd.show()
def __displayLightEntity(self, lcd, i: int, w: int, h: int, xo: int, yo: int, n: str, d) -> None: def __displayLightEntity(self, lcd, i: int, w: int, h: int, xo: int, yo: int, n: str, d) -> None:
@@ -163,7 +164,8 @@ class LightsScreen(Screen):
for i in range(0, len(self.d)): for i in range(0, len(self.d)):
# if its settings have changed, re-draw them without clearing the display # if its settings have changed, re-draw them without clearing the display
if (self.d[i] != self.prev[i]): if (self.d[i] != self.prev[i]):
self.__displayLightEntity(lcd, i, lcd.width//2, lcd.height//2, lcd.width//2 * (i % 2), lcd.height//2 * (i//2), self.es[i]["name"], self.d[i]) h = lcd.height - 30
self.__displayLightEntity(lcd, i, lcd.width//2, h//2, lcd.width//2 * (i % 2), h//2 * (i//2) + 30, self.es[i]["name"], self.d[i])
lcd.show() lcd.show()
def _updateData(self) -> dict: def _updateData(self) -> dict: