mathmaker  0.4(alpha)
mathmaker_dev/sheet/AlgebraMiniTest1.py
00001 # -*- coding: utf-8 -*-
00002 
00003 # Mathmaker creates automatically maths exercises sheets
00004 # with their answers
00005 # Copyright 2006-2014 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 from S_Structure import S_Structure
00027 
00028 FONT_SIZE_OFFSET = -1
00029 SHEET_LAYOUT_TYPE = 'mini_test'
00030 SHEET_LAYOUT_UNIT = "cm"
00031 #EXAMPLE OF A SHEET NOT USING ANY LAYOUT
00032 # -----------------------  lines_nb    col_widths   exercises
00033 SHEET_LAYOUT = { 'exc' : [ [1,         9, 9],       (1, 1)
00034                          ],
00035                  'ans' : [ None,                    'all'
00036                          ]
00037                }
00038 #ANOTHER EXAMPLE
00039 # ------------------------  lines_nb    col_widths   exercises
00040 #SHEET_LAYOUT = { 'exc' : [ [1,         6, 15],      (1, 1),
00041 #                            None,                    1
00042 #                         ],
00043 #                 'ans' : [ [1,         6.5, 12],    (1, 1),
00044 #                            'jump',                 'next_page',
00045 #                            None,                    1
00046 #                         ]
00047 #               }
00048 # NOTE THAT FOR SHORT_TEST SHEETS, THE LAYOUT HAS TO BE GIVEN ONLY ONCE
00049 # AND IT WILL BE DUPLICATED FOR THE SECOND SET OF EXERCISES
00050 
00051 # EXPLANATION ABOUT THE EXAMPLE OF SHEET_LAYOUT :
00052 # [1, 6, 15] means a table of 1 line with columns widths 6 and 15.
00053 # (1, 1) means one exercise in each of these two cells.
00054 # This tuple should contains as many numbers as nb of lines × nb of cols.
00055 # To leave one cell empty, just write 0.
00056 # None means no tabular and the following 1 means for the 1 next exercise.
00057 # 'all' and 'all_left' are synonym
00058 # 'jump' and 'next_page' will include a jump to next page before the next ones
00059 
00060 # ------------------------------------------------------------------------------
00061 # --------------------------------------------------------------------------
00062 # ------------------------------------------------------------------------------
00063 ##
00064 # @class AlgebraMiniTest1
00065 # @brief One expansion (randomly but sum of 2 expandables) + 2 factorizations
00066 class AlgebraMiniTest1(S_Structure):
00067 
00068 
00069 
00070 
00071 
00072     # --------------------------------------------------------------------------
00073     ##
00074     #   @brief Constructor
00075     #   @param embedded_machine The machine to be used
00076     #   @param **options Any options
00077     #   @return One instance of sheet.AlgebraMiniTest1
00078     def __init__(self, embedded_machine, **options):
00079         self.derived = True
00080         S_Structure.__init__(self, embedded_machine, FONT_SIZE_OFFSET,
00081                              SHEET_LAYOUT_UNIT, SHEET_LAYOUT,
00082                              SHEET_LAYOUT_TYPE)
00083 
00084         # BEGINING OF THE ZONE TO REWRITE (see explanations below) ------------
00085         self.header = _("Name : ....................... Class : ...........")
00086         self.title = _("Mini Test : Algebra")
00087         self.subtitle = ""
00088         self.text = ""
00089         self.answers_title = _("Examples of answers")
00090 
00091         for i in xrange(2):
00092             ex1 = exercise.X_AlgebraExpressionExpansion(self.machine,
00093                                                 x_kind='mini_test',
00094                                                 x_subkind='two_expansions_hard')
00095             self.exercises_list.append(ex1)
00096 
00097             ex2 = exercise.X_Factorization(self.machine,
00098                                            x_kind='mini_test',
00099                                            x_subkind='two_factorizations',
00100                                            start_number=2)
00101             self.exercises_list.append(ex2)
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110         # END -----------------------------------------------------------------