From fd48d75077438508ad9c7e261a556d82aaf8ac61 Mon Sep 17 00:00:00 2001 From: Ace Date: Mon, 25 Feb 2019 22:03:28 +0100 Subject: [PATCH] General improvements Added 2 more lines for events below the Calendar which is utilised when there is free space below the monthly Calendar. --- Calendar/icon_positions_locations.py | 128 +++++++++++++++------------ 1 file changed, 69 insertions(+), 59 deletions(-) diff --git a/Calendar/icon_positions_locations.py b/Calendar/icon_positions_locations.py index 87207c4..44aaf1c 100644 --- a/Calendar/icon_positions_locations.py +++ b/Calendar/icon_positions_locations.py @@ -1,28 +1,36 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -from PIL import Image, ImageFont -from settings import * +""" +This file contains all the locations of the icons used. +It also contains the positions of these icons on the E-Paper display +""" + +from PIL import Image +from settings import language im_open = Image.open -path = '/home/pi/E-Paper-Master/Calendar/' -wpath = path+'weather-icons/' -mpath = path+'translations/'+language+'/months/' -weekpath = path+'translations/'+language+'/week/' -dpath = path+'days/' -opath = path+'other/' +path = '/home/pi/E-Paper-Master/Calendar/' +wpath = path+'weather-icons/' +mpath = path+'translations/'+language+'/months/' +weekpath = path+'translations/'+language+'/week/' +dpath = path+'days/' +opath = path+'other/' -weekday = im_open(opath+'weekday.bmp').convert('L') -eventicon = im_open(opath+'event.bmp').convert('L') -dateicon = im_open(opath+'today.bmp').convert('L') -tempicon = im_open(opath+'temperature.jpeg') -humicon = im_open(opath+'humidity.jpeg') -weekmon = im_open(weekpath+'week-mon.jpeg') -weeksun = im_open(weekpath+'week-sun.jpeg') -seperator = im_open(opath+'seperator.jpeg').convert('L') -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') +weekday = im_open(opath+'weekday.bmp').convert('L') +eventicon = im_open(opath+'event.bmp').convert('L') +dateicon = im_open(opath+'today.bmp').convert('L') +tempicon = im_open(opath+'temperature.jpeg') +humicon = im_open(opath+'humidity.jpeg') +weekmon = im_open(weekpath+'week-mon.jpeg') +weeksun = im_open(weekpath+'week-sun.jpeg') +seperator = im_open(opath+'seperator.jpeg').convert('L') +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') +black = im_open(opath+'black.jpeg') +white = im_open(opath+'white.jpeg') +red = im_open(opath+'red.jpeg') wiconplace = (0, 0) tempplace = (299, 0) @@ -37,19 +45,22 @@ sunsetplace = (214, 35) e_col = 70 date_col = 0 -e_row_1 = 540 -e_row_2 = 565 -e_row_3 = 590 -e_row_4 = 615 +e_row_1 = 490 +e_row_2 = 515 +e_row_3 = 540 +e_row_4 = 565 +e_row_5 = 590 +e_row_6 = 615 event_positions = { -'e1': (e_col, e_row_1), 'e2': (e_col, e_row_2), 'e3': (e_col, e_row_3), -'e4': (e_col, e_row_4) + 'e1': (e_col, e_row_1), 'e2': (e_col, e_row_2), 'e3': (e_col, e_row_3), + 'e4': (e_col, e_row_4), 'e5': (e_col, e_row_5), 'e6': (e_col, e_row_6) } date_positions = { -'d1': (date_col, e_row_1), 'd2': (date_col, e_row_2), 'd3': (date_col, e_row_3), -'d4': (date_col, e_row_4) + 'd1': (date_col, e_row_1), 'd2': (date_col, e_row_2), + 'd3': (date_col, e_row_3), 'd4': (date_col, e_row_4), + 'd5': (date_col, e_row_5), 'd6': (date_col, e_row_6) } col1 = 3 @@ -68,47 +79,46 @@ row5 = 414 row6 = 477 positions = { -'a1': (col1, row1), 'a2': (col2, row1), 'a3': (col3, row1), 'a4': (col4, row1), -'a5': (col5, row1), 'a6': (col6, row1), 'a7': (col7, row1), + 'a1': (col1, row1), 'a2': (col2, row1), 'a3': (col3, row1), 'a4': (col4, row1), + 'a5': (col5, row1), 'a6': (col6, row1), 'a7': (col7, row1), -'b1': (col1, row2), 'b2': (col2, row2), 'b3': (col3, row2), 'b4': (col4, row2), -'b5': (col5, row2), 'b6': (col6, row2), 'b7': (col7, row2), + 'b1': (col1, row2), 'b2': (col2, row2), 'b3': (col3, row2), 'b4': (col4, row2), + 'b5': (col5, row2), 'b6': (col6, row2), 'b7': (col7, row2), -'c1': (col1, row3), 'c2': (col2, row3), 'c3': (col3, row3), 'c4': (col4, row3), -'c5': (col5, row3), 'c6': (col6, row3), 'c7': (col7, row3), + 'c1': (col1, row3), 'c2': (col2, row3), 'c3': (col3, row3), 'c4': (col4, row3), + 'c5': (col5, row3), 'c6': (col6, row3), 'c7': (col7, row3), -'d1': (col1, row4), 'd2': (col2, row4), 'd3': (col3, row4), 'd4': (col4, row4), -'d5': (col5, row4), 'd6': (col6, row4), 'd7': (col7, row4), + 'd1': (col1, row4), 'd2': (col2, row4), 'd3': (col3, row4), 'd4': (col4, row4), + 'd5': (col5, row4), 'd6': (col6, row4), 'd7': (col7, row4), -'e1': (col1, row5), 'e2': (col2, row5), 'e3': (col3, row5), 'e4': (col4, row5), -'e5': (col5, row5), 'e6': (col6, row5), 'e7': (col7, row5), + 'e1': (col1, row5), 'e2': (col2, row5), 'e3': (col3, row5), 'e4': (col4, row5), + 'e5': (col5, row5), 'e6': (col6, row5), 'e7': (col7, row5), -'f1': (col1, row6), 'f2': (col2, row6), 'f3': (col3, row6), 'f4': (col4, row6), -'f5': (col5, row6), 'f6': (col6, row6), 'f7': (col7, row6) -} + 'f1': (col1, row6), 'f2': (col2, row6), 'f3': (col3, row6), 'f4': (col4, row6), + 'f5': (col5, row6), 'f6': (col6, row6), 'f7': (col7, row6) + } week_row = 134 weekdaysmon = { -'Mon': (col1,week_row), 'Tue': (col2,week_row), 'Wed': (col3,week_row), -'Thu': (col4,week_row), 'Fri': (col5,week_row), 'Sat': (col6,week_row), -'Sun': (col7,week_row) -} + 'Mon': (col1, week_row), 'Tue': (col2, week_row), 'Wed': (col3, week_row), + 'Thu': (col4, week_row), 'Fri': (col5, week_row), 'Sat': (col6, week_row), + 'Sun': (col7, week_row) + } weekdayssun = { -'Sun': (col1,week_row), 'Mon': (col2,week_row), 'Tue': (col3,week_row), -'Wed': (col4,week_row), 'Thu': (col5,week_row), 'Fri': (col6,week_row), -'Sat': (col7,week_row) -} - - + 'Sun': (col1, week_row), 'Mon': (col2, week_row), 'Tue': (col3, week_row), + 'Wed': (col4, week_row), 'Thu': (col5, week_row), 'Fri': (col6, week_row), + 'Sat': (col7, week_row) + } 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', -'50n': 'wi-night-alt-cloudy-windy'} + '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' + }