tools/gen_gallery.py script¶
Generate the images and rst files for gallery of SfePy examples.
The following steps need to be made to regenerate the documentation with the updated example files:
remove doc/examples/*:
$ rm -rf doc/examples/*
generate the files:
$ ./tools/gen_gallery.py
regenerate the documentation:
$ python setup.py htmldocs
- gen_gallery.generate_gallery(examples_dir, output_filename, doc_dir, rst_dir, thumbnails_dir, dir_map, n_col=3)[source]¶
Generate the gallery rst file with thumbnail images and links to examples.
- Parameters:
- output_filenamestr
The output rst file name.
- doc_dirstr
The top level directory of gallery files.
- rst_dirstr
The full path to rst files of examples within doc_dir.
- thumbnails_dirstr
The full path to thumbnail images within doc_dir.
- dir_mapdict
The directory mapping returned by generate_rst_files()
- n_colint
The number of columns in the gallery table.
- gen_gallery.generate_images(images_dir, examples_dir, pattern='*.py')[source]¶
Generate images from results of running examples found in examples_dir directory.
The generated images are stored to images_dir,
- gen_gallery.generate_rst_files(rst_dir, examples_dir, images_dir, pattern='*.py')[source]¶
Generate Sphinx rst files for examples in examples_dir with images in images_dir and put them into rst_dir.
- Returns:
- dir_mapdict
The directory mapping of examples and corresponding rst files.
- gen_gallery.generate_thumbnails(thumbnails_dir, images_dir, scale=0.3)[source]¶
Generate thumbnails into thumbnails_dir corresponding to images in images_dir.
- gen_gallery.run_resview_plot(*args)[source]¶
A fix for the problem that calling
resview_plot()
directly often terminates the program.