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
|
||||
(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:
|
||||
http://todotxt.com
|
||||
@@ -27,9 +27,9 @@ USAGE NOTES:
|
||||
OUTPUT:
|
||||
Displays a list of:
|
||||
- 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
|
||||
- projects which are completely done (don't have any open todo's)
|
||||
- projects which are completely done (don't have any open todos)
|
||||
|
||||
CHANGELOG:
|
||||
2006.07.29 - Now supports p:, p- and + project notation. Tx, Pedro!
|
||||
@@ -51,18 +51,18 @@ __history__ = """
|
||||
"""
|
||||
|
||||
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):
|
||||
print ""
|
||||
print "%s"% (title,)
|
||||
print("")
|
||||
print("%s"% (title,))
|
||||
separator("-")
|
||||
if not taskDict:
|
||||
print "No items to list."
|
||||
print("No items to list.")
|
||||
else:
|
||||
# sort the dictionary by value
|
||||
# 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.reverse() # so largest is first
|
||||
items = [(k, v) for v, k in items]
|
||||
@@ -84,7 +84,7 @@ def printTaskGroups(title, taskDict, priorityList, percentages):
|
||||
def printTaskGroup(p, pctage, star):
|
||||
if pctage > -1:
|
||||
progressBar = ""
|
||||
numStars = (pctage/10)
|
||||
numStars = int(pctage//10)
|
||||
progressBar = "=" * numStars
|
||||
numSpaces = 10 - numStars
|
||||
for n in range(numSpaces):
|
||||
@@ -94,14 +94,14 @@ def printTaskGroup(p, pctage, star):
|
||||
displayTotal = " %d%%"% (pctage, );
|
||||
else:
|
||||
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:
|
||||
print "%s %s (%d todo's)"% (star, p[0], p[1], )
|
||||
print("%s %s (%d todos)"% (star, p[0], p[1], ))
|
||||
|
||||
def separator(c):
|
||||
sep = ""
|
||||
sep = c * 42
|
||||
print sep
|
||||
print(sep)
|
||||
|
||||
|
||||
def main(argv):
|
||||
@@ -139,7 +139,7 @@ def main(argv):
|
||||
contextPriority.append(word)
|
||||
f.close()
|
||||
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()
|
||||
sys.exit(2)
|
||||
|
||||
@@ -157,7 +157,7 @@ def main(argv):
|
||||
completedTasks[word] = completedTasks.setdefault(word, 0) + 1
|
||||
f.close()
|
||||
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()
|
||||
sys.exit(2)
|
||||
|
||||
@@ -180,18 +180,18 @@ def main(argv):
|
||||
|
||||
# print out useful info
|
||||
#print "TODO.TXT Bird's Eye View Report %s"% ( datetime.date.today().isoformat(), )
|
||||
print ""
|
||||
print "TODO.TXT Bird's Eye View Report"
|
||||
print("")
|
||||
print("TODO.TXT Bird's Eye View Report")
|
||||
|
||||
separator("=")
|
||||
|
||||
printTaskGroups("Projects with Open TODO's", projects, projectPriority, projectPercentages)
|
||||
printTaskGroups("Contexts with Open TODO's", contexts, contextPriority, projectPercentages)
|
||||
printTaskGroups("Completed Projects (No open TODO's)", projectsWithNoIncompletes, projectPriority, projectPercentages)
|
||||
print ""
|
||||
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 ""
|
||||
printTaskGroups("Projects with Open TODOs", projects, projectPriority, projectPercentages)
|
||||
printTaskGroups("Contexts with Open TODOs", contexts, contextPriority, projectPercentages)
|
||||
printTaskGroups("Completed Projects (No open TODOs)", projectsWithNoIncompletes, projectPriority, projectPercentages)
|
||||
print("")
|
||||
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 todos.")
|
||||
print("")
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user