CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
Formatter.SimpleHTMLFormatter Class Reference

Public Member Functions

def __del__ (self)
 
def __init__ (self, title="CMS SDT pages ", style=None, outFile=sys.stdout, scriptCode='')
 
def addScriptCode (self, scriptCode)
 
def endTable (self)
 
def headers (self)
 
def showLine (self)
 
def startTable (self, colSizes, colLabels, id=None, cls=None, tableAttr=None)
 
def trailers (self)
 
def write (self, arg="", bold=False)
 
def writeAnchor (self, ref="")
 
def writeB (self, arg="")
 
def writeBr (self)
 
def writeH1 (self, arg="")
 
def writeH2 (self, arg="")
 
def writeH3 (self, arg="")
 
def writeRow (self, args, bold=False, cls=None)
 
def writeStyledRow (self, args, styles)
 

Public Attributes

 format
 
 headersDone
 
 outFile
 
 scriptCode
 
 style
 
 title
 

Detailed Description

Definition at line 65 of file Formatter.py.

Constructor & Destructor Documentation

def Formatter.SimpleHTMLFormatter.__init__ (   self,
  title = "CMS SDT pages ",
  style = None,
  outFile = sys.stdout,
  scriptCode = '' 
)

Definition at line 67 of file Formatter.py.

67  def __init__(self, title="CMS SDT pages ", style=None, outFile=sys.stdout, scriptCode='') :
68  import time
69 
70  self.headersDone = False
71  self.title=title
72  self.style = style
73  self.scriptCode = scriptCode
74  self.outFile = outFile
75  self.format = ""
76 
77  return
78 
def __init__(self, title="CMS SDT pages ", style=None, outFile=sys.stdout, scriptCode='')
Definition: Formatter.py:67
def Formatter.SimpleHTMLFormatter.__del__ (   self)

Definition at line 82 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.headersDone, and Formatter.SimpleHTMLFormatter.trailers().

82  def __del__(self) :
83  if self.headersDone :
84  self.trailers()
85  else: # in case nothing has been written yet, output an empty page ...
86  self.outFile.write( "Content-Type: text/html" + '\n') # HTML is following
87  self.outFile.write( '\n') # blank line, end of headers
88  self.outFile.write( "<html> " + '\n')
89  self.outFile.write( "</html> " + '\n')
90 
91  return
92 

Member Function Documentation

def Formatter.SimpleHTMLFormatter.addScriptCode (   self,
  scriptCode 
)

Definition at line 79 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.scriptCode.

79  def addScriptCode(self, scriptCode):
80  self.scriptCode += scriptCode
81 
def addScriptCode(self, scriptCode)
Definition: Formatter.py:79
def Formatter.SimpleHTMLFormatter.endTable (   self)

Definition at line 187 of file Formatter.py.

187  def endTable(self) :
188  # we assume that headers are done by now !!
189  self.outFile.write( "</tbody>" + '\n')
190  self.outFile.write( "</table>" + '\n')
191 
def Formatter.SimpleHTMLFormatter.headers (   self)

Definition at line 193 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.headersDone, Formatter.SimpleHTMLFormatter.scriptCode, alignment.Alignment.style, Formatter.SimpleHTMLFormatter.style, Formatter.SimpleAsciiFormatter.title, classes.PlotData.title, preexistingValidation.PreexistingValidation.title, DB_ME.title, cscdqm::HistoBookRequest.title, FWTriggerTableView::Column.title, alignment.Alignment.title, DQMGenericClient::EfficOption.title, SiPixelTemplateHeader2D.title, DQMGenericClient::ProfileOption.title, SiPixelGenErrorHeader.title, Formatter.SimpleHTMLFormatter.title, python.rootplot.utilities.Hist2D.title, TestHits.title, ecaldqm::binning::AxisSpecs.title, TestSmoothHits.title, big::bigHeader.title, SiStripTemplateHeader.title, HistogramManager.title, presentation.SubsectionBase.title, TestTrackHits.title, python.rootplot.utilities.Hist.title, TrackerMap.title, SiPixelTemplateHeader.title, python.rootplot.utilities.HistStack.title, argparse._ArgumentGroup.title, and python.rootplot.argparse._ArgumentGroup.title.

