~ma5/madanalysis5/madanalysis-development

« back to all changes in this revision

Viewing changes to madanalysis/IOinterface/html_report_writer.py

  • Committer: Benjamin Fuks
  • Date: 2018-05-04 10:44:49 UTC
  • mfrom: (115.1.81 v1.6beta)
  • Revision ID: fuks@cern.ch-20180504104449-60h8a00loxgr8zg0
Releasing v1.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
 
162
162
    def NewLine(self):
163
163
        self.page.append("<BR>")
 
164
    def NewBlankLine(self):
 
165
        self.page.append("<BR>")
164
166
 
165
167
    def OpenBullet(self):
166
168
        self.bullet=self.bullet+1
170
172
    def CloseBullet(self):
171
173
        self.bullet=self.bullet-1
172
174
        self.page.append("  </ul>\n")
173
 
       
 
175
 
174
176
    def CreateTable(self,col,caption):
175
177
        self.table=self.table+1
176
178
        self.number_col=len(col)
182
184
            self.page.append("    </caption>\n")
183
185
        self.page.append('    <tr>\n')
184
186
 
185
 
    def NewCell(self,color=ColorType.WHITE):
186
 
        size = str(round(self.col_size[self.current_col]/sum(self.col_size)*100,0))
187
 
        self.current_col=self.current_col+1
188
 
        
 
187
    def NewCell(self,color=ColorType.WHITE,span=1):
 
188
        size=0
 
189
        for ii in range(0,span):
 
190
            size += self.col_size[self.current_col+ii]
 
191
        size = str(round(size/sum(self.col_size)*100,0))
 
192
        self.current_col=self.current_col+span
 
193
 
189
194
        if  self.current_col>self.number_col:
190
195
            logging.getLogger('MA5').warning(" the number of the current column is bigger than the total number of declared columns.")
191
196
        if self.first_cell==True:
192
 
            self.page.append('      <td width=\'' + size + '%\' bgcolor=\'' + \
193
 
                ColorType.convert2hexa(color)+ '\'>\n')
 
197
            self.page.append('      <td width=\'' + size + '%\' bgcolor=\'' + ColorType.convert2hexa(color)+'\'')
194
198
        else:
195
 
            self.page.append('      </td> \n' + \
196
 
                '      <td width=\'' + size + '%\' bgcolor=\'' + \
197
 
                ColorType.convert2hexa(color)+'\'>\n')
 
199
            self.page.append('      </td> \n' + '      <td width=\'' + size + '%\' bgcolor=\'' + ColorType.convert2hexa(color)+'\'')
 
200
        if span>1:
 
201
            self.page.append(' colspan=\"'+ str(span) + '\"')
 
202
        self.page.append('>\n')
198
203
        self.first_cell=False
199
 
       
 
204
 
200
205
    def NewLine(self):
201
206
        self.current_col=0
202
207
        self.first_cell=True
203
208
        self.page.append("      </td>\n    </tr>\n    <tr>\n")
204
 
        
 
209
 
205
210
    def EndLine(self):
206
211
        self.current_col=0
207
212
        self.first_cell=True
208
213
        self.page.append("      </td>\n    </tr>\n")
209
 
        
 
214
 
210
215
    def EndTable(self):
211
216
        self.table=self.table-1
212
217
        self.page.append("  </table><br /> <br />\n")
213
218
 
214
 
    
215
 
 
216
219
    def WriteFigure(self,caption,filename):
217
220
        thefile = os.path.normpath(filename)
218
221
        im = PngReader(thefile+'.png')
231
234
        self.page.append('    <img src=\'' + os.path.basename(filename) + \
232
235
                '.png\' ' + 'height=\''+ str(scale*im.header.height)+'\' alt =\'\' />\n')
233
236
        self.page.append("  </center><br /> <br />\n")
234
 
        
235
 
    
 
237
 
236
238
    def WriteFoot(self):
237
239
        if self.bullet!=0:
238
240
            logging.getLogger('MA5').warning(" the number of 'OpenBullet()' and 'CloseBullet()' are different.")
245
247
        self.page.insert(17,self.TableOfContents())
246
248
        for item in self.page:
247
249
            self.file.write(item)
248