v.0.5.0 cleanup code, utils ...
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from .emojis import emojis_check
|
||||
from .fonts import fonts_check
|
||||
from .weather import weather_check
|
||||
from .font_checker import Font_Checker
|
||||
|
||||
__all__ = ['emojis_check', 'fonts_check', 'weather_check']
|
||||
__all__ = ['emojis_check', 'Font_Checker', 'weather_check']
|
||||
|
||||
39
app/tryout/font_checker.py
Normal file
39
app/tryout/font_checker.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from app.display.neopixel_64x64 import NeoPixel_64x64
|
||||
from app.utils import align_font, colors
|
||||
import app.display.fonts as fonts
|
||||
|
||||
class Font_Checker():
|
||||
font = fonts.font_3x5
|
||||
|
||||
|
||||
def __init__(self, display: NeoPixel_64x64):
|
||||
self.display = display
|
||||
|
||||
def font_pretty(self, font):
|
||||
pretty_font = align_font(font, debug=False)
|
||||
print(pretty_font)
|
||||
|
||||
def fonts_check(self, pretty=False) -> None:
|
||||
self.display.clear()
|
||||
self.display.set_font(self.font)
|
||||
|
||||
height = self.display.font_height
|
||||
|
||||
alphanum: str = ''.join(sorted(self.font.keys()))
|
||||
|
||||
text_left = alphanum
|
||||
while text_left:
|
||||
# Text entsprechend des Display splitten
|
||||
scr_txt_dict = self.display.screen_text(text=text_left)
|
||||
print(f'scr_txt: {scr_txt_dict}')
|
||||
|
||||
self.display.clear()
|
||||
for idx, row_text in enumerate(scr_txt_dict['visible']):
|
||||
ypos = height * idx
|
||||
# display.clear_row(ypos)
|
||||
self.display.write_text(row_text, 0, ypos, colors.RAINBOW[idx % 6])
|
||||
|
||||
text_left = scr_txt_dict['invisible']
|
||||
|
||||
if pretty:
|
||||
self.font_pretty(self.font)
|
||||
@@ -1,14 +1,20 @@
|
||||
from app.display.fonts.fonts_utils import align_font, screen_text
|
||||
from app.utils import align_font, colors
|
||||
from app.display.neopixel_64x64 import NeoPixel_64x64
|
||||
from app.utils import colors
|
||||
import app.display.fonts as fonts
|
||||
|
||||
font = fonts.font_3x5
|
||||
|
||||
def font_pretty(font):
|
||||
pretty_font = align_font(font, debug=False)
|
||||
print(pretty_font)
|
||||
|
||||
|
||||
def fonts_check(display: NeoPixel_64x64, font, pretty=False) -> None:
|
||||
|
||||
def _do_fonts_check_all(display: NeoPixel_64x64, pretty=False) -> None:
|
||||
pass
|
||||
|
||||
|
||||
def fonts_check(display: NeoPixel_64x64, pretty=False) -> None:
|
||||
display.clear()
|
||||
display.set_font(font)
|
||||
|
||||
@@ -19,7 +25,7 @@ def fonts_check(display: NeoPixel_64x64, font, pretty=False) -> None:
|
||||
text_left = alphanum
|
||||
while text_left:
|
||||
# Text entsprechend des Display splitten
|
||||
scr_txt_dict = screen_text(text=text_left, display=display)
|
||||
scr_txt_dict = display.screen_text(text=text_left)
|
||||
print(f'scr_txt: {scr_txt_dict}')
|
||||
|
||||
display.clear()
|
||||
|
||||
Reference in New Issue
Block a user