From c9e654d5a23f9ca5e171cf24d63a8c2d169338cb Mon Sep 17 00:00:00 2001 From: Ady Liu Date: Mon, 24 Feb 2014 15:02:05 +0800 Subject: [PATCH] reading sprite config with project level --- glue/core.py | 5 +++++ glue/managers/project.py | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/glue/core.py b/glue/core.py index 05fd691..1f92e99 100644 --- a/glue/core.py +++ b/glue/core.py @@ -32,6 +32,11 @@ def clean(value): return {} return dict([[k, clean(config.get(section, k))] for k in keys]) +class ProjectConfig(ConfigurableFromFile): + def __init__(self,config_path): + self.config_path = config_path + def items(self): + return self._get_config_from_file('sprite.conf','sprite') class Image(ConfigurableFromFile): diff --git a/glue/managers/project.py b/glue/managers/project.py index 503b0f3..c04661d 100644 --- a/glue/managers/project.py +++ b/glue/managers/project.py @@ -2,7 +2,7 @@ from glue.exceptions import NoSpritesFoldersFoundError from .base import BaseManager - +from glue.core import ProjectConfig class ProjectManager(BaseManager): """Process a path searching for folders that contain images. @@ -12,6 +12,8 @@ class ProjectManager(BaseManager): def find_sprites(self): + self.config.update( ProjectConfig(self.config['source']).items() ) + for filename in sorted(os.listdir(self.config['source'])): # Only process folders