Changeset 20
- Timestamp:
- May 6, 2014 1:19:25 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/renderer.py
r17 r20 6 6 import shutil 7 7 8 from extern import mako 8 9 from mako.template import Template 9 10 from mako.lookup import TemplateLookup 11 12 import templates 13 import templates.resources as resources 14 10 15 11 16 class Renderer(object): … … 16 21 self.result = result 17 22 23 def copy_resources(self, dirname): 24 outdir = os.path.join(dirname, 'resources') 25 26 # shutil.copytree complains if the output directory exists 27 if os.path.exists(outdir): 28 shutil.rmtree(outdir) 29 30 # copy all uncompressed non-python resources to output directory 31 src = os.path.dirname(resources.__file__) 32 dst = outdir 33 ignore_fn = shutil.ignore_patterns('*.zip','*.py','*.pyc','CVS*') 34 shutil.copytree(src, 35 dst, 36 symlinks=False, 37 ignore=ignore_fn) 38 39 # # unzip fancybox to output directory 40 # infile = os.path.join(src, 'fancybox.zip') 41 # z = zipfile.ZipFile(infile, 'r') 42 # z.extractall(outdir) 43 18 44 def run(self): 19 45 # make a directory to contain this result … … 23 49 24 50 # make a resources directory and copy the Bootstrap stuff there 25 shutil.copytree('dist', os.path.join(dirname, 'resources')) 26 27 # copy the css file there too 28 shutil.copy('bootstrap-3.0.3/examples/navbar-fixed-top/navbar-fixed-top.css', dirname) 51 self.copy_resources(dirname) 29 52 30 53 # where to find the template files 31 mylookup = TemplateLookup(directories=['templates']) 54 templates_dir = os.path.dirname(templates.__file__) 55 mylookup = TemplateLookup(directories=[templates_dir]) 32 56 33 57 # render the simulation steps first
Note:
See TracChangeset
for help on using the changeset viewer.