Commit 44da5d4f authored by Bram Schoenmakers's avatar Bram Schoenmakers

Store the number along with the todo item.

The number represents the position in the backing store, and can be
printed on the stdout to help the user to identify the correct task.
parent e384a348
......@@ -14,8 +14,8 @@ class Todo(TodoBase.TodoBase):
base class, mainly by interpreting the start and due dates of task.
"""
def __init__(self, p_str):
TodoBase.TodoBase.__init__(self, p_str)
def __init__(self, p_str, p_number=-1):
TodoBase.TodoBase.__init__(self, p_str, p_number)
def get_date(self, p_tag):
""" Given a date tag, return a date object. """
......
......@@ -19,9 +19,10 @@ class TodoBase(object):
in a todo item.
"""
def __init__(self, p_src):
def __init__(self, p_src, p_number=-1):
self.src = ""
self.fields = {}
self.number = p_number
self.set_text(p_src)
......
......@@ -45,7 +45,8 @@ class TodoList(object):
"""
if re.search(r'\S', p_src):
todo = Todo.Todo(p_src)
number = len(self._todos) + 1
todo = Todo.Todo(p_src, number)
self._todos.append(todo)
def delete(self, p_number):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment