2019-02-03 16:26:30 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from PIL import Image, ImageFont
|
2019-04-17 17:30:34 +02:00
|
|
|
from settings import font_boldness, font_size
|
2019-04-13 19:17:14 +02:00
|
|
|
import os
|
2019-02-03 16:26:30 +01:00
|
|
|
im_open = Image.open
|
|
|
|
|
2019-04-13 19:30:15 +02:00
|
|
|
path = os.path.dirname(os.path.abspath(__file__)).replace("\\", "/")
|
2019-04-13 19:17:14 +02:00
|
|
|
if path != "" and path[-1] != "/":
|
|
|
|
path += "/"
|
|
|
|
|
2019-02-03 16:26:30 +01:00
|
|
|
wpath = path+'weather-icons/'
|
|
|
|
opath = path+'other/'
|
2019-04-13 19:17:14 +02:00
|
|
|
fpath = 'fonts/'
|
2019-02-03 16:26:30 +01: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')
|
2019-02-28 22:19:33 +01:00
|
|
|
windicon = im_open(opath+'wi-strong-wind.jpeg')
|
2019-02-28 15:17:43 +01:00
|
|
|
|
2019-03-10 15:37:10 +01:00
|
|
|
fonts = {
|
2019-03-10 15:49:56 +01: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:37:10 +01:00
|
|
|
}
|
|
|
|
|
2019-03-10 15:49:56 +01:00
|
|
|
defaultfont = fonts[font_boldness]
|
2019-04-17 17:30:34 +02:00
|
|
|
defaultfontsize = int(font_size)
|
2019-03-03 10:23:03 +01:00
|
|
|
|
2019-02-03 16:26:30 +01:00
|
|
|
weathericons = {
|
|
|
|
'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',
|
2019-04-05 11:37:51 +02:00
|
|
|
'50n': 'wi-night-alt-cloudy-windy'}
|
|
|
|
|
|
|
|
colors = {
|
|
|
|
"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",
|
|
|
|
]
|