Support handling the Inbox project as either sequence or parallel.

master
Andrew Williams 2014-11-15 20:44:45 +00:00
parent 2e25d88031
commit 94d1a1bc15
2 changed files with 10 additions and 11 deletions

View File

@ -17,6 +17,11 @@
"description": "The number of seconds to wait between syncs.", "description": "The number of seconds to wait between syncs.",
"value": "5", "value": "5",
"required": false "required": false
},
"TODOIST_INBOX_HANDLING": {
"description": "What method to use for the Inbox, sequence or parallel",
"value": "parallel",
"required": false
} }
} }
} }

View File

@ -14,6 +14,7 @@ import sys
API_TOKEN = os.environ.get('TODOIST_API_KEY', None) API_TOKEN = os.environ.get('TODOIST_API_KEY', None)
NEXT_ACTION_LABEL = os.environ.get('TODOIST_NEXT_ACTION_LABEL', 'next_action') NEXT_ACTION_LABEL = os.environ.get('TODOIST_NEXT_ACTION_LABEL', 'next_action')
SYNC_DELAY = int(os.environ.get('TODOIST_SYNC_DELAY', '5')) SYNC_DELAY = int(os.environ.get('TODOIST_SYNC_DELAY', '5'))
INBOX_HANDLING = os.environ.get('TODOIST_INBOX_HANDLING', 'parallel')
TODOIST_VERSION = '5.3' TODOIST_VERSION = '5.3'
@ -172,19 +173,12 @@ class Project(object):
return self.name.startswith('Someday') or self.name.startswith('List - ') return self.name.startswith('Someday') or self.name.startswith('List - ')
def IsSequential(self): def IsSequential(self):
ignored = self.IsIgnored() return not self.IsIgnored() and \
endsWithEqual = self.name.endswith('=') not self.IsParallel() and \
validParent = self.parent is None or not self.parent.IsIgnored() (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
def IsParallel(self): def IsParallel(self):
return self.name.endswith('=') return self.name.endswith('=') or (self.name == 'Inbox' and INBOX_HANDLING == 'parallel')
SortChildren = Item.__dict__['SortChildren'] SortChildren = Item.__dict__['SortChildren']