terom@64: """ terom@64: Top-level gallery state terom@64: """ terom@64: terom@64: import filesystem, folder, resources terom@64: terom@64: from utils import lazy_load terom@64: terom@64: class Gallery (filesystem.Root, folder.Folder) : terom@64: """ terom@64: A Gallery is a single place in the filesystem which acts as a Folder of Images, but had some additional stuff terom@64: """ terom@64: terom@64: def __init__ (self, path, config) : terom@64: """ terom@64: Build a Gallery rooted at the given filesystem path, and using the given user configuration. terom@64: terom@64: XXX: replace path with config.gallery_path? terom@64: """ terom@64: terom@64: super(Gallery, self).__init__(path, config) terom@64: terom@64: @lazy_load terom@64: def degal_dir (self) : terom@64: """ terom@64: The dir containing the degal configuration. terom@64: terom@64: It will be created if it does not exist. terom@64: """ terom@64: terom@73: return self.subdir('.degal', create=True) terom@73: terom@64: @lazy_load terom@64: def stylesheet (self) : terom@64: """ terom@64: The stylesheet file. terom@64: terom@64: It will be copied from internal resources if it does not exist. terom@64: """ terom@64: terom@64: stylesheet = self.degal_dir.subfile('style.css') terom@64: terom@82: if not stylesheet.exists() : terom@64: # copy it from resources terom@64: stylesheet.copy_from(resources.STATIC_DIR.subfile('style.css')) terom@64: terom@64: return stylesheet terom@64: terom@77: @lazy_load terom@77: def version (self) : terom@77: """ terom@77: Return version string terom@77: """ terom@77: terom@77: return "???"