CMS 3D CMS Logo

Public Member Functions | Public Attributes

Formatter::SimpleHTMLFormatter Class Reference

List of all members.

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.

00068                                                                                               :
00069         import time
00070 
00071         self.headersDone = False
00072         self.title=title
00073         self.style = style
00074         self.scriptCode = scriptCode
00075         self.outFile = outFile
00076         self.format = ""
00077 
00078         return

def Formatter::SimpleHTMLFormatter::__del__ (   self)

Definition at line 82 of file Formatter.py.

00083                       :
00084         if self.headersDone :
00085             self.trailers()
00086         else: # in case nothing has been written yet, output an empty page ...
00087             self.outFile.write( "Content-Type: text/html" + '\n')     # HTML is following
00088             self.outFile.write( '\n')   # blank line, end of headers
00089             self.outFile.write( "<html> " + '\n')
00090             self.outFile.write( "</html> " + '\n')
00091         
00092         return


Member Function Documentation

def Formatter::SimpleHTMLFormatter::addScriptCode (   self,
  scriptCode 
)

Definition at line 79 of file Formatter.py.

00080                                        :
00081         self.scriptCode += scriptCode

def Formatter::SimpleHTMLFormatter::endTable (   self)

Definition at line 187 of file Formatter.py.

00188                        :
00189         # we assume that headers are done by now !!
00190         self.outFile.write( "</tbody>" + '\n')
00191         self.outFile.write( "</table>" + '\n')
        
def Formatter::SimpleHTMLFormatter::headers (   self)

Definition at line 193 of file Formatter.py.

00194                       :
00195         # make sure to write the headers only once ...
00196         if not self.headersDone :
00197         
00198             self.outFile.write( "<html> " + '\n')
00199 
00200             self.outFile.write( "<head> " + '\n')
00201 
00202             if self.style:
00203                 self.outFile.write( self.style + '\n')
00204             
00205             self.outFile.write( "<TITLE>" + self.title + "</TITLE>" + '\n')
00206             if self.scriptCode:
00207                 self.outFile.write( self.scriptCode + '\n' )
00208             self.outFile.write( "</head> " + '\n')
00209             self.outFile.write( "<body>" + '\n')
00210         self.headersDone = True
00211 
00212         return

def Formatter::SimpleHTMLFormatter::showLine (   self)

Definition at line 93 of file Formatter.py.

00094                        :
00095         self.headers()
00096         self.outFile.write( "<hr />" + '\n')
00097         return
    
def Formatter::SimpleHTMLFormatter::startTable (   self,
  colSizes,
  colLabels,
  id = None,
  cls = None,
  tableAttr = None 
)

Definition at line 136 of file Formatter.py.

00137                                                                                  :
00138         # we assume that html headers are done by now !!
00139         tableString = '<table '
00140         if tableAttr:
00141             tableString += tableAttr
00142         if id:
00143             tableString += ' id="'+id+'" '
00144         if cls:
00145             tableString += ' class="'+cls+'" '
00146         tableString += '>'
00147         self.outFile.write( tableString + '\n')
00148 
00149         self.outFile.write( " <thead>\n  <tr>"  + '\n')
00150         for col in colLabels :
00151             self.outFile.write( "   <th> <b>" + col + "</b> </th>" + '\n')
00152         self.outFile.write( "  </tr>\n</thead>" + '\n')
00153         self.outFile.write( "  <tbody>" + '\n')
00154         return

def Formatter::SimpleHTMLFormatter::trailers (   self)

Definition at line 214 of file Formatter.py.

00215                        :
00216         # write only if headers have been written ...
00217         if self.headersDone :
00218             self.outFile.write( "</body>" + '\n')
00219             self.outFile.write( "</html> " + '\n')
00220             pass
00221         return
00222 
00223     
def Formatter::SimpleHTMLFormatter::write (   self,
  arg = "",
  bold = False 
)

Definition at line 98 of file Formatter.py.

00099                                         :
00100         self.headers()
00101         if bold:
00102             self.writeB(arg)
00103         else:
00104             self.outFile.write( arg + '\n')
00105         return

def Formatter::SimpleHTMLFormatter::writeAnchor (   self,
  ref = "" 
)

Definition at line 131 of file Formatter.py.

00132                                   :
00133         self.headers()
00134         self.outFile.write( '<a name="' + ref + '">&nbsp;</a>')
00135         return
    
def Formatter::SimpleHTMLFormatter::writeB (   self,
  arg = "" 
)

Definition at line 111 of file Formatter.py.

00112                              :
00113         self.headers()
00114         self.outFile.write( "<b> " + arg + " </b>" + '\n')
00115         return
    
def Formatter::SimpleHTMLFormatter::writeBr (   self)

Definition at line 106 of file Formatter.py.

00107                       :
00108         self.headers()
00109         self.outFile.write( "<br /> <br /> " + '\n')
00110         return
    
def Formatter::SimpleHTMLFormatter::writeH1 (   self,
  arg = "" 
)

Definition at line 116 of file Formatter.py.

00117                               :
00118         self.headers()
00119         self.outFile.write( "<h1> " + arg + " </h1>" + '\n')
00120         return
    
def Formatter::SimpleHTMLFormatter::writeH2 (   self,
  arg = "" 
)

Definition at line 121 of file Formatter.py.

00122                               :
00123         self.headers()
00124         self.outFile.write( "<h2> " + arg + " </h2>" + '\n')
00125         return

def Formatter::SimpleHTMLFormatter::writeH3 (   self,
  arg = "" 
)

Definition at line 126 of file Formatter.py.

00127                               :
00128         self.headers()
00129         self.outFile.write( "<h3> " + arg + " </h3>" + '\n')
00130         return
    
def Formatter::SimpleHTMLFormatter::writeRow (   self,
  args,
  bold = False,
  cls = None 
)

Definition at line 155 of file Formatter.py.

00156                                                    :
00157         # we assume that headers are done by now !!
00158 
00159         if cls:
00160             self.outFile.write( ' <tr class="'+cls+'"> \n')
00161         else:
00162             self.outFile.write( " <tr>" + '\n')
00163         for arg in args:
00164             if string.strip(str(arg)) == "" : arg = "&nbsp;"
00165             if bold: self.outFile.write( '<td class=cellbold> ' )
00166             else:    self.outFile.write( "  <td> " )
00167             self.outFile.write( arg )
00168             
00169             self.outFile.write( " </td>" + '\n')
00170         self.outFile.write( " </tr> " + '\n')
00171 
00172         return

def Formatter::SimpleHTMLFormatter::writeStyledRow (   self,
  args,
  styles 
)

Definition at line 173 of file Formatter.py.

00174                                            :
00175         # we assume that headers are done by now !!
00176         self.outFile.write( " <tr>" + '\n')
00177         for arg, cellStyle in zip(args, styles):
00178             if string.strip(str(arg)) == "" : arg = "&nbsp;"
00179             cellStyle = cellStyle.strip()
00180             if cellStyle != '' : self.outFile.write( '<td class='+cellStyle+'> ' )
00181             else:    self.outFile.write( "  <td> " )
00182             self.outFile.write( arg )
00183             self.outFile.write( " </td>" + '\n')
00184         self.outFile.write( " </tr> " + '\n')
00185 
00186         return


Member Data Documentation

Definition at line 67 of file Formatter.py.

Definition at line 67 of file Formatter.py.

Definition at line 67 of file Formatter.py.

Definition at line 67 of file Formatter.py.

Definition at line 67 of file Formatter.py.

Definition at line 67 of file Formatter.py.