CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
Formatter.SimpleHTMLFormatter Class Reference

Public Member Functions

def __del__
 
def __init__
 
def addScriptCode
 
def endTable
 
def headers
 
def showLine
 
def startTable
 
def trailers
 
def write
 
def writeAnchor
 
def writeB
 
def writeBr
 
def writeH1
 
def writeH2
 
def writeH3
 
def writeRow
 
def writeStyledRow
 

Public Attributes

 format
 
 headersDone
 
 outFile
 
 scriptCode
 
 style
 
 title
 

Detailed Description

Definition at line 66 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 68 of file Formatter.py.

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

Definition at line 83 of file Formatter.py.

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

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

Member Function Documentation

def Formatter.SimpleHTMLFormatter.addScriptCode (   self,
  scriptCode 
)

Definition at line 80 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.scriptCode.

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

Definition at line 188 of file Formatter.py.

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

Definition at line 194 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.headersDone, Formatter.SimpleHTMLFormatter.scriptCode, alignment.Alignment.style, Formatter.SimpleHTMLFormatter.style, Formatter.SimpleAsciiFormatter.title, classes.PlotData.title, EventStringOutputBranches::NamedBranchPtr.title, preexistingValidation.PreexistingValidation.title, DB_ME.title, TableOutputBranches::NamedBranchPtr.title, FWTriggerTableView::Column.title, TriggerOutputBranches::NamedBranchPtr.title, cscdqm::HistoBookRequest.title, alignment.Alignment.title, DQMGenericClient::EfficOption.title, DQMGenericClient::ProfileOption.title, dqmoffline::l1t::HistDefinition.title, SiPixelGenErrorHeader.title, Formatter.SimpleHTMLFormatter.title, python.rootplot.utilities.Hist2D.title, ecaldqm::binning::AxisSpecs.title, TestHits.title, TestSmoothHits.title, big::bigHeader.title, SiPixelTemplateHeader2D.title, HistogramManager.title, presentation.SubsectionBase.title, TestTrackHits.title, python.rootplot.utilities.Hist.title, TkAlMap.TkAlMap.title, SiPixelTemplateHeader.title, Geometry.title, TrackerMap.title, and python.rootplot.utilities.HistStack.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().

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

Definition at line 94 of file Formatter.py.

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

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

Definition at line 137 of file Formatter.py.

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

Definition at line 215 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.headersDone.

Referenced by Formatter.SimpleHTMLFormatter.__del__().

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

Definition at line 99 of file Formatter.py.

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

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

Definition at line 132 of file Formatter.py.

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

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

Definition at line 112 of file Formatter.py.

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

Referenced by Formatter.SimpleHTMLFormatter.write().

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

Definition at line 107 of file Formatter.py.

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

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

Definition at line 117 of file Formatter.py.

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

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

Definition at line 122 of file Formatter.py.

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

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

Definition at line 127 of file Formatter.py.

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

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

Definition at line 156 of file Formatter.py.

References str, and digitizers_cfi.strip.

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

Definition at line 174 of file Formatter.py.

References str, digitizers_cfi.strip, and ComparisonHelper.zip().

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

Member Data Documentation

Formatter.SimpleHTMLFormatter.format

Definition at line 76 of file Formatter.py.

Referenced by progressbar.Timer.update(), progressbar.FormatLabel.update(), and genericValidation.ValidationWithPlotsSummaryBase.SummaryItem.values().

Formatter.SimpleHTMLFormatter.headersDone

Definition at line 71 of file Formatter.py.

Referenced by Formatter.SimpleHTMLFormatter.__del__(), Formatter.SimpleHTMLFormatter.headers(), and Formatter.SimpleHTMLFormatter.trailers().

Formatter.SimpleHTMLFormatter.outFile

Definition at line 75 of file Formatter.py.

Formatter.SimpleHTMLFormatter.scriptCode

Definition at line 74 of file Formatter.py.

Referenced by Formatter.SimpleHTMLFormatter.addScriptCode(), and Formatter.SimpleHTMLFormatter.headers().

Formatter.SimpleHTMLFormatter.style

Definition at line 73 of file Formatter.py.

Referenced by Formatter.SimpleHTMLFormatter.headers().

Formatter.SimpleHTMLFormatter.title

Definition at line 72 of file Formatter.py.

Referenced by Formatter.SimpleHTMLFormatter.headers().