From: <cl...@us...> - 2003-11-10 23:11:24
|
Update of /cvsroot/todo-manager/todo-manager/plugins In directory sc8-pr-cvs1:/tmp/cvs-serv11307/plugins Modified Files: Tag: branch-0_75 export_html.py export_text.py Log Message: Several fixes. Next release in a day or two. Index: export_html.py =================================================================== RCS file: /cvsroot/todo-manager/todo-manager/plugins/export_html.py,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -d -r1.7 -r1.7.2.1 --- export_html.py 25 Sep 2003 19:11:53 -0000 1.7 +++ export_html.py 10 Nov 2003 23:11:21 -0000 1.7.2.1 @@ -6,16 +6,13 @@ # # 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""" # Headers - file.write("<HTML>\n<HEAD>\n</HEAD>\n") - file.write("<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n") + file.write("<HTML>\n<HEAD>\n<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">") + file.write("\n</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n") file.write("<CENTER><TABLE CELLSPACING=1 CELLPADDING=1 BORDER=0 WIDTH=650>\n") file.write("<TR BGCOLOR=\"#118CFF\"><TD WIDTH=10></TD><TD><U>Task Name</U></TD>"\ "<TD ALIGN=\"CENTER\" WIDTH=70><U>Due Date</U></TD><TD ALIGN=\"RIGHT\" WIDTH=130>"\ @@ -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.7.2.1 diff -u -d -r1.7 -r1.7.2.1 --- export_text.py 25 Sep 2003 19:11:53 -0000 1.7 +++ export_text.py 10 Nov 2003 23:11:21 -0000 1.7.2.1 @@ -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.""" |