Next / Previous / Contents / TCC Help System / NM Tech homepage

10. The main program

The code starts with by setting up the Txny object containing the reference taxonomy, and the root ImageCatalog object containing the descriptions of cataloged images.

catweb
# - - - - -   m a i n

def main():
    '''Main program.

      [ index page  :=  taxonomy with links to form pages from
            photo archive indices named on the command line
        those form pages  :=  their content from those indices ]
    '''
    #-- 1
    # [ the current directory has a readable, valid aou.xml file ->
    #     txny  :=  a Txny object representing that file ]
    txny = xnomo3.Txny()

    #-- 2
    # [ the current directory has a readable, valid
    #   birdimages.xml file ->
    #     catalog  :=  a birdimages.ImageCatalog object
    #                  representing that file ]
    catalog = birdimages.ImageCatalog.readFile(BIRD_IMAGE_CATALOG)

We start building the tree of taxa by instantiating a TaxonPhotoSet object linked to the root taxon from txny.

catweb
    #-- 3
    # [ rootTaxon  :=  a TaxonPhotoSet for txny.root ]
    rootTaxon = TaxonPhotoSet(txny.root)

Now we are ready to process the names of the index files from the command line. Each file describes the contents of one archive; the entries for each file are added to rootTaxon.

catweb
    #-- 4
    # [ rootTaxon  :=  rootTaxon with photos from archives named
    #       on the command line, placed into taxa from txny, using
    #       forms from catalog ]
    for archFileName in sys.argv[1:]:
        addArchive(txny, catalog, rootTaxon, archFileName)

Everything we need to build the web pages comes from the rootTaxon object.

catweb
    #-- 5
    # [ index page  :=  taxonomy with links to form pages from
    #       rootTaxon
    #   form pages from rootTaxon  :=  content from rootTaxon ]
    buildWeb(rootTaxon)