Referenced by Formatter.SimpleHTMLFormatter.showLine(), Formatter.SimpleHTMLFormatter.write(), Formatter.SimpleHTMLFormatter.writeAnchor(), Formatter.SimpleHTMLFormatter.writeB(), Formatter.SimpleHTMLFormatter.writeBr(), Formatter.SimpleHTMLFormatter.writeH1(), Formatter.SimpleHTMLFormatter.writeH2(), and Formatter.SimpleHTMLFormatter.writeH3().

193  def headers(self) :
194  # make sure to write the headers only once ...
195  if not self.headersDone :
196 
197  self.outFile.write( "<html> " + '\n')
198 
199  self.outFile.write( "<head> " + '\n')
200 
201  if self.style:
202  self.outFile.write( self.style + '\n')
203 
204  self.outFile.write( "<TITLE>" + self.title + "</TITLE>" + '\n')
205  if self.scriptCode:
206  self.outFile.write( self.scriptCode + '\n' )
207  self.outFile.write( "</head> " + '\n')
208  self.outFile.write( "<body>" + '\n')
209  self.headersDone = True
210 
211  return
212 
def Formatter.SimpleHTMLFormatter.showLine (   self)

Definition at line 93 of file Formatter.py.

References lhef::LHEReader::XMLHandler.headers, lhef::LHERunInfo.headers, and Formatter.SimpleHTMLFormatter.headers().

93  def showLine(self) :
94  self.headers()
95  self.outFile.write( "<hr />" + '\n')
96  return
97 
def Formatter.SimpleHTMLFormatter.startTable (   self,
  colSizes,
  colLabels,
  id = None,
  cls = None,
  tableAttr = None 
)

Definition at line 136 of file Formatter.py.

136  def startTable(self, colSizes, colLabels, id=None, cls=None, tableAttr=None) :
137  # we assume that html headers are done by now !!
138  tableString = '<table '
139  if tableAttr:
140  tableString += tableAttr
141  if id:
142  tableString += ' id="'+id+'" '
143  if cls:
144  tableString += ' class="'+cls+'" '
145  tableString += '>'
146  self.outFile.write( tableString + '\n')
147 
148  self.outFile.write( " <thead>\n <tr>" + '\n')
149  for col in colLabels :
150  self.outFile.write( " <th> <b>" + col + "</b> </th>" + '\n')
151  self.outFile.write( " </tr>\n</thead>" + '\n')
152  self.outFile.write( " <tbody>" + '\n')
153  return
154 
def startTable(self, colSizes, colLabels, id=None, cls=None, tableAttr=None)
Definition: Formatter.py:136
def Formatter.SimpleHTMLFormatter.trailers (   self)

Definition at line 214 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.headersDone.

Referenced by Formatter.SimpleHTMLFormatter.__del__().

214  def trailers(self) :
215  # write only if headers have been written ...
216  if self.headersDone :
217  self.outFile.write( "</body>" + '\n')
218  self.outFile.write( "</html> " + '\n')
219  pass
220  return
221 
222 
def Formatter.SimpleHTMLFormatter.write (   self,
  arg = "",
  bold = False 
)

Definition at line 98 of file Formatter.py.

References lhef::LHEReader::XMLHandler.headers, lhef::LHERunInfo.headers, Formatter.SimpleHTMLFormatter.headers(), Formatter.SimpleAsciiFormatter.writeB(), and Formatter.SimpleHTMLFormatter.writeB().

98  def write(self, arg="", bold=False) :
99  self.headers()
100  if bold:
101  self.writeB(arg)
102  else:
103  self.outFile.write( arg + '\n')
104  return
105 
def writeB(self, arg="")
Definition: Formatter.py:111
def write(self, arg="", bold=False)
Definition: Formatter.py:98
def Formatter.SimpleHTMLFormatter.writeAnchor (   self,
  ref = "" 
)

Definition at line 131 of file Formatter.py.

References lhef::LHEReader::XMLHandler.headers, lhef::LHERunInfo.headers, and Formatter.SimpleHTMLFormatter.headers().

131  def writeAnchor(self, ref="") :
132  self.headers()
133  self.outFile.write( '<a name="' + ref + '">&nbsp;</a>')
134  return
135 
def writeAnchor(self, ref="")
Definition: Formatter.py:131
def Formatter.SimpleHTMLFormatter.writeB (   self,
  arg = "" 
)

Definition at line 111 of file Formatter.py.

References lhef::LHEReader::XMLHandler.headers, lhef::LHERunInfo.headers, and Formatter.SimpleHTMLFormatter.headers().

Referenced by Formatter.SimpleHTMLFormatter.write().

