-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtodo.py
64 lines (48 loc) · 1.36 KB
/
todo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Object representing a todo
class Todo:
data = {}
def __init__(self, data = None):
if data:
self.setData(data)
def setData(self, data):
self.data = data
def getData(self):
return self.data
def getDescription(self):
return self.data['description']
def getProject(self):
return self.data['project']
def getContext(self):
return self.data['context']
def getTracksId(self):
return self.data['tracks_id']
def setTracksId(self, tracks_id):
if tracks_id == None:
self.data['tracks_id'] = None
else:
self.data['tracks_id'] = str(tracks_id)
def isDone(self):
return self.data['done']
def setDone(self, done = True):
self.data['done'] = done
def getCompletedDate(self):
if 'completed' in self.data:
return self.data['completed']
else:
return None
def setCompletedDate(self, date):
self.data['completed'] = date
def getTextLine(self):
line = ''
if self.isDone() == True:
line += 'x '
if self.getCompletedDate() != None:
line += self.getCompletedDate() + ' '
line += self.getDescription()
if self.getContext() != 'default':
line += ' @' + self.getContext()
if self.getProject() != 'default':
line += ' +' + self.getProject()
if self.getTracksId() != None:
line += ' tid:' + self.getTracksId()
return line