v.0.4.5 rm font_height from utils
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from app.display.fonts.fonts_utils import align_font, font_height, char_width, screen_text
|
||||
from app.display.fonts.fonts_utils import align_font, screen_text
|
||||
from app.display.neopixel_64x64 import NeoPixel_64x64
|
||||
import app.utils as utils
|
||||
from app.utils import colors
|
||||
|
||||
|
||||
@@ -13,7 +12,7 @@ def fonts_check(display: NeoPixel_64x64, font, pretty=False) -> None:
|
||||
display.clear()
|
||||
display.set_font(font)
|
||||
|
||||
height = font_height(font)
|
||||
height = display.font_height
|
||||
|
||||
alphanum: str = ''.join(sorted(font.keys()))
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from app.display.neopixel_64x64 import NeoPixel_64x64
|
||||
from app.web.wlan import Wlan
|
||||
import app.utils.colors as colors
|
||||
from app.display.fonts.font_3x5 import font_3x5
|
||||
from app.display.fonts.font_5x7 import font_5x7
|
||||
import app.display.fonts as fonts
|
||||
|
||||
|
||||
def weather_check(display, test_mode: bool = False):
|
||||
def weather_check(display: NeoPixel_64x64, test_mode: bool = False):
|
||||
wlan = Wlan('WOKWI-Guest', '12345678')
|
||||
|
||||
try:
|
||||
@@ -14,30 +14,34 @@ def weather_check(display, test_mode: bool = False):
|
||||
display.clear_row(0, effect=False)
|
||||
|
||||
display.clear()
|
||||
display.set_font(font_3x5)
|
||||
display.write_text('wlan connected', 0, 0, color=colors.RAINBOW[0])
|
||||
display.write_text('querying', 0, 8, color=colors.RAINBOW[1])
|
||||
display.write_text('weather data', 0, 16, color=colors.RAINBOW[2])
|
||||
display.set_font(fonts.font_3x5)
|
||||
ypos = 0
|
||||
display.write_text('wlan connected', 0, ypos, color=colors.RAINBOW[0])
|
||||
ypos += display.font_height + 1
|
||||
display.write_text('querying', 0, ypos, color=colors.RAINBOW[1])
|
||||
ypos += display.font_height + 1
|
||||
display.write_text('weather data', 0, ypos, color=colors.RAINBOW[2])
|
||||
|
||||
w_resp = wlan.actual_weather(lang='en', test_mode=test_mode)
|
||||
|
||||
display.clear()
|
||||
|
||||
delta = 8
|
||||
ypos = 0
|
||||
display.write_text(f'{str(w_resp.location.name).upper()}', 0, ypos, color=colors.RAINBOW[0])
|
||||
display.set_font(font_5x7)
|
||||
ypos += delta
|
||||
display.write_text(f'{str(w_resp.location.name)}', 0, ypos, color=colors.RAINBOW[0])
|
||||
ypos += display.font_height + 1
|
||||
display.set_font(fonts.font_8x8)
|
||||
display.write_text(f'{str(w_resp.current.temp_c)}°C', 0, ypos, color=colors.RAINBOW[1])
|
||||
ypos += delta
|
||||
display.write_text(f'{str(w_resp.current.condition.text)}°C', 0, ypos, color=colors.RAINBOW[1])
|
||||
ypos += delta
|
||||
display.write_text(f'upd:{str(w_resp.current.last_updated)[-5:]}', 0, ypos, color=colors.RAINBOW[2])
|
||||
ypos += delta
|
||||
display.write_text(f'cur:{str(w_resp.location.localtime)[-5:]}', 0, ypos, color=colors.RAINBOW[3])
|
||||
ypos += display.font_height + 1
|
||||
display.set_font(fonts.font_5x7)
|
||||
display.write_text(f'{str(w_resp.current.condition.text)}°C', 0, ypos, color=colors.RAINBOW[2])
|
||||
ypos += display.font_height + 1
|
||||
display.write_text(f'upd:{str(w_resp.current.last_updated)[-5:]}', 0, ypos, color=colors.RAINBOW[3])
|
||||
ypos += display.font_height + 1
|
||||
display.write_text(f'cur:{str(w_resp.location.localtime)[-5:]}', 0, ypos, color=colors.RAINBOW[4])
|
||||
|
||||
ypos += 3 * delta
|
||||
display.write_text('ready.', 30, ypos, color=colors.WHITE)
|
||||
ypos += 3 * (display.font_height + 1)
|
||||
|
||||
display.write_text('done.', 38, ypos, color=colors.WHITE)
|
||||
|
||||
except OSError as e:
|
||||
print(f'Error: connection closed - {e}')
|
||||
|
||||
Reference in New Issue
Block a user