Commit 3264a2b5 authored by Louis's avatar Louis

Il est maintenant possible d'utiliser un template situé dans le dossier de...

Il est maintenant possible d'utiliser un template situé dans le dossier de configuration de pyromaths
parent fd88d32c
"""Chemin de quelques répertoires propres à Pyromaths."""
import os
import sys
import pkg_resources
DATADIR = pkg_resources.resource_filename("pyromaths", "data")
EXODIR = os.path.join(DATADIR, "exercices")
LOCALEDIR = os.path.join(DATADIR, "locale")
if os.name == 'nt': # Windows
HOME = os.environ['USERPROFILE']
CONFIGDIR = os.path.join(os.environ['APPDATA'], "pyromaths")
elif sys.platform == "darwin": # Mac OS X
HOME = os.environ['HOME']
CONFIGDIR = os.path.join(HOME, "Library", "Application Support", "Pyromaths")
else: # Linux (et autres ?)
HOME = os.environ['HOME']
CONFIGDIR = os.path.join(HOME, ".config", "pyromaths")
......@@ -92,6 +92,7 @@ class Fiche(contextlib.AbstractContextManager):
def write_tex(self):
environment = jinja2tex.LatexEnvironment(
loader=jinja2tex.FileSystemLoader([
os.path.join(directories.CONFIGDIR, 'templates'),
os.path.join(directories.DATADIR, 'templates'),
])
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment