📄 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 fileand writes them into a text file for spell checking purposes."""import sys, os, reimport rcparseranti_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()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -