# Module gallery_param
"""This module includes the class Gal_Param, with its defaults, and 
other Gallery constants.
"""


# CONSTANTS -----------------------------------------------------------------

#defaults
PICDOCFILE = "picdocs.txt"
MIN_MEDIUM = 100
MAX_MEDIUM = 2000
MIN_THUMB = 50
MAX_THUMB = 400
MAX_THUMB_TITLE = 5

# conventions
FILENAME_MARK = "###" # As 1st nonblank chars, marks filename line
                      # which is the first line of a picture description
F_MARK_LEN = len(FILENAME_MARK)                      
THUMB = '_thumb'
MEDIUM = '_web'
PIC_EXT = ".jpg"
MAX_BASE = 25  # truncates file names made from titles

def stdout_print(s):
    print s

    
class Gal_Param: #==========================================================
    """ User parameters for Gallery Processing."""
    
    def __init__(self):
        self.new_gal_under=""
        self.orig_pic_action='m'
        self.use_titles=True
        self.remove_blanks = True
        self.big_pics_linked = True
        self.gallery_title = ""
        self.thumb_option = True
        self.thumb_dim = (160, 120)
        self.medium_option = True
        self.medium_dim = (640, 640)
        self.force_conversion = False
        self.lines_in_thumb_label = 2
        self.display = stdout_print
        self.console = False
        
    def copy(self):
        """Create shallow copy (all attrib immutable, so OK).
        """
        
        c = Gal_Param()
        for atr in dir(self):
            setattr(c, atr, getattr(self, atr))
        return c
    
    
# End of class Gal_Param ===================================================
if __name__ == "__main__":
    p = Gal_Param()
    p.gallery_title = "newtitle"
    print "p:", p.__dict__
    cp = p.copy()
    print "cp:", cp.__dict__
    p.gallery_title = ""
    print "cp after p changed:", cp.__dict__
    