Merge pull request #153 from JonathanReeve/addons
Update birdseye script for compatibility with Python 3
This commit is contained in:
0
.todo.actions.d/birdseye
Normal file → Executable file
0
.todo.actions.d/birdseye
Normal file → Executable file
46
.todo.actions.d/birdseye.py
Normal file → Executable file
46
.todo.actions.d/birdseye.py
Normal file → Executable file
@@ -18,7 +18,7 @@ USAGE NOTES:
|
|||||||
+writing draft Great American Novel
|
+writing draft Great American Novel
|
||||||
(B) smell the roses
|
(B) smell the roses
|
||||||
|
|
||||||
The done.txt file is a list of completed todo's from todo.txt.
|
The done.txt file is a list of completed todos from todo.txt.
|
||||||
|
|
||||||
See more on todo.txt here:
|
See more on todo.txt here:
|
||||||
http://todotxt.com
|
http://todotxt.com
|
||||||
@@ -27,9 +27,9 @@ USAGE NOTES:
|
|||||||
OUTPUT:
|
OUTPUT:
|
||||||
Displays a list of:
|
Displays a list of:
|
||||||
- working projects and their percentage complete
|
- working projects and their percentage complete
|
||||||
- contexts in which open todo's exist
|
- contexts in which open todos exist
|
||||||
- contexts and projects with tasks that have been prioritized
|
- contexts and projects with tasks that have been prioritized
|
||||||
- projects which are completely done (don't have any open todo's)
|
- projects which are completely done (don't have any open todos)
|
||||||
|
|
||||||
CHANGELOG:
|
CHANGELOG:
|
||||||
2006.07.29 - Now supports p:, p- and + project notation. Tx, Pedro!
|
2006.07.29 - Now supports p:, p- and + project notation. Tx, Pedro!
|
||||||
@@ -51,18 +51,18 @@ __history__ = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "USAGE: %s [todo.txt] [done.txt]"% (sys.argv[0], )
|
print("USAGE: %s [todo.txt] [done.txt]" % (sys.argv[0], ))
|
||||||
|
|
||||||
def printTaskGroups(title, taskDict, priorityList, percentages):
|
def printTaskGroups(title, taskDict, priorityList, percentages):
|
||||||
print ""
|
print("")
|
||||||
print "%s"% (title,)
|
print("%s"% (title,))
|
||||||
separator("-")
|
separator("-")
|
||||||
if not taskDict:
|
if not taskDict:
|
||||||
print "No items to list."
|
print("No items to list.")
|
||||||
else:
|
else:
|
||||||
# sort the dictionary by value
|
# sort the dictionary by value
|
||||||
# http://python.fyxm.net/peps/pep-0265.html
|
# http://python.fyxm.net/peps/pep-0265.html
|
||||||
items = [(v, k) for k, v in taskDict.items()]
|
items = [(v, k) for k, v in list(taskDict.items())]
|
||||||
items.sort()
|
items.sort()
|
||||||
items.reverse() # so largest is first
|
items.reverse() # so largest is first
|
||||||
items = [(k, v) for v, k in items]
|
items = [(k, v) for v, k in items]
|
||||||
@@ -84,7 +84,7 @@ def printTaskGroups(title, taskDict, priorityList, percentages):
|
|||||||
def printTaskGroup(p, pctage, star):
|
def printTaskGroup(p, pctage, star):
|
||||||
if pctage > -1:
|
if pctage > -1:
|
||||||
progressBar = ""
|
progressBar = ""
|
||||||
numStars = (pctage/10)
|
numStars = int(pctage//10)
|
||||||
progressBar = "=" * numStars
|
progressBar = "=" * numStars
|
||||||
numSpaces = 10 - numStars
|
numSpaces = 10 - numStars
|
||||||
for n in range(numSpaces):
|
for n in range(numSpaces):
|
||||||
@@ -94,14 +94,14 @@ def printTaskGroup(p, pctage, star):
|
|||||||
displayTotal = " %d%%"% (pctage, );
|
displayTotal = " %d%%"% (pctage, );
|
||||||
else:
|
else:
|
||||||
displayTotal = " %d%%"% (pctage, );
|
displayTotal = " %d%%"% (pctage, );
|
||||||
print "%s %s [%s] %s (%d todo's)"% (star, displayTotal, progressBar, p[0], p[1],)
|
print("%s %s [%s] %s (%d todos)"% (star, displayTotal, progressBar, p[0], p[1],))
|
||||||
else:
|
else:
|
||||||
print "%s %s (%d todo's)"% (star, p[0], p[1], )
|
print("%s %s (%d todos)"% (star, p[0], p[1], ))
|
||||||
|
|
||||||
def separator(c):
|
def separator(c):
|
||||||
sep = ""
|
sep = ""
|
||||||
sep = c * 42
|
sep = c * 42
|
||||||
print sep
|
print(sep)
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
@@ -139,7 +139,7 @@ def main(argv):
|
|||||||
contextPriority.append(word)
|
contextPriority.append(word)
|
||||||
f.close()
|
f.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
print "ERROR: The file named %s could not be read."% (argv[0], )
|
print("ERROR: The file named %s could not be read."% (argv[0], ))
|
||||||
usage()
|
usage()
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ def main(argv):
|
|||||||
completedTasks[word] = completedTasks.setdefault(word, 0) + 1
|
completedTasks[word] = completedTasks.setdefault(word, 0) + 1
|
||||||
f.close()
|
f.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
print "ERROR: The file named %s could not be read."% (argv[1], )
|
print("ERROR: The file named %s could not be read."% (argv[1], ))
|
||||||
usage()
|
usage()
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
@@ -180,18 +180,18 @@ def main(argv):
|
|||||||
|
|
||||||
# print out useful info
|
# print out useful info
|
||||||
#print "TODO.TXT Bird's Eye View Report %s"% ( datetime.date.today().isoformat(), )
|
#print "TODO.TXT Bird's Eye View Report %s"% ( datetime.date.today().isoformat(), )
|
||||||
print ""
|
print("")
|
||||||
print "TODO.TXT Bird's Eye View Report"
|
print("TODO.TXT Bird's Eye View Report")
|
||||||
|
|
||||||
separator("=")
|
separator("=")
|
||||||
|
|
||||||
printTaskGroups("Projects with Open TODO's", projects, projectPriority, projectPercentages)
|
printTaskGroups("Projects with Open TODOs", projects, projectPriority, projectPercentages)
|
||||||
printTaskGroups("Contexts with Open TODO's", contexts, contextPriority, projectPercentages)
|
printTaskGroups("Contexts with Open TODOs", contexts, contextPriority, projectPercentages)
|
||||||
printTaskGroups("Completed Projects (No open TODO's)", projectsWithNoIncompletes, projectPriority, projectPercentages)
|
printTaskGroups("Completed Projects (No open TODOs)", projectsWithNoIncompletes, projectPriority, projectPercentages)
|
||||||
print ""
|
print("")
|
||||||
print "* Projects and contexts with an asterisk next to them denote prioritized tasks."
|
print("* Projects and contexts with an asterisk next to them denote prioritized tasks.")
|
||||||
print "Project with prioritized tasks are listed first, then sorted by number of open todo's."
|
print("Project with prioritized tasks are listed first, then sorted by number of open todos.")
|
||||||
print ""
|
print("")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user