|
From: <cl...@us...> - 2003-10-25 22:20:12
|
Update of /cvsroot/todo-manager/todo-manager/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv15027/plugins
Modified Files:
export_html.py export_text.py
Log Message:
main.py:
* Many clean-ups with plugin execution.
* Duplicate task lists that are to passed to plugins are created correctly.
* Date formats for export plugins are applied to all dates before being
passed on.
export_html.py, export_text.py:
* Updated to work with the changes that were made to main.py
* Cleaned up some code that wasn't working too well.
This update was prompted by an email I recieved from Tom Churm that
stated that HTML export no longer worked.
Index: export_html.py
===================================================================
RCS file: /cvsroot/todo-manager/todo-manager/plugins/export_html.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- export_html.py 25 Sep 2003 19:11:53 -0000 1.7
+++ export_html.py 24 Oct 2003 00:13:17 -0000 1.8
@@ -6,9 +6,6 @@
#
# Export a task list to an HTML file
-import time, re
-import tdmcalls
-
# HTML format
def save_html(tasks, file):
"""Save a task list to an HTML file with most of the formating present from the interface"""
@@ -25,27 +22,15 @@
# Writing each node
for task in tasks:
- style = ("", "")
- if task["DueDate"] and not task["Finished"]:
- # Get the current time
- t = time.time()
- t = time.localtime(t)
-
- if task["DueDate"] == t: style = ("<B>", "</B>")
- elif task["DueDate"] < t: style = ("<FONT COLOR=\"#9E0B0E\">", "</FONT>")
# Convert newline characters in the notes to line breaks
- p = re.compile('(\r|\n)')
- notes = p.sub('<BR>', task['Notes'])
-
- # The function used to format time structures
- fmt = tdmcalls.fmttime
+ notes = task['Notes'].replace('\n', '<BR>')
file.write("<TR BGCOLOR=\"#DEDEDE\"><TD BGCOLOR=\"%s\" ALIGN=\"CENTER\">%d</TD><TD>"\
- "%s %s%s</TD><TD ALIGN=\"CENTER\">%s</TD><TD ALIGN=\"RIGHT\">%s</TD>\n<TR>"\
+ " %s</TD><TD ALIGN=\"CENTER\">%s</TD><TD ALIGN=\"RIGHT\">%s</TD>\n<TR>"\
"<TD></TD><TD COLSPAN=5><I>%s</I></TD></TR>\n"
- %(pcolors[task["Priority"]], task["Priority"], style[0], task["Name"], style[1],
- fmt(task["DueDate"]), fmt(task["FinishedDate"]), notes))
+ %(pcolors[task["Priority"]], task["Priority"], task["Name"],
+ task["DueDate"], task["FinishedDate"], notes))
# Closing tags
file.write("</TABLE></CENTER></BODY>\n</HTML>")
@@ -53,7 +38,7 @@
def init(plugin):
plugin['type'] = "file_export"
plugin['name'] = "HTML File"
- plugin['version'] = "0.4"
+ plugin['version'] = "0.5"
plugin['function'] = save_html
plugin['format'] = "*.html"
plugin['description'] = """Export the task list to an HTML file."""
Index: export_text.py
===================================================================
RCS file: /cvsroot/todo-manager/todo-manager/plugins/export_text.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- export_text.py 25 Sep 2003 19:11:53 -0000 1.7
+++ export_text.py 24 Oct 2003 00:13:17 -0000 1.8
@@ -7,7 +7,6 @@
# Export a task list to a text file
import string
-import tdmcalls
def save_text(tasks, file):
"""Save a task list to a plain text file with simple formating"""
@@ -15,8 +14,8 @@
# The headers and what not
file.write("TODO File\n\n")
file.write(string.ljust("P", 3))
- file.write(string.ljust("Task Name", 50))
- file.write(string.ljust("Due Date", 10))
+ file.write(string.ljust("Task Name", 40))
+ file.write(string.ljust("Due Date", 12))
file.write(string.ljust("Finished Time", 18))
file.write('\n'+('-'*80)+'\n')
@@ -24,8 +23,8 @@
for task in tasks:
file.write(string.ljust(str(task["Priority"]), 3))
file.write(string.ljust(task["Name"], 50))
- file.write(string.ljust(tdmcalls.fmttime(task["DueDate"]), 10))
- file.write(string.ljust(tdmcalls.fmttime(task["FinishedDate"]), 18))
+ file.write(string.ljust(task["DueDate"], 10))
+ file.write(string.ljust(task["FinishedDate"], 18))
if task["Notes"]:
file.write("\n note:%s" %task["Notes"])
file.write("\n\n")
@@ -33,7 +32,7 @@
def init(plugin):
plugin['type'] = "file_export"
plugin['name'] = "Text File"
- plugin['version'] = "0.2"
+ plugin['version'] = "0.3"
plugin['function'] = save_text
plugin['format'] = "*.txt"
plugin['description'] = """Export the task list to a plain text file."""
|