Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
611694ed
Commit
611694ed
authored
Oct 12, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create access function for the todo number.
A step to get rid of todo.attributes["number"].
parent
c1726616
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
TodoList.py
TodoList.py
+9
-6
No files found.
TodoList.py
View file @
611694ed
...
@@ -64,19 +64,19 @@ class TodoList(object):
...
@@ -64,19 +64,19 @@ class TodoList(object):
dep_id
=
p_todo
.
tag_value
(
'id'
)
dep_id
=
p_todo
.
tag_value
(
'id'
)
# maintain dependency graph
# maintain dependency graph
if
dep_id
:
if
dep_id
:
self
.
_depgraph
.
add_node
(
p_todo
.
attributes
[
'number'
]
)
self
.
_depgraph
.
add_node
(
self
.
number
(
p_todo
)
)
# connect all tasks we have in memory so far that refer to this
# connect all tasks we have in memory so far that refer to this
# task
# task
for
dep
in
\
for
dep
in
\
[
dep
for
dep
in
self
.
_todos
if
dep
.
has_tag
(
'p'
,
dep_id
)]:
[
dep
for
dep
in
self
.
_todos
if
dep
.
has_tag
(
'p'
,
dep_id
)]:
self
.
_depgraph
.
add_edge
(
p_todo
.
attributes
[
'number'
],
dep
.
attributes
[
'number'
]
,
dep_id
)
self
.
_depgraph
.
add_edge
(
self
.
number
(
p_todo
),
self
.
number
(
dep
)
,
dep_id
)
for
child
in
p_todo
.
tag_values
(
'p'
):
for
child
in
p_todo
.
tag_values
(
'p'
):
parent
=
self
.
todo_by_dep_id
(
child
)
parent
=
self
.
todo_by_dep_id
(
child
)
if
parent
:
if
parent
:
self
.
_depgraph
.
add_edge
(
parent
.
attributes
[
'number'
],
p_todo
.
attributes
[
'number'
]
,
child
)
self
.
_depgraph
.
add_edge
(
self
.
number
(
parent
),
self
.
number
(
p_todo
)
,
child
)
def
add
(
self
,
p_src
):
def
add
(
self
,
p_src
):
""" Given a todo string, parse it and put it to the end of the list. """
""" Given a todo string, parse it and put it to the end of the list. """
...
@@ -117,10 +117,10 @@ class TodoList(object):
...
@@ -117,10 +117,10 @@ class TodoList(object):
if todo:
if todo:
for child in self.children(p_number):
for child in self.children(p_number):
self.remove_dependency(
todo.attributes['
number
'], child.attributes['
number
']
)
self.remove_dependency(
self.number(todo), self.number(child)
)
for parent in self.parents(p_number):
for parent in self.parents(p_number):
self.remove_dependency(
parent.attributes['
number
'], todo.attributes['
number
']
)
self.remove_dependency(
self.number(parent), self.number(todo)
)
del self._todos[p_number - 1]
del self._todos[p_number - 1]
...
@@ -272,7 +272,7 @@ class TodoList(object):
...
@@ -272,7 +272,7 @@ class TodoList(object):
"""
"""
for todo in self._todos:
for todo in self._todos:
todo.attributes['parents'] = self.parents(
todo.attributes['number']
)
todo.attributes['parents'] = self.parents(
self.number(todo)
)
def is_dirty(self):
def is_dirty(self):
return self.dirty
return self.dirty
...
@@ -290,6 +290,9 @@ class TodoList(object):
...
@@ -290,6 +290,9 @@ class TodoList(object):
todo.set_priority(p_priority)
todo.set_priority(p_priority)
self.dirty = True
self.dirty = True
def number(self, p_todo):
return p_todo.attributes['number'] # TODO: do the lookup
def __str__(self):
def __str__(self):
return '
\
n
'.join(pretty_print_list(self._todos))
return '
\
n
'.join(pretty_print_list(self._todos))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment