mathmaker  0.4(alpha)
mathmaker_dev/sheet/EquationsShortTest.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 = 'short_test'
00030 SHEET_LAYOUT_UNIT = "cm"
00031 # -----------------------  lines_nb    col_widths   exercises
00032 SHEET_LAYOUT = { 'exc' : [ None,                    'all'
00033                          ],
00034                  'ans' : [ [1,         9, 9],        (1, 1),
00035                            None,                    1
00036                          ]
00037                }
00038 
00039 # ------------------------------------------------------------------------------
00040 # --------------------------------------------------------------------------
00041 # ------------------------------------------------------------------------------
00042 ##
00043 # @class EquationsShortTest
00044 # @brief A short test on first degree equations
00045 class EquationsShortTest(S_Structure):
00046 
00047 
00048 
00049 
00050 
00051     # --------------------------------------------------------------------------
00052     ##
00053     #   @brief Constructor
00054     #   @param embedded_machine The machine to be used
00055     #   @param **options Any options
00056     #   @return One instance of sheet.Model
00057     def __init__(self, embedded_machine, **options):
00058         self.derived = True
00059         S_Structure.__init__(self, embedded_machine, FONT_SIZE_OFFSET,
00060                              SHEET_LAYOUT_UNIT, SHEET_LAYOUT,
00061                              SHEET_LAYOUT_TYPE)
00062 
00063         # BEGINING OF THE ZONE TO REWRITE (see explanations below) ------------
00064         self.header = _("Name : .......................................")
00065         self.title = _("Short Test : Equations")
00066         self.subtitle = ""
00067         self.text = _("Solve the following equations.")
00068         self.answers_title = _("Examples of answers")
00069 
00070         # Exercises :
00071         for i in xrange(2):
00072             ex1 = exercise.X_Equation(self.machine,
00073                                       x_kind='short_test',
00074                                       x_subkind='basic')
00075 
00076             ex2 = exercise.X_Equation(self.machine,
00077                                       x_kind='short_test',
00078                                       x_subkind='classic')
00079 
00080             ex3 = exercise.X_Equation(self.machine,
00081                                       x_kind='short_test',
00082                                       x_subkind='harder')
00083 
00084             self.exercises_list.append(ex1)
00085             self.exercises_list.append(ex2)
00086             self.exercises_list.append(ex3)
00087 
00088 
00089 
00090 
00091     # --------------------------------------------------------------------------
00092     ##
00093     #   @brief Writes to the output all exercises' answers
00094     #def write_answers(self, first_and_last):
00095     #    first = first_and_last[0]
00096     #    last = first_and_last[1]
00097 
00098     #    self.machine.reset_exercises_counter()
00099     #    self.machine.write_set_font_size_to('large')
00100 
00101     #    self.machine.write_exercise_number()
00102     #    self.exercises_list[first].write_answer()
00103     #    self.machine.write_new_line()
00104 
00105     #    self.machine.write_tabular_begins("p{9 cm} p{9 cm}")
00106 
00107     #    self.machine.write_exercise_number()
00108     #    self.exercises_list[first+1].write_answer()
00109 
00110     #    self.machine.write_separator_tabular_columns()
00111 
00112     #    self.machine.write_exercise_number()
00113     #    self.exercises_list[first+2].write_answer()
00114 
00115     #    self.machine.write_tabular_ends()
00116 
00117 
00118 
00119 
00120 
00121     # END ---------------------------------------------------------------------