[Spambayes-checkins] spambayes/Outlook2000/dialogs/resources
rclabels2text.py, NONE, 1.1
Adam Walker
xenogeist at users.sourceforge.net
Tue Aug 19 20:12:50 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs/resources
In directory sc8-pr-cvs1:/tmp/cvs-serv1737/Outlook2000/dialogs/resources
Added Files:
rclabels2text.py
Log Message:
Added a tool to help spell check the rc files.
--- NEW FILE: rclabels2text.py ---
# rclabels2text.py
# This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
__author__="Adam Walker"
__doc__=""""
Pulls labels and captions out of a windows resource file
and writes them into a text file for spell checking purposes.
"""
import sys, os, re
import rcparser
anti_and = re.compile(r"([^\\]*)&([^&]*)");
anti_nl = re.compile(r"([^\\]*)\\n([^\\])");
def extract(inputFilename = None, outputFilename = None):
"""See the module doc string"""
if inputFilename is None:
inputFilename = "dialogs.rc"
if outputFilename is None:
outputFilename = "spellcheck.txt"
rcp = rcparser.ParseDialogs(inputFilename)
out = open(outputFilename, "wt")
for dlg_id in rcp._dialogs:
print dlg_id
dlg = rcp._dialogs[dlg_id]
out.write("\n================================================\n")
out.write("In Dialog: "+str(dlg_id)+" Title: "+str(dlg.caption)+"\n\n")
for ctrl in dlg.controls:
if len(ctrl.label)>0:
out.write(ctrl.id)
out.write("\n")
s = ctrl.label
s = anti_and.sub(r"\g<1>\g<2>", s)
s = anti_nl.sub("\\g<1>\n\\g<2>",s)
out.write(s)
out.write("\n\n")
out.close()
os.startfile(outputFilename);
if __name__=="__main__":
if len(sys.argv)>1:
extract(sys.argv[1], sys.argv[2])
else:
extract()
More information about the Spambayes-checkins
mailing list