From 8731c9ec1da6a087277eee523519685a0015ba98 Mon Sep 17 00:00:00 2001 From: Walther Neuper Date: Sun, 13 Dec 2009 16:21:47 +0000 Subject: get exercises from collection, coach.create_exercises DELETED --- diff --git a/ReckonPrimer.activity/coach.py b/ReckonPrimer.activity/coach.py index 05fa42e..c6123ca 100755 --- a/ReckonPrimer.activity/coach.py +++ b/ReckonPrimer.activity/coach.py @@ -34,56 +34,53 @@ class Coach: self._collect = collect self._learner = learner - def create_exercises(self): - self._exs = self.create_exs() - - def create_exs(self): - """TODO version preliminary until exs are stored on disk""" +# def create_exercises(self): +# self._exs = self.create_exs() +# +# def create_exs(self): +# """TODO version preliminary until exs are stored on disk""" +# +# ['addsub_simp', 'passten', 'times_div'] +# _ex1 = ExAddSimp(self._dis, None) +# _ex2 = ExPassTen(self._dis, None) +# _ex3 = ExTimesDiv(self._dis, None) +# return[_ex1, _ex2, _ex3] - ['addsub_simp', 'passten', 'times_div'] - _ex1 = ExAddSimp(self._dis, None) - _ex2 = ExPassTen(self._dis, None) - _ex3 = ExTimesDiv(self._dis, None) - return[_ex1, _ex2, _ex3] - - def _update_exs(self, ex): - """update one of the examples known to Coach by topic. - TODO after exs are stored on disk: take ID instead topic - """ - - # print('in Coach.update_ex: ex.topic=', ex.get_topic()) - _exs = [] - for _e in self._exs: - if _e.get_topic() == ex.get_topic(): - _exs.append(ex) - else: - _exs.append(_e) - self._exs = _exs +# def _update_exs(self, ex): +# """update one of the examples known to Coach by topic. +# TODO after exs are stored on disk: take ID instead topic +# """ +# +# # print('in Coach.update_ex: ex.topic=', ex.get_topic()) +# _exs = [] +# for _e in self._exs: +# if _e.get_topic() == ex.get_topic(): +# _exs.append(ex) +# else: +# _exs.append(_e) +# self._exs = _exs def request_exercise(self): """ This preliminary version just lets the Learner select. """ #print("in coach.request_exercise") - #self._dis.offer_coll_to_learner([t.get_topic() for t in self._exs]) self._dis.offer_coll_to_learner(self._collect) # calls back with notify('exerc-selected'... def notify(self, (msg, data)): """called by the observed objects""" print("in coach.notify: msg=, data=", (msg, data)) - if msg == 'setting-done': # from - # + self._setts.save_last_sett(self._key, data) + if msg == 'setting-done': # from display self._ex.update_setting(data) - self._update_exs(self._ex) ################################ + #self._update_exs(self._ex) self._learner.notify((msg, self._ex)) elif msg == 'exerc-selected': - #self._ex = self.get_ex(data) self._ex = self._collect.select(data) print('in coach.notify(exerc-selected), 93 self._ex._sett=', self._ex._sett) self._dis.offer_setting(self._ex) - def get_ex(self, tpc): - """ Get an Exercise by topic. """ - for _t in self._exs: - if _t.get_topic() == tpc: - return _t +# def get_ex(self, tpc): +# """ Get an Exercise by topic. """ +# for _t in self._exs: +# if _t.get_topic() == tpc: +# return _t diff --git a/ReckonPrimer.activity/session.py b/ReckonPrimer.activity/session.py index f583d47..bb6f073 100755 --- a/ReckonPrimer.activity/session.py +++ b/ReckonPrimer.activity/session.py @@ -22,7 +22,7 @@ class Session: self._collect = Collection(self._dis, self._co) self._co.register(self, self._dis, self._collect, self._learner) self._dis.register(self, self._co, self._learner) - self._co.create_exercises() #TODO.WN091101 replace by storing Exerc.s + #self._co.create_exercises() #TODO.WN091101 replace by storing Exerc.s self._calcs = None #pop ! def run(self): -- cgit v0.9.1