111  def writeB(self, arg="") :
112  self.headers()
113  self.outFile.write( "<b> " + arg + " </b>" + '\n')
114  return
115 
def writeB(self, arg="")
Definition: Formatter.py:111
def Formatter.SimpleHTMLFormatter.writeBr (   self)

Definition at line 106 of file Formatter.py.

References lhef::LHEReader::XMLHandler.headers, lhef::LHERunInfo.headers, and Formatter.SimpleHTMLFormatter.headers().

106  def writeBr(self) :
107  self.headers()
108  self.outFile.write( "<br /> <br /> " + '\n')
109  return
110 
def Formatter.SimpleHTMLFormatter.writeH1 (   self,
  arg = "" 
)

Definition at line 116 of file Formatter.py.

References lhef::LHEReader::XMLHandler.headers, lhef::LHERunInfo.headers, and Formatter.SimpleHTMLFormatter.headers().

116  def writeH1(self, arg="") :
117  self.headers()
118  self.outFile.write( "<h1> " + arg + " </h1>" + '\n')
119  return
120 
def writeH1(self, arg="")
Definition: Formatter.py:116
def Formatter.SimpleHTMLFormatter.writeH2 (   self,
  arg = "" 
)

Definition at line 121 of file Formatter.py.

References lhef::LHEReader::XMLHandler.headers, lhef::LHERunInfo.headers, and Formatter.SimpleHTMLFormatter.headers().

121  def writeH2(self, arg="") :
122  self.headers()
123  self.outFile.write( "<h2> " + arg + " </h2>" + '\n')
124  return
125 
def writeH2(self, arg="")
Definition: Formatter.py:121
def Formatter.SimpleHTMLFormatter.writeH3 (   self,
  arg = "" 
)

Definition at line 126 of file Formatter.py.

References lhef::LHEReader::XMLHandler.headers, lhef::LHERunInfo.headers, and Formatter.SimpleHTMLFormatter.headers().

126  def writeH3(self, arg="") :
127  self.headers()
128  self.outFile.write( "<h3> " + arg + " </h3>" + '\n')
129  return
130 
def writeH3(self, arg="")
Definition: Formatter.py:126
def Formatter.SimpleHTMLFormatter.writeRow (   self,
  args,
  bold = False,
  cls = None 
)

Definition at line 155 of file Formatter.py.

References harvestTrackValidationPlots.str.

155  def writeRow(self, args, bold=False, cls=None) :
156  # we assume that headers are done by now !!
157 
158  if cls:
159  self.outFile.write( ' <tr class="'+cls+'"> \n')
160  else:
161  self.outFile.write( " <tr>" + '\n')
162  for arg in args:
163  if string.strip(str(arg)) == "" : arg = "&nbsp;"
164  if bold: self.outFile.write( '<td class=cellbold> ' )
165  else: self.outFile.write( " <td> " )
166  self.outFile.write( arg )
167 
168  self.outFile.write( " </td>" + '\n')
169  self.outFile.write( " </tr> " + '\n')
170 
171  return
172 
def writeRow(self, args, bold=False, cls=None)
Definition: Formatter.py:155
def Formatter.SimpleHTMLFormatter.writeStyledRow (   self,
  args,
  styles 
)

Definition at line 173 of file Formatter.py.

References harvestTrackValidationPlots.str, and ComparisonHelper.zip().

173  def writeStyledRow(self, args, styles) :
174  # we assume that headers are done by now !!
175  self.outFile.write( " <tr>" + '\n')
176  for arg, cellStyle in zip(args, styles):
177  if string.strip(str(arg)) == "" : arg = "&nbsp;"
178  cellStyle = cellStyle.strip()
179  if cellStyle != '' : self.outFile.write( '<td class='+cellStyle+'> ' )
180  else: self.outFile.write( " <td> " )
181  self.outFile.write( arg )
182  self.outFile.write( " </td>" + '\n')
183  self.outFile.write( " </tr> " + '\n')
184 
185  return
186 
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def writeStyledRow(self, args, styles)
Definition: Formatter.py:173

Member Data Documentation

Formatter.SimpleHTMLFormatter.headersDone
Formatter.SimpleHTMLFormatter.outFile

Definition at line 74 of file Formatter.py.

Formatter.SimpleHTMLFormatter.scriptCode
Formatter.SimpleHTMLFormatter.style

Definition at line 72 of file Formatter.py.

Referenced by Formatter.SimpleHTMLFormatter.headers().