degal/config.py
author Tero Marttila <terom@fixme.fi>
Fri, 05 Jun 2009 21:46:43 +0300
changeset 60 406da27a4be2
parent 57 8d06e0283b88
child 67 01220ae43902
permissions -rw-r--r--
do some filesystem.Path stuff, and read_only mode
"""
    Configuration
"""

class Configuration (object) :
    """
        Various configuration settings
    """

    # the path to the gallery
    gallery_path        = "."

    # the name of the gallery
    gallery_title       = "Image Gallery"

    # recognized image extensions
    image_exts          = ('jpg', 'jpeg', 'png', 'gif', 'bmp')
    
    # subdirectory used for generated thumbnails/previews
    thumb_dir           = 'thumbs'
    preview_dir         = 'previews'

    # size of generated thumbnails/previews
    thumb_size          = (160, 120)
    preview_size        = (640, 480)

    # number of images displayed per folder page
    images_per_page     = 50
    
    # exif tags used in output
    # Copyright (C) 2008, Santtu Pajukanta <santtu@pajukanta.fi>
    # XXX: import from dexif?
    exif_tags           = [
        # TODO Create date is in a useless format, needs some strptime love
        ("CreateDate",              "Create date"               ),
        ("Model",                   "Camera model"              ),
        ("Aperture",                "Aperture"                  ),
        ("ExposureMode",            "Exposure mode"             ),
        ("ExposureCompensation",    "Exposure compensation"     ),
        ("ExposureTime",            "Exposure time"             ),
        ("Flash",                   "Flash mode"                ),
        ("ISO",                     "ISO"                       ),
        ("ShootingMode",            "Shooting mode"             ),
        ("LensType",                "Lens type"                 ),
        ("FocalLength",             "Focal length"              )
    ]
    
    ## runtime settings

    # do not modify anything
    read_only           = False


    ### functions
    def is_image (self, file) :
        """
            Tests if the given File is an image, based on its file extension
        """

        return file.matchext(self.image_exts)

    # XXX: move elsewhere?
    def get_renderer (self) :
        return render.RenderMachine(self)