From 94d1a1bc156f8c753f02806f0e54688954800f1a Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sat, 15 Nov 2014 20:44:45 +0000 Subject: [PATCH] Support handling the Inbox project as either sequence or parallel. --- app.json | 5 +++++ nextaction.py | 16 +++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app.json b/app.json index 6c49e49..ce77fcc 100644 --- a/app.json +++ b/app.json @@ -17,6 +17,11 @@ "description": "The number of seconds to wait between syncs.", "value": "5", "required": false + }, + "TODOIST_INBOX_HANDLING": { + "description": "What method to use for the Inbox, sequence or parallel", + "value": "parallel", + "required": false } } } \ No newline at end of file diff --git a/nextaction.py b/nextaction.py index cdf9bd8..d60c9df 100755 --- a/nextaction.py +++ b/nextaction.py @@ -14,6 +14,7 @@ import sys API_TOKEN = os.environ.get('TODOIST_API_KEY', None) NEXT_ACTION_LABEL = os.environ.get('TODOIST_NEXT_ACTION_LABEL', 'next_action') SYNC_DELAY = int(os.environ.get('TODOIST_SYNC_DELAY', '5')) +INBOX_HANDLING = os.environ.get('TODOIST_INBOX_HANDLING', 'parallel') TODOIST_VERSION = '5.3' @@ -172,19 +173,12 @@ class Project(object): return self.name.startswith('Someday') or self.name.startswith('List - ') def IsSequential(self): - ignored = self.IsIgnored() - endsWithEqual = self.name.endswith('=') - validParent = self.parent is None or not self.parent.IsIgnored() - seq = (not ignored) and (not endsWithEqual) and validParent - # if self.name .startsWith('Payer Camille'): - # print startsWithKeyword - # print endsWithEqual - # print parentSequential - # print seq - return seq + return not self.IsIgnored() and \ + not self.IsParallel() and \ + (self.parent is None or not self.parent.IsIgnored()) def IsParallel(self): - return self.name.endswith('=') + return self.name.endswith('=') or (self.name == 'Inbox' and INBOX_HANDLING == 'parallel') SortChildren = Item.__dict__['SortChildren']