#!/usr/bin/python # -*- coding: utf-8 -*- # # Pyromaths # Un programme en Python qui permet de créer des fiches d'exercices types de # mathématiques niveau collège ainsi que leur corrigé en LaTeX. # Copyright (C) 2006 -- Jérôme Ortais (jerome.ortais@pyromaths.org) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # import random import string import pythagore import puissances import developpements import calcul_mental import fractions from outils import ecrit_tex, randrange, tex_entete from pyro_classes import WriteFiles import os.path import gettext import locale locale.setlocale(locale.LC_ALL, "") locale.textdomain("pyromaths") gettext.textdomain("pyromaths") _=locale.gettext def main(lst, fiche_exos, fiche_corrige, entete): modules = ( calcul_mental.main, fractions.exo_sommes_fractions, fractions.exo_produits_fractions, fractions.exo_priorites_fractions, puissances.tex_proprietes, puissances.tex_proprietes_neg, puissances.ecr_sc, puissances.exo_puissances, developpements.exo_distributivite, developpements.exo_double_distributivite, pythagore.exo_pythagore, pythagore.exo_reciproque_pythagore, pythagore.exo_triangle_cercle, pythagore.exo_thales, pythagore.exo_trigo, ) fiche_metapost = os.path.splitext(fiche_exos)[0] + '.mp' files = WriteFiles(fiche_exos, fiche_corrige, fiche_metapost, entete) files.f0.write(_('\\chead{\\Large{\\textsc{Fiche de r\\\'evisions}}}\n')) files.f1.write(_("\\chead{\\Large{\\textsc{Corrige de la fiche de r\\'evisions}}}\n")) files.f0.write(_('\\rhead{\\textsl{\\footnotesize{Classe de 4\\ieme}}}\n')) files.f1.write(_('\\rhead{\\textsl{\\footnotesize{Classe de 4\\ieme}}}\n')) for j in xrange(len(modules)): for i in xrange(lst[j]): WriteFiles.write(files, modules[j]()) WriteFiles.close(files)