00001 # -*- coding: utf-8 -*- 00002 00003 # Mathmaker creates automatically maths exercises sheets 00004 # with their answers 00005 # Copyright 2006-2009 Nicolas Hainaux <nico_h@users.sourceforge.net> 00006 00007 # This file is part of Mathmaker. 00008 00009 # Mathmaker is free software; you can redistribute it and/or modify 00010 # it under the terms of the GNU General Public License as published by 00011 # the Free Software Foundation; either version 3 of the License, or 00012 # any later version. 00013 00014 # Mathmaker is distributed in the hope that it will be useful, 00015 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 # GNU General Public License for more details. 00018 00019 # You should have received a copy of the GNU General Public License 00020 # along with Mathmaker; if not, write to the Free Software 00021 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 00023 import machine 00024 import exercise 00025 00026 import Structure 00027 # ----------------------------------------------------------------------------- 00028 # ----------------------------------------------- CLASS: sheet.Model ---------- 00029 # ----------------------------------------------------------------------------- 00030 ## 00031 # @class Model 00032 # @brief Use it as a copy/paste model to create new sheets. 00033 class Model(Structure.Structure): 00034 00035 00036 00037 00038 00039 # -------------------------------------------------- CONSTRUCTOR ---------- 00040 ## 00041 # @brief Constructor 00042 # @param embedded_machine The machine to be used 00043 # @param **options Any options 00044 # @return One instance of sheet.Model 00045 def __init__(self, embedded_machine, **options): 00046 # This method saves the machine & creates the exercises. 00047 self.machine = embedded_machine 00048 self.exercises_list = list() 00049 00050 # BEGINING OF THE ZONE TO REWRITE (see explanations below) ------------ 00051 self.header = "" 00052 self.title = _("Training exercises sheet :") 00053 self.subtitle = "" 00054 self.text = "" 00055 self.answers_title = _("Examples of answers") 00056 00057 # For instance : 00058 # ex1 = exercise.ProductReduction(self.machine, many=30) 00059 # self.exercises_list.append(ex1) 00060 00061 00062 00063 00064 00065 00066 # END ----------------------------------------------------------------- 00067 # Instructions for use (creating a new sheet) : 00068 # - Put its name in the header's comment 00069 # & in the one of the documentation (@class) 00070 # - Write the @brief comment 00071 # - Replace Model by the chosen name 00072 # - In the constructor's comment, replace Model by the chosen name at 00073 # the @return line 00074 # - Skip to the zone to rewrite and for each exercise, follow the 00075 # example (i.e. write on two lines : 00076 # - ex_number_n = exercise.ThmPythagore(self.machine, options...) 00077 # - self.exercises_list.append(ex_number_n) 00078 # and so on with ex<n+1>, ex<n+2> as many as desired)