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
aa7dfc27
Commit
aa7dfc27
authored
Jun 15, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print a bit more feedback on several actions.
parent
d3956d60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
Main.py
Main.py
+20
-1
No files found.
Main.py
View file @
aa7dfc27
...
...
@@ -6,6 +6,7 @@ import sys
import
Config
import
Filter
from
PrettyPrinter
import
pretty_print
import
Sorter
import
TodoFile
import
TodoList
...
...
@@ -31,10 +32,18 @@ class Application(object):
self
.
todolist
=
TodoList
.
TodoList
([])
self
.
dirty
=
False
def
print_todo
(
self
,
p_number
):
""" Prints a single todo item to the standard output. """
todo
=
self
.
todolist
.
todo
(
p_number
)
printed
=
pretty_print
([
todo
],
True
,
True
)
print
printed
[
0
]
def
add
(
self
):
""" Adds a todo item to the list. """
try
:
self
.
todolist
.
add
(
sys
.
argv
[
2
])
self
.
print_todo
(
todo
.
number
)
# TODO
self
.
dirty
=
True
except
IndexError
:
error
(
"No todo text was given."
)
...
...
@@ -49,6 +58,8 @@ class Application(object):
try
:
number
=
int
(
number
)
self
.
todolist
.
append
(
number
,
text
)
self
.
print_todo
(
number
)
self
.
dirty
=
True
except
ValueError
:
error
(
"Invalid todo number given."
)
...
...
@@ -62,6 +73,8 @@ class Application(object):
try
:
number
=
int
(
number
)
self
.
todolist
.
todo
(
number
).
set_completed
()
self
.
print_todo
(
number
)
self
.
dirty
=
True
except
IndexError
:
usage
()
...
...
@@ -78,7 +91,13 @@ class Application(object):
if
re
.
match
(
'^[A-Z]$'
,
priority
):
try
:
number
=
int
(
number
)
self
.
todolist
.
todo
(
number
).
set_priority
(
priority
)
todo
=
self
.
todolist
.
todo
(
number
)
old_priority
=
todo
.
priority
()
todo
.
set_priority
(
priority
)
print
"Priority changed from %s to %s"
\
%
(
old_priority
,
priority
)
self
.
print_todo
(
number
)
self
.
dirty
=
True
except
AttributeError
:
error
(
"Invalid todo number given."
)
...
...
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