From b00212a9db224ce49ea5e94d25bff9339cc28965 Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 8 Feb 2022 23:39:29 +0100 Subject: [PATCH 1/3] fix cursor out of range --- inkycal/modules/inkycal_todoist.py | 47 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/inkycal/modules/inkycal_todoist.py b/inkycal/modules/inkycal_todoist.py index e859d34..b0dc26e 100644 --- a/inkycal/modules/inkycal_todoist.py +++ b/inkycal/modules/inkycal_todoist.py @@ -163,35 +163,36 @@ class Todoist(inkycal_module): # Add the parsed todos on the image cursor = 0 for name, todos in grouped.items(): - if todos != []: + if todos: for todo in todos: - line_x, line_y = line_positions[cursor] + if cursor < len(line_positions): + line_x, line_y = line_positions[cursor] - # Add todo project name - write( - im_colour, line_positions[cursor], - (project_width, line_height), - todo['project'], font=self.font, alignment='left') + # Add todo project name + write( + im_colour, line_positions[cursor], + (project_width, line_height), + todo['project'], font=self.font, alignment='left') - # Add todo due if not empty - if todo['due'] != "": + # Add todo due if not empty + if todo['due'] != "": + write( + im_black, + (line_x + project_width, line_y), + (due_width, line_height), + todo['due'], font=self.font, alignment='left') + + # Add todo name write( im_black, - (line_x + project_width, line_y), - (due_width, line_height), - todo['due'], font=self.font, alignment='left') + (line_x+project_width+due_width, line_y), + (im_width-project_width-due_width, line_height), + todo['name'], font=self.font, alignment='left') - # Add todo name - write( - im_black, - (line_x+project_width+due_width, line_y), - (im_width-project_width-due_width, line_height), - todo['name'], font=self.font, alignment='left') - - cursor += 1 - if cursor > max_lines: - logger.error('More todos than available lines') - break + cursor += 1 + else: + logger.error('More todos than available lines') + break # return the images ready for the display return im_black, im_colour From b08a5854249f9128d3f6a53e1d33020d7b385534 Mon Sep 17 00:00:00 2001 From: Ace Date: Wed, 9 Feb 2022 22:16:26 +0100 Subject: [PATCH 2/3] Fix for deleted groups causing Exceptions Deleted groups would previously cause the module to fail as the api would still show todos from groups that have been deleted, but not the name of the group. Iterating over the groups caused a KeyError Exception. This commit does an additional check to see if the group really does exist or has been deleted. --- inkycal/modules/inkycal_todoist.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inkycal/modules/inkycal_todoist.py b/inkycal/modules/inkycal_todoist.py index b0dc26e..27d4fe7 100644 --- a/inkycal/modules/inkycal_todoist.py +++ b/inkycal/modules/inkycal_todoist.py @@ -136,11 +136,14 @@ class Todoist(inkycal_module): 'name':task['content'], 'due':task['due']['string'] if task['due'] != None else "", 'priority':task['priority'], - 'project':all_projects[ task['project_id'] ] + 'project':all_projects[ task['project_id' ] ] if task['project_id'] in all_projects else "deleted" } for task in tasks] - # logger.debug(f'simplified: {simplified}') + # remove groups that have been deleted + simplified = [task for task in simplified if task['project'] != "deleted"] + + logger.debug(f'simplified: {simplified}') # Get maximum width of project names for selected font project_width = int(max([ From dd5d817d77a20ed99f96ce079a503fc825ec3bc0 Mon Sep 17 00:00:00 2001 From: Ace Date: Wed, 9 Feb 2022 22:18:09 +0100 Subject: [PATCH 3/3] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e8f201..2e0c19b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ python

-Inykcal is a software written in python for selected E-Paper displays. It converts these displays into useful information dashboards. It's open-source, free for personal use, fully modular and user-friendly. Despite all this, Inkycal can run well even on the Raspberry Pi Zero. Oh, and it's open for third-party modules! Hooray! +Inkycal is a software written in python for selected E-Paper displays. It converts these displays into useful information dashboards. It's open-source, free for personal use, fully modular and user-friendly. Despite all this, Inkycal can run well even on the Raspberry Pi Zero. Oh, and it's open for third-party modules! Hooray! ## Main features Inkycal is fully modular, you can mix and match any modules you like and configure them on the web-ui. For now, these following built-in modules are supported: