Clean up
11
.gitignore
vendored
@ -1,10 +1,11 @@
|
||||
/__pycache__/
|
||||
|
||||
# Effie's python environment
|
||||
/bin
|
||||
/include
|
||||
/lib
|
||||
/lib64
|
||||
pyvenv.cfg
|
||||
/bin/
|
||||
/include/
|
||||
/lib/
|
||||
/lib64/
|
||||
/pyvenv.cfg
|
||||
|
||||
/test*.png
|
||||
/cache.sqlite
|
||||
|
||||
15
__main__.py
@ -1,10 +1,6 @@
|
||||
from datetime import datetime
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
def scale_to_height(icon):
|
||||
scale = 100 / icon.height
|
||||
return icon.resize((int(icon.width * scale), int(icon.height * scale)))
|
||||
|
||||
BLACK = 0x000000 # 00 BGR
|
||||
WHITE = 0xffffff # 01
|
||||
YELLOW = 0x00ffff # 10
|
||||
@ -18,9 +14,8 @@ fonttime = ImageFont.truetype('NETWORKSANS-2019-REGULAR.TTF', 92)
|
||||
image = Image.new('RGB', (800, 480), WHITE)
|
||||
draw = ImageDraw.Draw(image)
|
||||
|
||||
|
||||
# Backing image
|
||||
with Image.open('ui test 2.png').convert('RGBA') as bg:
|
||||
with Image.open('assets/ui test 2.png').convert('RGBA') as bg:
|
||||
image.paste(bg, (0, 0))
|
||||
|
||||
# Time
|
||||
@ -43,12 +38,12 @@ draw.text((123, 237), f'{temphigh}', font=font42, anchor="ms", fill=WHITE)
|
||||
rainfall = 3
|
||||
rainthreshold = 5
|
||||
if rainfall > rainthreshold:
|
||||
rainimgpath = 'rain.png'
|
||||
rainimgpath = 'assets/rain.png'
|
||||
else:
|
||||
rainimgpath = 'sun.png'
|
||||
rainimgpath = 'assets/sun.png'
|
||||
draw.text((40, 0), f'{rainfall}', font=font64, anchor="mt")
|
||||
with Image.open(rainimgpath) as rainimg:
|
||||
image.paste(rainimg,mask=rainimg)
|
||||
image.paste(rainimg, mask=rainimg)
|
||||
draw.text((40, 55), f'mm', font=fontmm, anchor="mt")
|
||||
|
||||
image.save('test_before_palette.png')
|
||||
@ -60,7 +55,7 @@ pal_image.putpalette((0x00,0x00,0x00, 0xff,0xff,0xff, 0xff,0xff,0x00, 0xff,0x00,
|
||||
image_4color = image.quantize(palette=pal_image, dither=Image.NONE)
|
||||
image_4color.save('test_after_palette.png')
|
||||
|
||||
show_on_screen = False
|
||||
show_on_screen = True
|
||||
if show_on_screen:
|
||||
import epd7in3g as epd
|
||||
try:
|
||||
|
||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
BIN
icon_bus.png
|
Before Width: | Height: | Size: 31 KiB |
BIN
icon_train.png
|
Before Width: | Height: | Size: 27 KiB |
BIN
icon_tram.png
|
Before Width: | Height: | Size: 32 KiB |
@ -1,4 +1,5 @@
|
||||
colorzero==2.0
|
||||
gpiozero==2.0.1
|
||||
lgpio==0.2.2.0
|
||||
pillow==11.2.1
|
||||
spidev==3.6
|
||||
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |