E-Paper-Calendar/Calendar/Assets.py

96 lines
2 KiB
Python
Raw Normal View History

#!/usr/bin/python3
# -*- coding: utf-8 -*-
from PIL import Image, ImageFont
from settings import font_boldness, font_size
import os
im_open = Image.open
2019-04-13 19:30:15 +02:00
path = os.path.dirname(os.path.abspath(__file__)).replace("\\", "/")
if path != "" and path[-1] != "/":
path += "/"
2019-07-13 08:05:35 +02:00
wpath = path+'weather-icons/'
opath = path+'other/'
fpath = 'fonts/'
2019-07-13 08:05:35 +02:00
tempicon = im_open(opath+'temperature.jpeg')
humicon = im_open(opath+'humidity.jpeg')
no_response = im_open(opath+'cloud-no-response.jpeg')
sunriseicon = im_open(opath+'wi-sunrise.jpeg')
sunseticon = im_open(opath+'wi-sunset.jpeg')
windicon = im_open(opath+'wi-strong-wind.jpeg')
fonts = {
2019-07-13 08:05:35 +02:00
"extralight": fpath + "Assistant-ExtraLight.otf",
"light": fpath + "Assistant-Light.otf",
"regular": fpath + "Assistant-Regular.otf",
"semibold": fpath + "Assistant-SemiBold.otf",
"bold": fpath + "Assistant-Bold.otf",
"extrabold": fpath + "Assistant-ExtraBold.otf"
}
2019-03-10 15:49:56 +01:00
defaultfont = fonts[font_boldness]
defaultfontsize = int(font_size)
weathericons = {
2019-07-13 08:05:35 +02:00
'01d': 'wi-day-sunny', '02d': 'wi-day-cloudy', '03d': 'wi-cloudy',
'04d': 'wi-cloudy-windy', '09d': 'wi-showers', '10d': 'wi-rain',
'11d': 'wi-thunderstorm', '13d': 'wi-snow', '50d': 'wi-fog',
'01n': 'wi-night-clear', '02n': 'wi-night-cloudy',
'03n': 'wi-night-cloudy', '04n': 'wi-night-cloudy',
'09n': 'wi-night-showers', '10n': 'wi-night-rain',
'11n': 'wi-night-thunderstorm', '13n': 'wi-night-snow',
'50n': 'wi-night-alt-cloudy-windy'}
2019-04-05 11:37:51 +02:00
colors = {
2019-07-13 08:05:35 +02:00
"hl": "red",
"fg": "black",
"bg": "white"
2019-07-12 13:46:50 +02:00
}
supported_img_formats = [
"BMP",
"DIB",
"EPS",
"GIF",
"ICNS",
"ICO",
"IM",
"JPG",
"JPEG",
"J2K",
"J2P",
"JPX",
"MSP",
"PCX",
"PNG",
"PPM",
"SGI",
"SPI",
"TGA",
"TIFF",
"WEBP",
"XBM",
"BLP",
"CUR",
"DCX",
"DDS",
"FLI",
"FLC",
"FPX",
"FTEX",
"GBR",
"GD",
"IMT",
"IPTC",
"NAA",
"MCIDAS",
"MIC",
"MPO",
"PCD",
"PIXAR",
"PSD",
"WAL",
"XPM",
2019-07-13 08:05:35 +02:00
]