Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mayer <christian.mayer@student.tugraz.at>2010-01-06 17:55:35 (GMT)
committer Christian Mayer <christian.mayer@student.tugraz.at>2010-01-06 17:57:31 (GMT)
commitf2bfbd8ed15cc43f7160b48afdaec2b3e923f879 (patch)
tree7dfe169bd3b5ca35974672a3de7b5be268a1b920
parent154d450518fd1d7fd8001a87392909c8296f4c4a (diff)
moved Learner#notify('start-calcs') into separate method
-rwxr-xr-xReckonPrimer.activity/coach.py4
-rw-r--r--ReckonPrimer.activity/learner.py19
2 files changed, 11 insertions, 12 deletions
diff --git a/ReckonPrimer.activity/coach.py b/ReckonPrimer.activity/coach.py
index a8bc09f..a3fed96 100755
--- a/ReckonPrimer.activity/coach.py
+++ b/ReckonPrimer.activity/coach.py
@@ -33,14 +33,14 @@ class Coach:
def exercise_selected(self, key):
self._ex = self._collect.select(key)
- self._learner.notify(('start-calcs', self._ex))
+ self._learner.start_calcs(self._ex)
def notify(self, (msg, data)):
"""called by the observed objects"""
print("in coach.notify: msg=, data=", (msg, data))
if msg == 'setting-done': # from display
self._ex.update_setting(data)
- self._learner.notify(('start-calcs', self._ex))
+ self._learner.start_calcs(self._ex)
elif msg == 'switch-to-setts': # from display
self._ex = self._collect.select(data)
self._dis.offer_setting(self._ex)
diff --git a/ReckonPrimer.activity/learner.py b/ReckonPrimer.activity/learner.py
index fcbaf85..01e9562 100644
--- a/ReckonPrimer.activity/learner.py
+++ b/ReckonPrimer.activity/learner.py
@@ -18,18 +18,17 @@ class Learner:
self._coach.request_exercise()
self._display.init_calc() #TODOWN091101 take Exercise as argument
+ def start_calcs(self, exercise):
+ self._ex = exercise
+ self._display.set_curr_exerc(exercise)
+ _calc = self._ex.get_next_calc()
+ _lines, self._input = exercise.format(_calc)
+ self._display.display_calc(_lines)
+ self._curr_in = self._input.pop() #need _curr_in in notify
+ self._display.create_entryline(self._curr_in)
+
def notify(self, (msg, data)):
'''called by the observed objects'''
- #print('in learner.notify: msg=,data=', msg, data)
- if msg == 'start-calcs': # from Coach
- self._ex = data
- self._display.set_curr_exerc(data)
- _calc = self._ex.get_next_calc()
- _lines, self._input = data.format(_calc)
- self._display.display_calc(_lines)
- self._curr_in = self._input.pop() #need _curr_in in notify
- self._display.create_entryline(self._curr_in)
- # create_entryline sets the callback from gtk to display
if msg == 'digit-done': # from Display
#print('in learner.notify, digit-done: _input=', self._input)
(lino, pos, dig, proterr, protok, li) = self._curr_in