--- a/degal/folder.py Sun Jun 14 20:05:11 2009 +0300
+++ b/degal/folder.py Sun Jun 14 22:52:07 2009 +0300
@@ -13,13 +13,51 @@
A Folder is a filesystem Directory that contains any number of other Folders and Images.
"""
+ def iter_config_files (self) :
+ """
+ Iterate over the possible config files for this dir
+ """
+
+ yield self.subfile('degal.cfg')
+ yield self.subdir('.degal').subfile('cfg')
+
def __init__ (self, *args, **kwargs) :
super(Folder, self).__init__(*args, **kwargs)
- # info
- self.title = self.name.title()
- self.description = None
-
+ # find config
+ for file in self.iter_config_files() :
+ if file.exists() :
+ # yay! More configuration!
+ self.config = self.config.load(file.path)
+
+ break
+
+ # load some info from title?
+ if self.config and self.config.title :
+ self.title = self.config.title
+
+ # disable it so it won't be used by children
+ # XXX: figure out a better way of doing this
+ self.config.title = None
+
+ @lazy_load
+ def title (self) :
+ """
+ Find the title for this dir
+ """
+
+ # default
+ return self.name.title()
+
+ @lazy_load
+ def description (self) :
+ """
+ Find the descriptive text for this dir
+ """
+
+ # default
+ return None
+
@lazy_load
def preview_dir (self) :
"""