This function builds an XHTML tr element
that describes one client's configuration. For the XHTML
generated, see Section 3.2, “XHTML for the room page”.
# - - - b u i l d R o o m R o w
def buildRoomRow ( tbody, reportInfo, clientConfig ):
'''Build one row of the client configuration table.
[ (tbody is an et.Element) and
(clientConfig is a ClientConfig instance) ->
tbody +:= a tr element describing the configuration
of clientConfig ]
'''
First we build a snipped of XHTML to form the content
of the “Operating system” column. For
dual-boot systems, this is two stacked div
elements containing the strings “Linux/”
and “Windows”.
#-- 1 --
# [ if clientConfig.os == '' ->
# osContent := vertically stacked strings "Linux/" and
# "Windows"
# else ->
# osContent := clientConfig.os ]
if clientConfig.os:
osContent = clientConfig.os
else:
osContent = E.div ( E.div ( "Linux/" ),
E.div ( "Windows" ) )
The other nontrivial cell content is the device listing.
For the construction of this content, see Section 20, “buildDevices(): Extract relevant device
configurations”.
#-- 2 --
# [ deviceContent := a div containing divs for each
# device named in reportInfo that matches a device
# from clientConfig ]
deviceContent = buildDevices ( reportInfo, clientConfig )
All that remains is to assemble the pieces.
#-- 3 --
tbody.append (
E.tr (
E.th ( L_ALIGN, TOP_VALIGN,
E.tt ( clientConfig.hostName ) ),
E.th ( R_ALIGN, TOP_VALIGN, clientConfig.nCpus ),
E.th ( R_ALIGN, TOP_VALIGN, clientConfig.speed ),
E.th ( L_ALIGN, TOP_VALIGN, clientConfig.arch ),
E.th ( R_ALIGN, TOP_VALIGN, clientConfig.memory ),
E.th ( L_ALIGN, TOP_VALIGN, osContent ),
E.th ( L_ALIGN, TOP_VALIGN, deviceContent ) ) )