move default theme in themes folder

This commit is contained in:
Adrien Beudin 2016-02-22 16:29:36 +01:00
parent 095034b117
commit bf986ded7d
70 changed files with 22 additions and 19 deletions

View File

@ -1,4 +1,2 @@
recursive-include templates *
recursive-include static *
recursive-include themes * recursive-include themes *
include requirements.txt include requirements.txt

View File

@ -10,11 +10,6 @@ from jinja2 import Environment, FileSystemLoader
from .cache import CACHE from .cache import CACHE
from .utils import error from .utils import error
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
index_template = templates.get_template("index.html")
gallery_index_template = templates.get_template("gallery-index.html")
page_template = templates.get_template("page.html")
SETTINGS = { SETTINGS = {
"show_date": True, "show_date": True,
"gm": { "gm": {
@ -118,19 +113,21 @@ def main():
# XXX recursively merge directories # XXX recursively merge directories
if os.path.exists(os.path.join(os.getcwd(), "build", "static")): if os.path.exists(os.path.join(os.getcwd(), "build", "static")):
shutil.rmtree(os.path.join(os.getcwd(), "build", "static")) shutil.rmtree(os.path.join(os.getcwd(), "build", "static"))
if settings.get("theme"):
if os.path.exists(os.path.join(os.getcwd(), "templates")): if settings.get("theme") is None:
shutil.rmtree(os.path.join(os.getcwd(), "templates")) gallery_theme = "exposure"
shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", settings.get("theme"), "static"), os.path.join(os.getcwd(), "build", "static")) else:
shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", settings.get("theme"), "templates"), os.path.join(os.getcwd(), "templates")) gallery_theme = settings.get("theme")
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
index_template = templates.get_template("index.html") if os.path.exists(os.path.join(os.getcwd(), "static")):
gallery_index_template = templates.get_template("gallery-index.html")
page_template = templates.get_template("page.html")
elif os.path.exists(os.path.join(os.getcwd(), "static")):
shutil.copytree(os.path.join(os.getcwd(), "static"), os.path.join(os.getcwd(), "build", "static")) shutil.copytree(os.path.join(os.getcwd(), "static"), os.path.join(os.getcwd(), "build", "static"))
else: else:
shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "static"), os.path.join(os.getcwd(), "build", "static")) shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", gallery_theme, "static"), os.path.join(os.getcwd(), "build", "static"))
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", gallery_theme, "templates")]))
index_template = templates.get_template("index.html")
gallery_index_template = templates.get_template("gallery-index.html")
page_template = templates.get_template("page.html")
for gallery in dirs: for gallery in dirs:
gallery_settings = yaml.safe_load(open(os.path.join(os.getcwd(), gallery, "settings.yaml"), "r")) gallery_settings = yaml.safe_load(open(os.path.join(os.getcwd(), gallery, "settings.yaml"), "r"))

View File

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 211 KiB

View File

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 194 KiB

View File

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 184 KiB

View File

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 193 KiB

View File

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 187 KiB

View File

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 184 KiB

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 168 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

@ -28,6 +28,7 @@
</div> </div>
<script type="text/javascript" src="../static/js/jquery-2.1.4.min.js" charset="utf-8"></script> <script type="text/javascript" src="../static/js/jquery-2.1.4.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../static/js/materialize.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../static/js/baguetteBox.min.js" charset="utf-8"></script> <script type="text/javascript" src="../static/js/baguetteBox.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../static/js/jquery.panorama_viewer.min.js" charset="utf-8"></script> <script type="text/javascript" src="../static/js/jquery.panorama_viewer.min.js" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
@ -41,6 +42,11 @@
overlay: true overlay: true
}); });
}); });
$(document).ready(function(){
$('.scrollspy').scrollSpy();
});
</script> </script>
<footer> <footer>
<p>Generated using <a href="https://github.com/psycojoker/prosopopee">Prosopopée</a> · content under <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a> · atom logo by <a href="https://thenounproject.com/jjjon/">Jonathan Li</a> under <a href="https://creativecommons.org/licenses/by/3.0/">CC-BY</a></p> <p>Generated using <a href="https://github.com/psycojoker/prosopopee">Prosopopée</a> · content under <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a> · atom logo by <a href="https://thenounproject.com/jjjon/">Jonathan Li</a> under <a href="https://creativecommons.org/licenses/by/3.0/">CC-BY</a></p>

View File

@ -1,8 +1,10 @@
<section class="paragraph"> <section class="paragraph">
{% if section.title %} {% if section.title %}
<div id="{{ section.title }}" class="scrollspy">
<h2>{{ section.title }}</h2> <h2>{{ section.title }}</h2>
{% else %} {% else %}
<div class="separator"><div> <div class="separator"><div>
{% endif %} {% endif %}
<p>{{ section.text }}</p> <p>{{ section.text }}</p>
</div>
</section> </section>

View File

@ -30,6 +30,6 @@ setup(name='prosopopee',
keywords='', keywords='',
include_package_data=True, include_package_data=True,
package_data={ package_data={
'prosopopee': ["themes/*/*/*/*"] + ["static/%s/*" % x for x in os.listdir("./prosopopee/static/")] + ['templates/*.html', 'templates/sections/*'], 'prosopopee': ['themes/*/*/*/*'] + ['themes/*/templates/*.html'] + ['themes/*/templates/section/*.html']
}, },
) )