mathmaker  0.4(alpha)
mathmaker_dev/sheet/exercise/question/Q_Model.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 from lib import *
00024 from Q_Structure import Q_Structure
00025 
00026 #from core.base_calculus import *
00027 
00028 # AVAILABLE_Q_KIND_VALUES lists so : {'q_kind1' : ['q_subkind1',
00029 #                                                  'q_subkind2',
00030 #                                                   etc.],
00031 #                                     'q_kind2' : ...}
00032 
00033 AVAILABLE_Q_KIND_VALUES = {'A' : ['default',
00034                                   '1',
00035                                   '2'],
00036                            'B' : ['default',
00037                                   '1',
00038                                   '2'],
00039                            'C' : ['default',
00040                                   '1',
00041                                   '2']}
00042 
00043 
00044 
00045 # ------------------------------------------------------------------------------
00046 # --------------------------------------------------------------------------
00047 # ------------------------------------------------------------------------------
00048 ##
00049 # @class Q_Model
00050 # @brief Use it as a copy/paste model to create new questions.
00051 class Q_Model(Q_Structure):
00052 
00053 
00054 
00055 
00056 
00057     # --------------------------------------------------------------------------
00058     ##
00059     #   @brief Constructor.
00060     #   @param embedded_machine The machine to be used
00061     #   @param **options Any options
00062     #   @return One instance of question.Q_Model
00063     def __init__(self, embedded_machine, q_kind='default_nothing', **options):
00064         self.derived = True
00065 
00066         # The call to the mother class __init__() method will set the
00067         # fields matching optional arguments which are so far :
00068         # self.q_kind, self.q_subkind
00069         # plus self.machine, self.options (modified)
00070         Q_Structure.__init__(self, embedded_machine,
00071                              q_kind, AVAILABLE_Q_KIND_VALUES,
00072                              **options)
00073         # The purpose of this next line is to get the possibly modified
00074         # value of **options
00075         options = self.options
00076 
00077 
00078         # Here you can begin to write code for the different
00079         # q_kinds & q_subkinds
00080         # if self.q_kind == '...':
00081         #    if self.q_subkind == '...':
00082         # etc.
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092     # --------------------------------------------------------------------------
00093     ##
00094     #   @brief Returns the text of the question as a str
00095     def text_to_str(self):
00096         M = self.machine
00097         result = ""
00098 
00099         return result
00100 
00101 
00102 
00103 
00104 
00105 
00106     # --------------------------------------------------------------------------
00107     ##
00108     #   @brief Returns the answer of the question as a str
00109     def answer_to_str(self):
00110         M = self.machine
00111         result = ""
00112 
00113         return result
00114 
00115 
00116 
00117 
00118