diff options
author | Walther Neuper <neuper@neuper.(none)> | 2009-12-12 10:25:56 (GMT) |
---|---|---|
committer | Walther Neuper <neuper@neuper.(none)> | 2009-12-12 10:25:56 (GMT) |
commit | 661e107f103538efa7f703b562cbe55edecf2d9c (patch) | |
tree | 5e022f7ea2a78553575d3fad7ebe5c308dd0096b | |
parent | 1fb6e03c37b8c069c79e8f11c348ad624d14043b (diff) |
mv Exercise.py to exercise.py
-rwxr-xr-x | ReckonPrimer.activity/Exercise.py | 89 | ||||
-rwxr-xr-x | ReckonPrimer.activity/coach.py | 2 | ||||
-rwxr-xr-x | ReckonPrimer.activity/display.py | 2 | ||||
-rwxr-xr-x | ReckonPrimer.activity/exaddsimp.py | 2 | ||||
-rw-r--r-- | ReckonPrimer.activity/exaddsub.py | 2 | ||||
-rw-r--r-- | ReckonPrimer.activity/exmult.py | 2 | ||||
-rwxr-xr-x | ReckonPrimer.activity/expassten.py | 2 | ||||
-rw-r--r-- | ReckonPrimer.activity/extimesadd.py | 2 | ||||
-rwxr-xr-x | ReckonPrimer.activity/extimesdiv.py | 2 |
9 files changed, 8 insertions, 97 deletions
diff --git a/ReckonPrimer.activity/Exercise.py b/ReckonPrimer.activity/Exercise.py deleted file mode 100755 index e343cf8..0000000 --- a/ReckonPrimer.activity/Exercise.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- -from functions import contain, collect_digits, make_line, make_input -from functions import make_line_remainder, make_input_remainder - -class Exercise: - """This is the base class for the individual exercises. - An exercise is characterized by a topic. A topic determines the - fields of the settings self._sett and public methods of Exercise. - The values of self._sett may vary from exercise to exercise. - """ - def __init__(self): - """ An Exercise has a title, i.e. short textual description, - set by the author for display in the Collection. """ - self._title = None - """ An Exercise has a detailed textual description - set by the author. """ - self._description = None - """ An Exercise is characterized by an icon set by the author. """ - self._icon = None - """ An Exercise stores data on evaluation, i.e. on how often the - Exercise has been done, what errors have been made TODO """ - self._eval = None - """ The settings determine the generation of calculations. - The fields of the settings are determined by self._sett['topic']; - the values of the settings are different for different Exercises. - self._sett['calclines'] determines the # of lines in a calculation.""" - self._sett = None - """ Calculations are generated according to the settings. """ - self._calcs = None - """ An Exercise needs the Display for updating the settings""" - self._display = None - - def get_topic(self): - """The topic is preliminarily used to identify an exercise.""" - return (self._sett)['topic'] - - def get_setting(self): - return self._sett - - def update_setting(self, sett): - """ Update the settings and generate calculations accordingly. """ - self._sett = sett - self._calcs = self._generate_calcs() - - def get_calcs(self): - """ Get all calculations generated by the current settings. """ - return self._calcs - - def get_next_calc(self): - """ Get the next calculation from the Exercise. - TODO.WN091123: handle exception after last exercise. """ - return (self._calcs).pop() - - def count(self): - """ Return the number of calculations generated by - the current settings """ - return len(self._calcs) - - def format_addsub_simp(self, (calc, linepos)): - """ Prepare the representation of a calculation for Display - on 1 line. Used within several subclasses. """ - #@print('in Display.format_addsub_simp: calc=', (calc, linepos))#@ - _ccs = collect_digits(calc) - #print('in Exercise.format_addsub_simp: _ccs=',_ccs ) - _l0 = make_line(_ccs, linepos) - _ip = make_input(_ccs, linepos) - #@print('in Display.format_addsub_simp: return=', ([_l0], _ip)) #@ - return ([_l0], _ip) -#return ([[' ', '1', '0', ' ', '-', ' ', '7', ' ', '=', ' ', '_', ' ']], [(0, 10, '3', ' 10 - 7 = _ ', ' 10 - 7 = 3 ', [' ', '1', '0', ' ', '-', ' ', '7', ' ', '=', ' ', '3', ' '])]) - - #===== methods of subclasses different for topic-specific settings - def format(self, calc): - """ Prepare the representation of a calculation for Display. - This method is public for eventual use on calculations - coming through the net (TODO cooperative games, etc)""" - pass - - def _generate_calcs(self): - """ Generate calculations according to topic-specific settings. - Called on each call of update_setting""" - pass - - def define_buttons(self): - """ Define buttons for update settings. """ - pass - - def set_buttons(self, sett): - """ Display buttons according to the current setting. """ - pass diff --git a/ReckonPrimer.activity/coach.py b/ReckonPrimer.activity/coach.py index 671eb18..50bf484 100755 --- a/ReckonPrimer.activity/coach.py +++ b/ReckonPrimer.activity/coach.py @@ -5,7 +5,7 @@ import pprint import pickle from settings import Settings from display import Display -from Exercise import Exercise +from exercise import Exercise from exaddsimp import ExAddSimp from expassten import ExPassTen from extimesdiv import ExTimesDiv diff --git a/ReckonPrimer.activity/display.py b/ReckonPrimer.activity/display.py index 684d7ba..d8be96c 100755 --- a/ReckonPrimer.activity/display.py +++ b/ReckonPrimer.activity/display.py @@ -10,7 +10,7 @@ from sugar.activity import activity from functions import * from settings import Settings from timer import Timer -from Exercise import Exercise +from exercise import Exercise from sugar import profile from sugar.graphics import style diff --git a/ReckonPrimer.activity/exaddsimp.py b/ReckonPrimer.activity/exaddsimp.py index 2ea7d4b..9286d38 100755 --- a/ReckonPrimer.activity/exaddsimp.py +++ b/ReckonPrimer.activity/exaddsimp.py @@ -9,7 +9,7 @@ import random import copy from sugar.graphics import style -from Exercise import Exercise +from exercise import Exercise from functions import * class ExAddSimp(Exercise): diff --git a/ReckonPrimer.activity/exaddsub.py b/ReckonPrimer.activity/exaddsub.py index d4d4a7e..36db2f0 100644 --- a/ReckonPrimer.activity/exaddsub.py +++ b/ReckonPrimer.activity/exaddsub.py @@ -2,7 +2,7 @@ #(c) Julia Schönhart 2009 #(c) Daniela Zierler 2009 -from Exercise import Exercise +from exercise import Exercise class ExAddSub(Exercise): def __init__(self, display): diff --git a/ReckonPrimer.activity/exmult.py b/ReckonPrimer.activity/exmult.py index dbd0e5c..4d6259b 100644 --- a/ReckonPrimer.activity/exmult.py +++ b/ReckonPrimer.activity/exmult.py @@ -2,7 +2,7 @@ #(c) Markus Ehrenreich 2009 #(c) Christian Hain 2009 -from Exercise import Exercise +from exercise import Exercise class ExMult(Exercise): def __init__(self, display): diff --git a/ReckonPrimer.activity/expassten.py b/ReckonPrimer.activity/expassten.py index 3a3622a..681be83 100755 --- a/ReckonPrimer.activity/expassten.py +++ b/ReckonPrimer.activity/expassten.py @@ -2,7 +2,7 @@ #(c) Markus Ehrenreich 2009 #(c) Christian Hain 2009 -from Exercise import Exercise +from exercise import Exercise import random import copy from functions import * diff --git a/ReckonPrimer.activity/extimesadd.py b/ReckonPrimer.activity/extimesadd.py index 10813ff..7d975b1 100644 --- a/ReckonPrimer.activity/extimesadd.py +++ b/ReckonPrimer.activity/extimesadd.py @@ -2,7 +2,7 @@ #(c) Martin Neppel 2009 #(c) Walther Neuper 2009 -from Exercise import Exercise +from exercise import Exercise class ExTimesAdd(Exercise): def __init__(self, display): diff --git a/ReckonPrimer.activity/extimesdiv.py b/ReckonPrimer.activity/extimesdiv.py index acf42e9..d2454b2 100755 --- a/ReckonPrimer.activity/extimesdiv.py +++ b/ReckonPrimer.activity/extimesdiv.py @@ -8,7 +8,7 @@ import random import copy from sugar.graphics import style -from Exercise import Exercise +from exercise import Exercise from functions import * class ExTimesDiv(Exercise): |