41 |
41 |
42 errors = file(errorsfilename, 'rb') |
42 errors = file(errorsfilename, 'rb') |
43 template = file(self.template, 'rb' ) |
43 template = file(self.template, 'rb' ) |
44 output = file(outputfilename, 'w' ) |
44 output = file(outputfilename, 'w' ) |
45 |
45 |
46 self._rtftable(errors, output, tagtoreplace, template) |
46 self.rtftable_file(errors, output, tagtoreplace, template) |
47 |
47 |
48 errors.close() |
48 errors.close() |
49 output.close() |
49 output.close() |
50 template.close() |
50 template.close() |
51 |
51 |
52 def _rtftable(self, errors, output, tagtoreplace, template): |
52 def rtftable_file(self, errors, output, tagtoreplace, template): |
53 """rtf table""" |
53 """rtf table""" |
54 PyRTF.Elements.StandardColours.append(PyRTF.PropertySets.Colour('NokiaBlue', 153, 204, 255)) |
54 PyRTF.Elements.StandardColours.append(PyRTF.PropertySets.Colour('NokiaBlue', 153, 204, 255)) |
55 |
55 |
56 d_r = PyRTF.Renderer() |
56 d_r = PyRTF.Renderer() |
57 doc = PyRTF.Document() |
57 doc = PyRTF.Document() |
102 """ Replaces tagtoreplace in a RTF file with a image """ |
102 """ Replaces tagtoreplace in a RTF file with a image """ |
103 |
103 |
104 template = file(self.template, 'rb' ) |
104 template = file(self.template, 'rb' ) |
105 output = file(outputfilename, 'w' ) |
105 output = file(outputfilename, 'w' ) |
106 |
106 |
107 self._rtfimage(image, output, tagtoreplace, template) |
107 self.rtfimage_file(image, output, tagtoreplace, template) |
108 |
108 |
109 output.close() |
109 output.close() |
110 template.close() |
110 template.close() |
111 |
111 |
112 def _rtfimage(self, image, output, tagtoreplace, template): |
112 def rtfimage_file(self, image, output, tagtoreplace, template): |
113 """rtf image""" |
113 """rtf image""" |
114 temp_file = 'image_temp.rtf' |
114 temp_file = 'image_temp.rtf' |
115 |
115 |
116 d_r = PyRTF.Renderer() |
116 d_r = PyRTF.Renderer() |
117 doc = PyRTF.Document() |
117 doc = PyRTF.Document() |
147 def rtfconvert(self, inputfilename, outputfilename): |
147 def rtfconvert(self, inputfilename, outputfilename): |
148 """ Converts a property file to be RTF link syntax """ |
148 """ Converts a property file to be RTF link syntax """ |
149 inputfile = file( inputfilename, 'r' ) |
149 inputfile = file( inputfilename, 'r' ) |
150 outputfile = file( outputfilename, 'w' ) |
150 outputfile = file( outputfilename, 'w' ) |
151 |
151 |
152 self._rtfconvert(inputfile, outputfile) |
152 self.rtfconvert_file(inputfile, outputfile) |
153 |
153 |
154 inputfile.close() |
154 inputfile.close() |
155 outputfile.close() |
155 outputfile.close() |
156 |
156 |
157 def _rtfconvert(self, inputfile, outputfile): |
157 def rtfconvert_file(self, inputfile, outputfile): |
158 """rtf convert""" |
158 """rtf convert""" |
159 ppp = re.compile(r'(.+=)((\\\\|http|\.\\|ftp)(.+))') |
159 ppp = re.compile(r'(.+=)((\\\\|http|\.\\|ftp)(.+))') |
160 for line in inputfile: |
160 for line in inputfile: |
161 newline = line |
161 newline = line |
162 |
162 |