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
2b692ce8
Commit
2b692ce8
authored
Jan 11, 2020
by
Kirill Smelkov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X Draft support for date modifier
e.g. due:=<date> ("=" prefix) automatically sets the todo task to be active only on that date.
parent
64eb927f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
3 deletions
+29
-3
topydo/lib/Todo.py
topydo/lib/Todo.py
+29
-3
No files found.
topydo/lib/Todo.py
View file @
2b692ce8
...
...
@@ -18,7 +18,7 @@
This module provides the Todo class.
"""
from
datetime
import
date
from
datetime
import
date
,
timedelta
from
topydo.lib.Config
import
config
from
topydo.lib.TodoBase
import
TodoBase
...
...
@@ -47,13 +47,39 @@ class Todo(TodoBase):
return
result
def
_due_date
(
self
):
# -> (due, flags)
""" Returns date object for due date and set of due modifier flags. """
flags
=
set
()
due
=
self
.
tag_value
(
config
().
tag_due
())
if
due
is
None
:
return
(
None
,
flags
)
if
due
.
startswith
(
'='
):
flags
.
add
(
'on'
)
due
=
due
[
1
:]
tdue
=
None
try
:
tdue
=
date_string_to_date
(
due
)
except
ValueError
:
flags
=
set
()
return
(
tdue
,
flags
)
def
start_date
(
self
):
""" Returns a date object of the todo's start date. """
return
self
.
get_date
(
config
().
tag_start
())
tstart
=
self
.
get_date
(
config
().
tag_start
())
if
tstart
is
not
None
:
return
tstart
tdue
,
flags
=
self
.
_due_date
()
if
'on'
in
flags
:
tstart
=
tdue
-
timedelta
(
days
=
1
)
return
tstart
def
due_date
(
self
):
""" Returns a date object of the todo's due date. """
return
self
.
get_date
(
config
().
tag_due
())
tdue
,
_
=
self
.
_due_date
()
return
tdue
def
is_active
(
self
):
"""
...
...
Kirill Smelkov
@kirr
·
Jan 11, 2020
Maintainer
.
.
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