test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 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 
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
def Formatter.SimpleHTMLFormatter.__del__ (   self)

Definition at line 82 of file Formatter.py.

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

82 
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

Member Function Documentation

def Formatter.SimpleHTMLFormatter.addScriptCode (   self,
  scriptCode 
)

Definition at line 79 of file Formatter.py.

References Formatter.SimpleHTMLFormatter.scriptCode.

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

Definition at line 187 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')
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, alignment.Alignment.title, DB_ME.title, cscdqm::HistoBookRequest.title, DQMGenericClient::EfficOption.title, FWTriggerTableView::Column.title, DQMGenericClient::ProfileOption.title, SiPixelTemplateHeader2D.title, SiPixelGenErrorHeader.title, Formatter.SimpleHTMLFormatter.title, python.rootplot.utilities.Hist2D.title, TestHits.title, ecaldqm::binning::AxisSpecs.title, TestSmoothHits.title, big::bigHeader.title, SiStripTemplateHeader.title, TestTrackHits.title, python.rootplot.utilities.Hist.title, FastTimerService::LuminosityDescription.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().

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

Definition at line 136 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
def Formatter.SimpleHTMLFormatter.trailers (   self)

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

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

98 
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
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().

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

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

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

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

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

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

Definition at line 155 of file Formatter.py.

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
def Formatter.SimpleHTMLFormatter.writeStyledRow (   self,
  args,
  styles 
)

Definition at line 173 of file Formatter.py.

References 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
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)

Member Data Documentation

Formatter.SimpleHTMLFormatter.format

Definition at line 75 of file Formatter.py.

Referenced by progressbar.Timer.update(), and progressbar.FormatLabel.update().

Formatter.SimpleHTMLFormatter.headersDone

Definition at line 70 of file Formatter.py.

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

Formatter.SimpleHTMLFormatter.outFile

Definition at line 74 of file Formatter.py.

Formatter.SimpleHTMLFormatter.scriptCode

Definition at line 73 of file Formatter.py.

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

Formatter.SimpleHTMLFormatter.style

Definition at line 72 of file Formatter.py.

Referenced by Formatter.SimpleHTMLFormatter.headers().

Formatter.SimpleHTMLFormatter.title

Definition at line 71 of file Formatter.py.

Referenced by cuy.plotElement.__init__(), cuy.additionElement.__init__(), cuy.superimposeElement.__init__(), cuy.graphElement.__init__(), Vispa.Views.LineDecayView.LineDecayContainer.autolayout(), Vispa.Views.LineDecayView.LineDecayContainer.autolayoutThreadFinished(), Vispa.Views.LineDecayView.LineDecayContainer.childFinishedAutolayouting(), Formatter.SimpleHTMLFormatter.headers(), and Vispa.Gui.PortWidget.PortWidget.name().