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

Definition at line 83 of file Formatter.py.

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

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

Member Function Documentation

def Formatter.SimpleHTMLFormatter.addScriptCode (   self,
  scriptCode 
)

Definition at line 80 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.scriptCode.

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

Definition at line 188 of file Formatter.py.

188  def endTable(self) :
189  # we assume that headers are done by now !!
190  self.outFile.write( "</tbody>" + '\n')
191  self.outFile.write( "</table>" + '\n')
192 
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, TriggerOutputBranches::NamedBranchPtr.title, preexistingValidation.PreexistingValidation.title, DB_ME.title, TableOutputBranches::NamedBranchPtr.title, cscdqm::HistoBookRequest.title, FWTriggerTableView::Column.title, DQMGenericClient::EfficOption.title, alignment.Alignment.title, DQMGenericClient::ProfileOption.title, dqmoffline::l1t::HistDefinition.title, Formatter.SimpleHTMLFormatter.title, SiPixelGenErrorHeader.title, ecaldqm::binning::AxisSpecs.title, python.rootplot.utilities.Hist2D.title, TestHits.title, TestSmoothHits.title, big::bigHeader.title, HistogramManager.title, SiPixelTemplateHeader2D.title, presentation.SubsectionBase.title, TestTrackHits.title, python.rootplot.utilities.Hist.title, Geometry.title, TkAlMap.TkAlMap.title, TrackerMap.title, SiPixelTemplateHeader.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().

194  def headers(self) :
195  # make sure to write the headers only once ...
196  if not self.headersDone :
197 
198  self.outFile.write( "<html> " + '\n')
199 
200  self.outFile.write( "<head> " + '\n')
201 
202  if self.style:
203  self.outFile.write( self.style + '\n')
204 
205  self.outFile.write( "<TITLE>" + self.title + "</TITLE>" + '\n')
206  if self.scriptCode:
207  self.outFile.write( self.scriptCode + '\n' )
208  self.outFile.write( "</head> " + '\n')
209  self.outFile.write( "<body>" + '\n')
210  self.headersDone = True
211 
212  return
213 
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  def showLine(self) :
95  self.headers()
96  self.outFile.write( "<hr />" + '\n')
97  return
98 
def Formatter.SimpleHTMLFormatter.startTable (   self,
  colSizes,
  colLabels,
  id = None,
  cls = None,
  tableAttr = None 
)

Definition at line 137 of file Formatter.py.

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

Definition at line 215 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.headersDone.

Referenced by Formatter.SimpleHTMLFormatter.__del__().

215  def trailers(self) :
216  # write only if headers have been written ...
217  if self.headersDone :
218  self.outFile.write( "</body>" + '\n')
219  self.outFile.write( "</html> " + '\n')
220  pass
221  return
222 
223 
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  def write(self, arg="", bold=False) :
100  self.headers()
101  if bold:
102  self.writeB(arg)
103  else:
104  self.outFile.write( arg + '\n')
105  return
106 
def writeB(self, arg="")
Definition: Formatter.py:112
def write(self, arg="", bold=False)
Definition: Formatter.py:99
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().

132  def writeAnchor(self, ref="") :
133  self.headers()
134  self.outFile.write( '<a name="' + ref + '">&nbsp;</a>')
135  return
136 
def writeAnchor(self, ref="")
Definition: Formatter.py:132
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().

112  def writeB(self, arg="") :
113  self.headers()
114  self.outFile.write( "<b> " + arg + " </b>" + '\n')
115  return
116 
def writeB(self, arg="")
Definition: Formatter.py:112
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().

107  def writeBr(self) :
108  self.headers()
109  self.outFile.write( "<br /> <br /> " + '\n')
110  return
111 
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().

117  def writeH1(self, arg="") :
118  self.headers()
119  self.outFile.write( "<h1> " + arg + " </h1>" + '\n')
120  return
121 
def writeH1(self, arg="")
Definition: Formatter.py:117
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().

122  def writeH2(self, arg="") :
123  self.headers()
124  self.outFile.write( "<h2> " + arg + " </h2>" + '\n')
125  return
126 
def writeH2(self, arg="")
Definition: Formatter.py:122
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().

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

Definition at line 156 of file Formatter.py.

References str.

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

Definition at line 174 of file Formatter.py.

References str, and ComparisonHelper.zip().

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

Member Data Documentation

Formatter.SimpleHTMLFormatter.headersDone
Formatter.SimpleHTMLFormatter.outFile

Definition at line 75 of file Formatter.py.

Formatter.SimpleHTMLFormatter.scriptCode
Formatter.SimpleHTMLFormatter.style

Definition at line 73 of file Formatter.py.

Referenced by Formatter.SimpleHTMLFormatter.headers().