Update inkycal_agenda.py

This commit is contained in:
emilyboda 2024-03-15 13:53:26 -04:00 committed by GitHub
parent 0469e75471
commit e8835c736c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -152,7 +152,7 @@ class Agenda(inkycal_module):
time_width = int(max([self.font.getlength( time_width = int(max([self.font.getlength(
events['begin'].format(self.time_format, locale=self.language)) events['begin'].format(self.time_format, locale=self.language))
for events in upcoming_events]) * 1.2) for events in upcoming_events]))
logger.debug(f'time_width: {time_width}') logger.debug(f'time_width: {time_width}')
# Calculate x-pos for time # Calculate x-pos for time
@ -160,7 +160,7 @@ class Agenda(inkycal_module):
logger.debug(f'x-time: {x_time}') logger.debug(f'x-time: {x_time}')
# Find out how much space is left for event titles # Find out how much space is left for event titles
event_width = im_width - time_width - int(date_width/3) event_width = im_width - time_width
logger.debug(f'width for events: {event_width}') logger.debug(f'width for events: {event_width}')
# Calculate x-pos for event titles # Calculate x-pos for event titles
@ -201,16 +201,16 @@ class Agenda(inkycal_module):
# Check if event is all day, if not, add the time # Check if event is all day, if not, add the time
if not parser.all_day(_): if not parser.all_day(_):
write(im_black, (x_time, line_pos[cursor][1]), write(im_black, (x_time, line_pos[cursor][1]),
(time_width, line_height), time+" ", (time_width, line_height), time,
font=self.font, alignment='right') font=self.font, alignment='right')
if parser.all_day(_): if parser.all_day(_):
write(im_black, (x_time, line_pos[cursor][1]), write(im_black, (x_time, line_pos[cursor][1]),
(time_width, line_height), "all day ", (time_width, line_height), "all day",
font=self.font, alignment='right') font=self.font, alignment='right')
write(im_black, (x_event, line_pos[cursor][1]), write(im_black, (x_event, line_pos[cursor][1]),
(event_width, line_height), (event_width, line_height),
'' + title, font=self.font, alignment='left') ' ' + title, font=self.font, alignment='left')
cursor += 1 cursor += 1
# If no events were found, write only dates and lines # If no events were found, write only dates and lines